diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-11-24 06:09:42 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-11-24 06:09:42 +1300 |
commit | 81a63d9a8fa90ddf94f32b76ff21a8adf9a6ef3a (patch) | |
tree | b57f0c87edceab9caee2d339eaebc8158c7a5a50 /src/org | |
parent | b3e0f34d6dc7a996ffa70b02e480937268514b22 (diff) | |
download | traccar-server-81a63d9a8fa90ddf94f32b76ff21a8adf9a6ef3a.tar.gz traccar-server-81a63d9a8fa90ddf94f32b76ff21a8adf9a6ef3a.tar.bz2 traccar-server-81a63d9a8fa90ddf94f32b76ff21a8adf9a6ef3a.zip |
Decode GoSafe IO status
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/protocol/GoSafeProtocolDecoder.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java index f9aaae0ce..62f6212e2 100644 --- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java +++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java @@ -168,10 +168,18 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, parser.nextDouble()); if (parser.hasNext(6)) { - long status = parser.nextLong(16, 0); - position.set(Position.KEY_IGNITION, BitUtil.check(status, 13)); - position.set(Position.KEY_STATUS, status); - position.set("ioStatus", parser.next()); + position.set(Position.KEY_STATUS, parser.nextHexLong()); + Integer io = parser.nextHexInt(); + if (io != null) { + position.set(Position.KEY_IGNITION, BitUtil.check(io, 0)); + position.set(Position.PREFIX_IN + 1, BitUtil.check(io, 1)); + position.set(Position.PREFIX_IN + 2, BitUtil.check(io, 2)); + position.set(Position.PREFIX_IN + 3, BitUtil.check(io, 3)); + position.set(Position.PREFIX_IN + 4, BitUtil.check(io, 4)); + position.set(Position.PREFIX_OUT + 1, BitUtil.check(io, 5)); + position.set(Position.PREFIX_OUT + 2, BitUtil.check(io, 6)); + position.set(Position.PREFIX_OUT + 3, BitUtil.check(io, 7)); + } position.set(Position.KEY_GEOFENCE, parser.next() + parser.next()); position.set("eventStatus", parser.next()); position.set("packetType", parser.next()); |