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/Gps103ProtocolDecoder.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/Gps103ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 821cf2d21..9d3fda345 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -102,6 +102,23 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { .any() .compile(); + private String decodeAlarm(String value) { + if (value == "tracker") { + return null; + } else if (value == "help me") { + return Position.ALARM_SOS; + } else if (value == "low battery") { + return Position.ALARM_LOW_BATTERY; + } else if (value == "stockade") { + return Position.ALARM_GEOFENCE; + } else if (value == "move") { + return Position.ALARM_MOVEMENT; + } else if (value == "speed") { + return Position.ALARM_OVERSPEED; + } + return null; + } + @Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { @@ -195,7 +212,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); String alarm = parser.next(); - position.set(Position.KEY_ALARM, alarm); + position.set(Position.KEY_ALARM, decodeAlarm(alarm)); if (channel != null && alarm.equals("help me")) { channel.write("**,imei:" + imei + ",E;", remoteAddress); } |