aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-01-28 23:40:41 +1300
committerGitHub <noreply@github.com>2017-01-28 23:40:41 +1300
commit26175114ee573caa1774a04157253789d4a93998 (patch)
tree33078f231452cc8512e4418821b61a48610c83ef /src/org/traccar
parent6b77ba3ae328e3eeecb3d770a2a2de39afe81341 (diff)
parent533a4cd67d8e91c2571cd214efc2d488a376ef93 (diff)
downloadtrackermap-server-26175114ee573caa1774a04157253789d4a93998.tar.gz
trackermap-server-26175114ee573caa1774a04157253789d4a93998.tar.bz2
trackermap-server-26175114ee573caa1774a04157253789d4a93998.zip
Merge pull request #2841 from ssmipp/telic
#2793 Added some Telic events (alarm)
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/TelicProtocolDecoder.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/TelicProtocolDecoder.java b/src/org/traccar/protocol/TelicProtocolDecoder.java
index 4d496426d..1560efccc 100644
--- a/src/org/traccar/protocol/TelicProtocolDecoder.java
+++ b/src/org/traccar/protocol/TelicProtocolDecoder.java
@@ -77,7 +77,10 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(deviceSession.getDeviceId());
- position.set(Position.KEY_TYPE, parser.next());
+ int event = parser.nextInt();
+ position.set(Position.KEY_TYPE, event);
+
+ position.set(Position.KEY_ALARM, decodeAlarm(event));
DateBuilder dateBuilder = new DateBuilder()
.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt())
@@ -105,4 +108,25 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder {
return position;
}
+ private String decodeAlarm(int eventId) {
+
+ switch (eventId) {
+ case 1:
+ return Position.ALARM_POWER_ON;
+ case 2:
+ return Position.ALARM_SOS;
+ case 5:
+ return Position.ALARM_POWER_OFF;
+ case 7:
+ return Position.ALARM_GEOFENCE_ENTER;
+ case 8:
+ return Position.ALARM_GEOFENCE_EXIT;
+ case 22:
+ return Position.ALARM_LOW_BATTERY;
+ case 25:
+ return Position.ALARM_MOVEMENT;
+ default:
+ return null;
+ }
+ }
}