aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-10-16 12:54:28 -0700
committerAnton Tananaev <anton@traccar.org>2022-10-16 12:54:28 -0700
commitdb97378f2210818d0600420bc9c69103ddea248b (patch)
tree88a66baf0e06b3ce10a95b9b95bfc8337732a050 /src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
parent3f01f92125851e325b8e3e4ef679d832fe3dee21 (diff)
downloadtrackermap-server-db97378f2210818d0600420bc9c69103ddea248b.tar.gz
trackermap-server-db97378f2210818d0600420bc9c69103ddea248b.tar.bz2
trackermap-server-db97378f2210818d0600420bc9c69103ddea248b.zip
Improve Suntech support
Diffstat (limited to 'src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
index f1097abac..e67bd7a71 100644
--- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -43,6 +43,7 @@ import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.TimeZone;
+import java.util.stream.Collectors;
public class SuntechProtocolDecoder extends BaseProtocolDecoder {
@@ -203,12 +204,16 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
return Position.ALARM_POWER_RESTORED;
case 41:
return Position.ALARM_POWER_CUT;
+ case 42:
+ return Position.ALARM_SOS;
case 46:
return Position.ALARM_ACCELERATION;
case 47:
return Position.ALARM_BRAKING;
case 50:
return Position.ALARM_JAMMING;
+ case 132:
+ return Position.ALARM_DOOR;
default:
return null;
}
@@ -468,7 +473,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
String type = values[index++];
- if (!type.equals("STT") && !type.equals("ALT") && !type.equals("BLE")) {
+ if (!type.equals("STT") && !type.equals("ALT") && !type.equals("BLE") && !type.equals("RES")) {
return null;
}
@@ -481,6 +486,14 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(deviceSession.getDeviceId());
position.set(Position.KEY_TYPE, type);
+ if (type.equals("RES")) {
+ getLastLocation(position, null);
+ position.set(
+ Position.KEY_RESULT,
+ Arrays.stream(values, index, values.length).collect(Collectors.joining(";")));
+ return position;
+ }
+
int mask;
if (type.equals("BLE")) {
mask = 0b1100000110110;
@@ -581,7 +594,8 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
if (type.equals("ALT")) {
if (BitUtil.check(mask, 19)) {
- position.set("alertId", values[index++]);
+ int alertId = Integer.parseInt(values[index++]);
+ position.set(Position.KEY_ALARM, decodeAlert(alertId));
}
if (BitUtil.check(mask, 20)) {
position.set("alertModifier", values[index++]);