aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2023-08-30 17:34:36 -0700
committerGitHub <noreply@github.com>2023-08-30 17:34:36 -0700
commite8285fd4ea640ca24e2250fe124e61ab80a8adc4 (patch)
tree5ca812ec8a93c3c739ee1a1cb239454dab3e0b03 /src/main/java
parentb56282ad98038df6098c8ca2014cb5516be5a7fc (diff)
parent987e2f9192ac3d0381235335b44f35ed83f78a3f (diff)
downloadtrackermap-server-e8285fd4ea640ca24e2250fe124e61ab80a8adc4.tar.gz
trackermap-server-e8285fd4ea640ca24e2250fe124e61ab80a8adc4.tar.bz2
trackermap-server-e8285fd4ea640ca24e2250fe124e61ab80a8adc4.zip
Merge pull request #4839 from yuriy-piskarev/master
add 53-69 fields for Navtelecom protocol
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java121
1 files changed, 116 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
index 08b1a8d0f..2e857b212 100644
--- a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
@@ -208,6 +208,19 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
case 3:
position.setDeviceTime(new Date(buf.readUnsignedIntLE() * 1000));
break;
+ case 4:
+ value = buf.readUnsignedByte();
+ position.set(
+ Position.KEY_ALARM,
+ BitUtil.check(value, 2) ? Position.ALARM_GENERAL : null);
+ int guardMode = BitUtil.between(value, 3, 4);
+ position.set(Position.KEY_ARMED, (0 < guardMode) && (guardMode < 3));
+ break;
+
+ case 5:
+ value = buf.readUnsignedByte();
+ position.set(Position.KEY_ROAMING, BitUtil.check(value, 6) ? true : null);
+ break;
case 8:
value = buf.readUnsignedByte();
position.setValid(BitUtil.check(value, 1));
@@ -269,7 +282,7 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
position.set("freq" + (j + 2 - 35), buf.readUnsignedShortLE());
break;
case 37:
- position.set(Position.KEY_HOURS, buf.readUnsignedIntLE());
+ position.set(Position.KEY_HOURS, buf.readUnsignedIntLE() * 1000);
break;
case 38:
case 39:
@@ -278,7 +291,8 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
case 42:
case 43:
value = buf.readUnsignedShortLE();
- position.set("fuel" + (j + 2 - 38), (value < 65500) ? value : null);
+ position.set(
+ Position.KEY_FUEL_LEVEL + (j + 2 - 38), (value < 65500) ? value : null);
break;
case 44:
value = buf.readUnsignedShortLE();
@@ -294,8 +308,76 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
case 52:
value = buf.readByte();
position.set(
- Position.PREFIX_TEMP + (j + 2 - 45),
- (value != (byte) 0x80) ? value : null);
+ Position.PREFIX_TEMP + (j + 2 - 45), (value != (byte) 0x80) ? value : null);
+ break;
+ case 53:
+ value = buf.readUnsignedShortLE();
+ if (value != 0x7FFF) {
+ if (BitUtil.check(value, 7)) {
+ position.set("obdFuelLevel", BitUtil.to(value, 6));
+ } else {
+ position.set("obdFuel", BitUtil.to(value, 6) / 10);
+ }
+ }
+ break;
+ case 54:
+ position.set(Position.KEY_FUEL_USED, buf.readFloatLE());
+ break;
+ case 55:
+ value = buf.readUnsignedShortLE();
+ position.set(Position.KEY_RPM, (value != 0xFFFF) ? value : null);
+ break;
+ case 56:
+ value = buf.readByte();
+ position.set(Position.KEY_COOLANT_TEMP, (value != (byte) 0x80) ? value : null);
+ break;
+ case 57:
+ position.set(Position.KEY_OBD_ODOMETER, buf.readFloatLE());
+ break;
+ case 58:
+ case 59:
+ case 60:
+ case 61:
+ case 62:
+ value = buf.readUnsignedShortLE();
+ position.set("axleWeight" + (j + 2 - 58), (value != 0xFFFF) ? value : null);
+ break;
+ case 63:
+ value = buf.readUnsignedByte();
+ position.set("acceleratorPosition", (value != 0xFF) ? value : null);
+ break;
+ case 64:
+ value = buf.readUnsignedByte();
+ position.set("brakePosition", (value != 0xFF) ? value : null);
+ break;
+ case 65:
+ value = buf.readUnsignedByte();
+ position.set(Position.KEY_ENGINE_LOAD, (value != 0xFF) ? value : null);
+ break;
+ case 66:
+ value = buf.readUnsignedShortLE();
+ if (value != 0x7FFF) {
+ if (BitUtil.check(value, 7)) {
+ position.set("obdAdBlueLevel", BitUtil.to(value, 6));
+ } else {
+ position.set("obdAdBlue", BitUtil.to(value, 6) / 10);
+ }
+ }
+ break;
+ case 67:
+ position.set("obdHours", buf.readUnsignedIntLE() * 1000);
+ break;
+ case 68:
+ value = buf.readUnsignedShortLE();
+ position.set(
+ Position.KEY_ODOMETER_SERVICE,
+ (value != 0xFFFF) ? (value * 5000) : null);
+ break;
+ case 69:
+ value = buf.readUnsignedByte();
+ position.set(
+ Position.KEY_OBD_SPEED,
+ (value != 0xFF) ? UnitsConverter.knotsFromKph(value) : null);
break;
case 78:
case 79:
@@ -305,8 +387,37 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
case 83:
position.set("fuelTemp" + (j + 2 - 78), (int) buf.readByte());
break;
+ case 163:
+ case 164:
+ case 165:
+ case 166:
+ value = buf.readShortLE();
+ position.set(
+ Position.PREFIX_TEMP + (j + 2 + 8 - 163),
+ (value != (short) 0x8000) ? value * 0.05 : null);
+ break;
+ case 167:
+ case 168:
+ case 169:
+ case 170:
+ value = buf.readUnsignedByte();
+ position.set("humidity" + (j + 2 - 167), (value != 0xFF) ? value * 0.5 : null);
+ break;
+ case 206:
+ position.set("diagnostic", buf.readUnsignedIntLE());
+ break;
default:
- buf.skipBytes(getItemLength(j + 1));
+ if ((207 <= j) && (j <= 222)) {
+ position.set("user1Byte" + (j + 2 - 207), buf.readUnsignedByte());
+ } else if ((223 <= j) && (j <= 237)) {
+ position.set("user2Byte" + (j + 2 - 223), buf.readUnsignedShortLE());
+ } else if ((238 <= j) && (j <= 252)) {
+ position.set("user4Byte" + (j + 2 - 238), buf.readUnsignedIntLE());
+ } else if ((253 <= j) && (j <= 255)) {
+ position.set("user8Byte" + (j + 2 - 253), buf.readLongLE());
+ } else {
+ buf.skipBytes(getItemLength(j + 1));
+ }
break;
}
}