diff options
Diffstat (limited to 'src')
-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 |