aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/SuntechProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-27 06:05:16 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-09-27 06:05:16 +1300
commitb44223a1bdba7c3c793600f4beac232206067b01 (patch)
treeca6a9892b6eb31ad116ca6ca4301920ec15c48ee /src/org/traccar/protocol/SuntechProtocolDecoder.java
parent17d5fbb60d859abe366d52137ae2c3cea2de1f5a (diff)
downloadtrackermap-server-b44223a1bdba7c3c793600f4beac232206067b01.tar.gz
trackermap-server-b44223a1bdba7c3c793600f4beac232206067b01.tar.bz2
trackermap-server-b44223a1bdba7c3c793600f4beac232206067b01.zip
Decode SunTech alerts
Diffstat (limited to 'src/org/traccar/protocol/SuntechProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index 3b350ba64..320df9c94 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -114,6 +114,8 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
switch (value) {
case 1:
return Position.ALARM_SOS;
+ case 2:
+ return Position.ALARM_PARKING;
case 3:
return Position.ALARM_POWER_CUT;
case 5:
@@ -128,6 +130,33 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
}
}
+ private String decodeAlert(int value) {
+ switch (value) {
+ case 1:
+ return Position.ALARM_OVERSPEED;
+ case 5:
+ return Position.ALARM_GEOFENCE_EXIT;
+ case 6:
+ return Position.ALARM_GEOFENCE_ENTER;
+ case 14:
+ return Position.ALARM_LOW_BATTERY;
+ case 15:
+ return Position.ALARM_SHOCK;
+ case 16:
+ return Position.ALARM_ACCIDENT;
+ case 46:
+ return Position.ALARM_ACCELERATION;
+ case 47:
+ return Position.ALARM_BREAKING;
+ case 48:
+ return Position.ALARM_ACCIDENT;
+ case 50:
+ return Position.ALARM_JAMMING;
+ default:
+ return null;
+ }
+ }
+
private Position decode235(
Channel channel, SocketAddress remoteAddress, String protocol, String[] values) throws ParseException {
int index = 0;
@@ -193,9 +222,11 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ALARM, decodeEmergency(Integer.parseInt(values[index++])));
break;
case "EVT":
- case "ALT":
position.set(Position.KEY_EVENT, Integer.parseInt(values[index++]));
break;
+ case "ALT":
+ position.set(Position.KEY_ALARM, decodeAlert(Integer.parseInt(values[index++])));
+ break;
default:
break;
}