diff options
author | Abyss777 <abyss@fox5.ru> | 2016-08-01 12:10:17 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-08-01 12:10:17 +0500 |
commit | c41c8edd7e4d275885cbef72212e553a2c86c9b4 (patch) | |
tree | 08740df9c0c871e0ad3dc52d7b84c76f18cc912b /src/org/traccar/protocol/Tk103ProtocolDecoder.java | |
parent | 20c2456a9df46eaef04c787ea5471bf31a71f93c (diff) | |
download | trackermap-server-c41c8edd7e4d275885cbef72212e553a2c86c9b4.tar.gz trackermap-server-c41c8edd7e4d275885cbef72212e553a2c86c9b4.tar.bz2 trackermap-server-c41c8edd7e4d275885cbef72212e553a2c86c9b4.zip |
- Added a few more protocols
- Removed useless alarms
- Optimizations
Diffstat (limited to 'src/org/traccar/protocol/Tk103ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Tk103ProtocolDecoder.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java index a76c208b5..72ecdc2de 100644 --- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java @@ -75,6 +75,19 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { .any() .compile(); + private String decodeAlarm(int value) { + switch (value) { + case 0: return Position.ALARM_OIL_CUT; + case 1: return Position.ALARM_ACCIDENT; + case 2: return Position.ALARM_SOS; + case 3: return Position.ALARM_VIBRATION; + case 4: return Position.ALARM_LOW_SPEED; + case 5: return Position.ALARM_OVERSPEED; + case 6: return Position.ALARM_GEOFENCE_EXIT; + default: return null; + } + } + @Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { @@ -160,7 +173,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { int alarm = sentence.indexOf("BO01"); if (alarm != -1) { - position.set(Position.KEY_ALARM, Integer.parseInt(sentence.substring(alarm + 4, alarm + 5))); + position.set(Position.KEY_ALARM, decodeAlarm(Integer.parseInt(sentence.substring(alarm + 4, alarm + 5)))); } DateBuilder dateBuilder = new DateBuilder(); |