diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-09-29 01:45:43 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-09-29 10:46:46 +1300 |
commit | d793e868311918f039fc201fbe2608c6bd5ae3f3 (patch) | |
tree | 3ddfb1efb30d5af0d12a31b63555546f806e32e6 /src/org/traccar/protocol | |
parent | 5678fb06b466839ee4a34ec85f6b23a816a830cd (diff) | |
download | trackermap-server-d793e868311918f039fc201fbe2608c6bd5ae3f3.tar.gz trackermap-server-d793e868311918f039fc201fbe2608c6bd5ae3f3.tar.bz2 trackermap-server-d793e868311918f039fc201fbe2608c6bd5ae3f3.zip |
Add more GL200 states
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/Gl200TextProtocolDecoder.java | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java index 090e02812..2f03cbb8f 100644 --- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -394,22 +394,35 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { return null; } - String status = parser.next(); - - if (status.charAt(0) == '2') { - position.set(Position.KEY_IGNITION, true); - } else if (status.charAt(0) == '4') { - position.set(Position.KEY_IGNITION, false); - } - - if (status.charAt(1) == '1') { - position.set(Position.KEY_MOTION, false); - } else if (status.charAt(1) == '2') { - position.set(Position.KEY_MOTION, true); + switch (parser.nextHexInt()) { + case 0x16: + case 0x1A: + case 0x12: + position.set(Position.KEY_IGNITION, false); + position.set(Position.KEY_MOTION, true); + break; + case 0x11: + position.set(Position.KEY_IGNITION, false); + position.set(Position.KEY_MOTION, false); + break; + case 0x21: + position.set(Position.KEY_IGNITION, true); + position.set(Position.KEY_MOTION, false); + break; + case 0x22: + position.set(Position.KEY_IGNITION, true); + position.set(Position.KEY_MOTION, true); + break; + case 0x41: + position.set(Position.KEY_MOTION, false); + break; + case 0x42: + position.set(Position.KEY_MOTION, true); + break; + default: + break; } - position.set(Position.KEY_STATUS, status); - position.set(Position.KEY_RSSI, parser.nextInt()); parser.next(); // odometer or external power |