aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-06-19 11:21:20 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-06-19 11:21:20 -0700
commit9084c4db98eef6621e93b3f0fce6e7a61b683a06 (patch)
treebc5c1a8fc534cd4dcb86143b21a7f6a66433245d /src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java
parentd834c23f8602fd8f3321d8cb8ff9648b163cdafd (diff)
downloadtrackermap-server-9084c4db98eef6621e93b3f0fce6e7a61b683a06.tar.gz
trackermap-server-9084c4db98eef6621e93b3f0fce6e7a61b683a06.tar.bz2
trackermap-server-9084c4db98eef6621e93b3f0fce6e7a61b683a06.zip
Missing Pacific Track attributes
Diffstat (limited to 'src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java
index d49a73a86..b1c13d486 100644
--- a/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java
@@ -105,12 +105,31 @@ public class PacificTrackProtocolDecoder extends BaseProtocolDecoder {
case 0b00001:
position.set(Position.KEY_RPM, buf.readUnsignedByte() * 32);
break;
+ case 0b01001:
+ position.set("defLevel", buf.readUnsignedByte() * 0.4);
+ break;
+ case 0b01010:
+ position.set(Position.KEY_ENGINE_LOAD, buf.readUnsignedByte());
+ break;
+ case 0b01011:
+ position.set("barometer", buf.readUnsignedByte() * 0.5);
+ break;
default:
buf.readUnsignedByte();
break;
}
} else if (fieldPrefix < 0b110) {
- buf.readUnsignedShort();
+ switch (BitUtil.to(field, 5)) {
+ case 0b00010:
+ position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() / 512.0);
+ break;
+ case 0b00011:
+ position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort() * 0.03125 - 273);
+ break;
+ default:
+ buf.readUnsignedShort();
+ break;
+ }
} else if (fieldPrefix < 0b111) {
switch (BitUtil.to(field, 5)) {
case 0b00000:
@@ -122,6 +141,12 @@ public class PacificTrackProtocolDecoder extends BaseProtocolDecoder {
case 0b00010:
position.set("idleHours", buf.readUnsignedInt() * 180);
break;
+ case 0b00100:
+ position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() * 0.5);
+ break;
+ case 0b00101:
+ position.set("fuelUsedIdle", buf.readUnsignedInt() * 0.5);
+ break;
default:
buf.readUnsignedInt();
break;
@@ -141,8 +166,15 @@ public class PacificTrackProtocolDecoder extends BaseProtocolDecoder {
}
}
+ if (deviceSession == null) {
+ deviceSession = getDeviceSession(channel, remoteAddress);
+ }
+
if (deviceSession != null) {
position.setDeviceId(deviceSession.getDeviceId());
+ if (position.getFixTime() == null) {
+ getLastLocation(position, null);
+ }
return position;
} else {
return null;