aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-30 20:22:05 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-09-30 20:22:05 +1300
commit36d09739e518f715800c924c90f0b598a9912433 (patch)
treeb79d83cb6d5fa42a4a2be5ce452f21c6a539721d /src/org/traccar
parent6c2ef65bce9b3d9c7a88da941acf14603965ef93 (diff)
downloadtrackermap-server-36d09739e518f715800c924c90f0b598a9912433.tar.gz
trackermap-server-36d09739e518f715800c924c90f0b598a9912433.tar.bz2
trackermap-server-36d09739e518f715800c924c90f0b598a9912433.zip
Decode StarLink alarms
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/StarLinkProtocolDecoder.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/org/traccar/protocol/StarLinkProtocolDecoder.java
index 38f6980f6..79f013fac 100644
--- a/src/org/traccar/protocol/StarLinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/StarLinkProtocolDecoder.java
@@ -69,6 +69,29 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
return value.charAt(0) == '+' ? result : -result;
}
+ private String decodeAlarm(int event) {
+ switch (event) {
+ case 6:
+ return Position.ALARM_OVERSPEED;
+ case 7:
+ return Position.ALARM_GEOFENCE_ENTER;
+ case 8:
+ return Position.ALARM_GEOFENCE_EXIT;
+ case 9:
+ return Position.ALARM_POWER_CUT;
+ case 11:
+ return Position.ALARM_LOW_BATTERY;
+ case 26:
+ return Position.ALARM_TOW;
+ case 36:
+ return Position.ALARM_SOS;
+ case 42:
+ return Position.ALARM_JAMMING;
+ default:
+ return null;
+ }
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -109,6 +132,7 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
break;
case "#EID#":
event = Integer.parseInt(data[i]);
+ position.set(Position.KEY_ALARM, decodeAlarm(event));
position.set(Position.KEY_EVENT, event);
break;
case "#PDT#":