Skip to content

Commit

Permalink
Add more GL200 states
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Sep 28, 2017
1 parent 5678fb0 commit d793e86
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions src/org/traccar/protocol/Gl200TextProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,22 +394,35 @@ private Object decodeInf(Channel channel, SocketAddress remoteAddress, String se
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
Expand Down

0 comments on commit d793e86

Please sign in to comment.