aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
diff options
context:
space:
mode:
authorjcardus <joaquim.cardeira@gmail.com>2020-03-25 17:25:19 +0000
committerjcardus <joaquim.cardeira@gmail.com>2020-03-25 17:25:19 +0000
commitfeac85bad4004fb3e316a88285626e12840398d2 (patch)
treed268a79d63b9d1f27b6e433fedc90de7b427b172 /src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
parent7b669e3181f637f06b31b55bd930584c7b08e897 (diff)
parentf3d465abe7f255ec44e976caade642e4c2fd7598 (diff)
downloadtrackermap-server-feac85bad4004fb3e316a88285626e12840398d2.tar.gz
trackermap-server-feac85bad4004fb3e316a88285626e12840398d2.tar.bz2
trackermap-server-feac85bad4004fb3e316a88285626e12840398d2.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
index 915f764e1..978d768be 100644
--- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -397,7 +397,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
if (isIncludeAdc(deviceSession.getDeviceId())) {
for (int i = 1; i <= 3; i++) {
- if (!values[index++].isEmpty()) {
+ if (index < values.length && !values[index++].isEmpty()) {
position.set(Position.PREFIX_ADC + i, Double.parseDouble(values[index - 1]));
}
}
@@ -614,10 +614,21 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
}
+ int alertId = 0;
if (BitUtil.check(mask, 19)) {
- int value = buf.readUnsignedByte();
+ alertId = buf.readUnsignedByte();
if (type == 0x82) {
- position.set(Position.KEY_ALARM, decodeAlert(value));
+ position.set(Position.KEY_ALARM, decodeAlert(alertId));
+ }
+ }
+
+ if (BitUtil.check(mask, 20)) {
+ buf.readUnsignedShort(); // alert mod
+ }
+
+ if (BitUtil.check(mask, 21)) {
+ if (alertId == 59) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(8)));
}
}