aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-01-20 16:42:21 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-01-20 20:27:48 +1300
commita83353fd0b21ae5ff75680e45e3a06b89c4f2de4 (patch)
treed14aadb9d992010e2f63a24625886e73a40431b6 /src
parent0c71214728c80204523e3d1ab12ab11e2725f2c6 (diff)
downloadtrackermap-server-a83353fd0b21ae5ff75680e45e3a06b89c4f2de4.tar.gz
trackermap-server-a83353fd0b21ae5ff75680e45e3a06b89c4f2de4.tar.bz2
trackermap-server-a83353fd0b21ae5ff75680e45e3a06b89c4f2de4.zip
Decode Mictrack status
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index cbc851de0..4be1fc865 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -57,6 +57,45 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
.any()
.compile();
+ private void decodeStatus(Position position, String status) {
+ switch (status) {
+ case "AUTOSTART":
+ case "AUTO":
+ position.set(Position.KEY_IGNITION, true);
+ break;
+ case "AUTOSTOP":
+ case "AUTOLOW":
+ position.set(Position.KEY_IGNITION, false);
+ break;
+ case "TOWED":
+ position.set(Position.KEY_ALARM, Position.ALARM_TOW);
+ break;
+ case "SOS":
+ position.set(Position.KEY_ALARM, Position.ALARM_SOS);
+ break;
+ case "DEF":
+ position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT);
+ break;
+ case "BLP":
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
+ break;
+ case "CLP":
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER);
+ break;
+ case "OS":
+ position.set(Position.KEY_ALARM, Position.ALARM_GEOFENCE_EXIT);
+ break;
+ case "RS":
+ position.set(Position.KEY_ALARM, Position.ALARM_GEOFENCE_ENTER);
+ break;
+ case "OVERSPEED":
+ position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
+ break;
+ default:
+ break;
+ }
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -102,7 +141,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
position.setTime(dateBuilder.getDate());
- position.set(Position.KEY_STATUS, status);
+ decodeStatus(position, status);
positions.add(position);
}