diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-08 19:14:23 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-08 19:14:23 +1300 |
commit | e3a3f06cc07bc5d75d3d670e045abb5d6c91fcad (patch) | |
tree | ee424dc1b6b86abb54abcc5fe4f2068ac0cbf286 /src/org/traccar/protocol/NavigilProtocolDecoder.java | |
parent | b7e53f57689e1f8a1c0705aeea32dc6e69f3fcb3 (diff) | |
parent | f94613b97cf80af64154ae571920a273771fa1d3 (diff) | |
download | trackermap-server-e3a3f06cc07bc5d75d3d670e045abb5d6c91fcad.tar.gz trackermap-server-e3a3f06cc07bc5d75d3d670e045abb5d6c91fcad.tar.bz2 trackermap-server-e3a3f06cc07bc5d75d3d670e045abb5d6c91fcad.zip |
Merge pull request #2979 from jon-stumpf/jss-add-info
Additional Protocol Information
Diffstat (limited to 'src/org/traccar/protocol/NavigilProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/NavigilProtocolDecoder.java | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java index 263e5fc2b..360b9c81c 100644 --- a/src/org/traccar/protocol/NavigilProtocolDecoder.java +++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java @@ -89,25 +89,25 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); buf.readUnsignedShort(); // report trigger - buf.readUnsignedShort(); // flags + position.set(Position.KEY_FLAGS, buf.readUnsignedShort()); position.setLatitude(buf.readInt() * 0.0000001); position.setLongitude(buf.readInt() * 0.0000001); position.setAltitude(buf.readUnsignedShort()); - position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); // satellites in fix - position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); // satellites in track - buf.readUnsignedShort(); // GPS antenna state + position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); + position.set("gpsAntennaState", buf.readUnsignedShort()); position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort()); - buf.readUnsignedInt(); // distance - buf.readUnsignedInt(); // delta distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + position.set(Position.KEY_DISTANCE, buf.readUnsignedInt()); position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); - position.set(Position.KEY_CHARGE, buf.readUnsignedShort()); // battery charger status + position.set(Position.KEY_CHARGE, buf.readUnsignedShort()); position.setTime(convertTimestamp(buf.readUnsignedInt())); @@ -133,19 +133,20 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(buf.readInt() * 0.0000001); position.setAltitude(buf.readUnsignedShort()); - position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); // satellites in fix - position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); // satellites in track + position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort()); - buf.readUnsignedInt(); // distance - buf.readUnsignedShort(); // maximum speed - buf.readUnsignedShort(); // minimum speed + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + position.set("maximumSpeed", buf.readUnsignedShort()); + position.set("minimumSpeed", buf.readUnsignedShort()); + + position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); // VSAUT1 voltage + position.set(Position.PREFIX_IO + 2, buf.readUnsignedShort()); // VSAUT2 voltage + position.set(Position.PREFIX_IO + 3, buf.readUnsignedShort()); // solar voltage - buf.readUnsignedShort(); // VSAUT1 voltage - buf.readUnsignedShort(); // VSAUT2 voltage - buf.readUnsignedShort(); // solar voltage position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); return position; @@ -170,6 +171,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setValid((flags & 0x80) == 0x80 && (flags & 0x40) == 0x40); buf.readUnsignedByte(); // reserved + return position; } @@ -193,7 +195,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setValid((flags & 0x80) == 0x80 && (flags & 0x40) == 0x40); position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); - buf.readUnsignedInt(); // distance + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + return position; } @@ -219,18 +222,18 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(buf.readInt() * 0.0000001); position.setAltitude(buf.readUnsignedShort()); - position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); // satellites in fix - position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); // satellites in track + position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); position.setSpeed(buf.readUnsignedShort() * 0.194384); position.setCourse(buf.readUnsignedShort() * 0.1); - buf.readUnsignedByte(); // maximum speed - buf.readUnsignedByte(); // minimum speed - buf.readUnsignedInt(); // distance + position.set("maximumSpeed", buf.readUnsignedByte()); + position.set("minimumSpeed", buf.readUnsignedByte()); + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); - buf.readUnsignedByte(); // supply voltage 1 - buf.readUnsignedByte(); // supply voltage 2 + position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte()); // supply voltage 1 + position.set(Position.PREFIX_IO + 2, buf.readUnsignedByte()); // supply voltage 2 position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); return position; @@ -258,11 +261,10 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte())); position.setCourse(buf.readUnsignedByte() * 2.0); - position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); // satellites in fix - + position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001); + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); - buf.readUnsignedInt(); // distance return position; } |