diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-09-19 22:45:32 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-09-19 22:45:32 +1200 |
commit | 920f7d9d475bd12d37c51e585ae810c2c0d596c3 (patch) | |
tree | b00fd9d7d03d4fcc35117c4e9038086b34f4637b | |
parent | 989956915085944d6d5ac550020a7a854c68b541 (diff) | |
download | traccar-server-920f7d9d475bd12d37c51e585ae810c2c0d596c3.tar.gz traccar-server-920f7d9d475bd12d37c51e585ae810c2c0d596c3.tar.bz2 traccar-server-920f7d9d475bd12d37c51e585ae810c2c0d596c3.zip |
Add GPS103 ignition alarms
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 1a34a6bd8..363834f89 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -216,8 +216,14 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { String alarm = parser.next(); position.set(Position.KEY_ALARM, decodeAlarm(alarm)); - if (channel != null && alarm.equals("help me")) { - channel.write("**,imei:" + imei + ",E;", remoteAddress); + if (alarm.equals("help me")) { + if (channel != null) { + channel.write("**,imei:" + imei + ",E;", remoteAddress); + } + } else if (alarm.equals("acc on")) { + position.set(Position.KEY_IGNITION, true); + } else if (alarm.equals("acc off")) { + position.set(Position.KEY_IGNITION, false); } DateBuilder dateBuilder = new DateBuilder() |