diff options
author | RafaelMiquelino <rafaelmiquelino@gmail.com> | 2021-03-30 21:44:50 -0300 |
---|---|---|
committer | RafaelMiquelino <rafaelmiquelino@gmail.com> | 2021-03-30 21:44:50 -0300 |
commit | 38f4c7ea61c58397ba42e527621bdece88fa472b (patch) | |
tree | bcf9fc338d0d665322547edae99f164dfce86ff0 /src/main/java/org/traccar | |
parent | 00ddff42e766e834dee49eb471c0c3aefab022b2 (diff) | |
download | trackermap-server-38f4c7ea61c58397ba42e527621bdece88fa472b.tar.gz trackermap-server-38f4c7ea61c58397ba42e527621bdece88fa472b.tar.bz2 trackermap-server-38f4c7ea61c58397ba42e527621bdece88fa472b.zip |
Modify Vt200ProtocolDecoder.java
Implements ignition status decoding on VT200 protocol.
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java index b1564abd9..f60f6213d 100644 --- a/src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java @@ -142,6 +142,32 @@ public class Vt200ProtocolDecoder extends BaseProtocolDecoder { return position; + } else if (type == 0x3089) { + + Position position = new Position(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + position.set(Position.KEY_IGNITION, buf.readUnsignedByte() == 1); + buf.readUnsignedShort(); // trip id + + position.setTime(decodeDate(buf)); + + if (buf.readableBytes() >= 9) { + position.setLatitude(decodeCoordinate(BcdUtil.readInteger(buf, 8))); + position.setLongitude(decodeCoordinate(BcdUtil.readInteger(buf, 9))); + + int flags = buf.readUnsignedByte(); + position.setValid(BitUtil.check(flags, 0)); + if (!BitUtil.check(flags, 1)) { + position.setLatitude(-position.getLatitude()); + } + if (!BitUtil.check(flags, 2)) { + position.setLongitude(-position.getLongitude()); + } + } + + return position; + } return null; |