aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-03-28 12:05:30 -0700
committerGitHub <noreply@github.com>2022-03-28 12:05:30 -0700
commit853df8c7ae682266714e6e0ee66095f718d42e0a (patch)
tree877d6cc786687e03faa3a98985d0320ef3881e85 /src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
parent4350c1634b7cfd1e8005908b8c72ec32a882276f (diff)
parentc4f36004c11306130f17be2f271d8e95ddf87ffc (diff)
downloadtrackermap-server-853df8c7ae682266714e6e0ee66095f718d42e0a.tar.gz
trackermap-server-853df8c7ae682266714e6e0ee66095f718d42e0a.tar.bz2
trackermap-server-853df8c7ae682266714e6e0ee66095f718d42e0a.zip
Merge pull request #4827 from yuriy-piskarev/master
Decode additional Navtelecom info
Diffstat (limited to 'src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java76
1 files changed, 75 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
index 5d3a81f2a..7d6991a2f 100644
--- a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
@@ -195,6 +195,9 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
for (int j = 0; j < bits.length(); j++) {
if (bits.get(j)) {
+
+ int value = 0;
+
switch (j + 1) {
case 1:
position.set(Position.KEY_INDEX, buf.readUnsignedIntLE());
@@ -205,8 +208,12 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
case 3:
position.setDeviceTime(new Date(buf.readUnsignedIntLE() * 1000));
break;
+ case 8:
+ value = buf.readUnsignedByte();
+ position.setValid(BitUtil.check(value, 1));
+ position.set(Position.KEY_SATELLITES, BitUtil.from(value, 2));
+ break;
case 9:
- position.setValid(true);
position.setFixTime(new Date(buf.readUnsignedIntLE() * 1000));
break;
case 10:
@@ -221,6 +228,73 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
case 13:
position.setSpeed(UnitsConverter.knotsFromKph(buf.readFloatLE()));
break;
+ case 14:
+ position.setCourse(buf.readUnsignedShortLE());
+ break;
+ case 15:
+ position.set(Position.KEY_ODOMETER, buf.readFloatLE());
+ break;
+ case 19:
+ position.set(Position.KEY_POWER, buf.readShortLE() * 0.001);
+ break;
+ case 20:
+ position.set(Position.KEY_BATTERY, buf.readShortLE() * 0.001);
+ break;
+ case 21:
+ case 22:
+ case 23:
+ case 24:
+ case 25:
+ case 26:
+ position.set(Position.PREFIX_ADC + (j + 2 - 21), buf.readUnsignedShortLE() * 0.001);
+ break;
+ case 29:
+ value = buf.readUnsignedByte();
+ for (int k = 0; k <= 7; k++) {
+ position.set(Position.PREFIX_IN + (k + 1), BitUtil.check(value, k) ? 1 : 0);
+ }
+ break;
+ case 31:
+ value = buf.readUnsignedByte();
+ for (int k = 0; k <= 3; k++) {
+ position.set(Position.PREFIX_OUT + (k + 1), BitUtil.check(value, k) ? 1 : 0);
+ }
+ break;
+ case 33:
+ case 34:
+ position.set(Position.PREFIX_COUNT + (j + 2 - 33), buf.readUnsignedIntLE());
+ break;
+ case 35:
+ case 36:
+ position.set("freq" + (j + 2 - 35), buf.readUnsignedShortLE());
+ break;
+ case 37:
+ position.set(Position.KEY_HOURS, buf.readUnsignedIntLE());
+ break;
+ case 38:
+ case 39:
+ case 40:
+ case 41:
+ case 42:
+ case 43:
+ value = buf.readUnsignedShortLE();
+ position.set("rs485Fuel" + (j + 2 - 38), (value < 65500) ? value : null);
+ break;
+ case 44:
+ value = buf.readUnsignedShortLE();
+ position.set("rs232Fuel", (value < 65500) ? value : null);
+ break;
+ case 45:
+ case 46:
+ case 47:
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ value = buf.readByte();
+ position.set(Position.PREFIX_TEMP + (j + 2 - 45), (value != 0x80) ? value : null);
+ break;
default:
buf.skipBytes(getItemLength(j + 1));
break;