mirror of
https://github.com/traccar/traccar.git
synced 2026-05-19 14:18:23 -04:00
Use division for decimal scaling
This commit is contained in:
@@ -58,18 +58,18 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setValid(!BitUtil.check(status, 5));
|
||||
position.setLatitude(buf.readFloatLE());
|
||||
position.setLongitude(buf.readFloatLE());
|
||||
position.setCourse(buf.readUnsignedShortLE() * 0.1);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE() * 0.1));
|
||||
position.setCourse(buf.readUnsignedShortLE() / 10.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE() / 10.0));
|
||||
|
||||
position.set(Position.KEY_ACCELERATION, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_ACCELERATION, buf.readUnsignedByte() / 10.0);
|
||||
position.setAltitude(buf.readShortLE());
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedByte() / 10.0);
|
||||
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte() & 0x0f);
|
||||
|
||||
position.setTime(new Date(buf.readUnsignedIntLE() * 1000));
|
||||
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
|
||||
if (BitUtil.check(type, 2)) {
|
||||
buf.readUnsignedByte(); // vib
|
||||
@@ -85,7 +85,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (BitUtil.check(type, 3)) {
|
||||
for (int i = 1; i <= 6; i++) {
|
||||
position.set(Position.PREFIX_ADC + i, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.PREFIX_ADC + i, buf.readUnsignedShortLE() / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,11 +74,11 @@ public class AisProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("turn", buf.readSigned(8));
|
||||
}
|
||||
|
||||
position.setSpeed(buf.readUnsigned(10) * 0.1);
|
||||
position.setSpeed(buf.readUnsigned(10) / 10.0);
|
||||
position.setValid(buf.readUnsigned(1) != 0);
|
||||
position.setLongitude(buf.readSigned(28) * 0.0001 / 60.0);
|
||||
position.setLatitude(buf.readSigned(27) * 0.0001 / 60.0);
|
||||
position.setCourse(buf.readUnsigned(12) * 0.1);
|
||||
position.setLongitude(buf.readSigned(28) / 10000.0 / 60.0);
|
||||
position.setLatitude(buf.readSigned(27) / 10000.0 / 60.0);
|
||||
position.setCourse(buf.readUnsigned(12) / 10.0);
|
||||
|
||||
position.set("heading", buf.readUnsigned(9));
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class AnytrekProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setDeviceId(deviceSession.getDeviceId());
|
||||
|
||||
position.set(Position.KEY_VERSION_FW, buf.readUnsignedShortLE());
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 100.0);
|
||||
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
|
||||
|
||||
DateBuilder dateBuilder = new DateBuilder()
|
||||
|
||||
@@ -166,10 +166,10 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
|
||||
} else {
|
||||
int speed = buf.readShortLE();
|
||||
position.setValid(speed != -1);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(speed * 0.01));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(speed / 100.0));
|
||||
}
|
||||
|
||||
position.setCourse(buf.readShortLE() * 0.01);
|
||||
position.setCourse(buf.readShortLE() / 100.0);
|
||||
position.setAltitude(buf.readShortLE());
|
||||
|
||||
if (subtype == MSG_STATE_FULL_INFO_T104) {
|
||||
|
||||
@@ -125,35 +125,35 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
|
||||
switch (buf.readInt()) {
|
||||
case 0x20D -> {
|
||||
position.set(Position.KEY_RPM, value.readShortLE());
|
||||
position.set("dieselTemperature", value.readShortLE() * 0.1);
|
||||
position.set("batteryVoltage", value.readShortLE() * 0.01);
|
||||
position.set("supplyAirTempDep1", value.readShortLE() * 0.1);
|
||||
position.set("dieselTemperature", value.readShortLE() / 10.0);
|
||||
position.set("batteryVoltage", value.readShortLE() / 100.0);
|
||||
position.set("supplyAirTempDep1", value.readShortLE() / 10.0);
|
||||
}
|
||||
case 0x30D -> position.set("activeAlarm", ByteBufUtil.hexDump(value));
|
||||
case 0x40C -> {
|
||||
position.set("airTempDep1", value.readShortLE() * 0.1);
|
||||
position.set("airTempDep2", value.readShortLE() * 0.1);
|
||||
position.set("airTempDep1", value.readShortLE() / 10.0);
|
||||
position.set("airTempDep2", value.readShortLE() / 10.0);
|
||||
}
|
||||
case 0x40D -> position.set("coldUnitState", ByteBufUtil.hexDump(value));
|
||||
case 0x50C -> {
|
||||
position.set("defrostTempDep1", value.readShortLE() * 0.1);
|
||||
position.set("defrostTempDep2", value.readShortLE() * 0.1);
|
||||
position.set("defrostTempDep1", value.readShortLE() / 10.0);
|
||||
position.set("defrostTempDep2", value.readShortLE() / 10.0);
|
||||
}
|
||||
case 0x50D -> {
|
||||
position.set("condenserPressure", value.readShortLE() * 0.1);
|
||||
position.set("suctionPressure", value.readShortLE() * 0.1);
|
||||
position.set("condenserPressure", value.readShortLE() / 10.0);
|
||||
position.set("suctionPressure", value.readShortLE() / 10.0);
|
||||
}
|
||||
case 0x58C -> {
|
||||
value.readByte();
|
||||
value.readShort(); // index
|
||||
switch (value.readByte()) {
|
||||
case 0x01 -> position.set("setpointZone1", value.readIntLE() * 0.1);
|
||||
case 0x02 -> position.set("setpointZone2", value.readIntLE() * 0.1);
|
||||
case 0x01 -> position.set("setpointZone1", value.readIntLE() / 10.0);
|
||||
case 0x02 -> position.set("setpointZone2", value.readIntLE() / 10.0);
|
||||
case 0x05 -> position.set("unitType", value.readIntLE());
|
||||
case 0x13 -> position.set("dieselHours", value.readIntLE() / 60 / 60);
|
||||
case 0x14 -> position.set("electricHours", value.readIntLE() / 60 / 60);
|
||||
case 0x17 -> position.set("serviceIndicator", value.readIntLE());
|
||||
case 0x18 -> position.set("softwareVersion", value.readIntLE() * 0.01);
|
||||
case 0x18 -> position.set("softwareVersion", value.readIntLE() / 100.0);
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
@@ -203,8 +203,8 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
if ((selector & 0x8000) != 0) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
|
||||
// Pulse rate 1
|
||||
@@ -306,7 +306,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
if ((selector & 0x8000) != 0) {
|
||||
position.set("kFactor", buf.readUnsignedShort() * 0.001 + " pulses/m");
|
||||
position.set("kFactor", buf.readUnsignedShort() / 1000.0 + " pulses/m");
|
||||
}
|
||||
|
||||
if ((selector & 0x0200) != 0) {
|
||||
@@ -540,7 +540,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
if ((selector & 0x0800) != 0) {
|
||||
position.set(Position.KEY_HOURS, buf.readUnsignedInt() * 0.05);
|
||||
position.set(Position.KEY_HOURS, buf.readUnsignedInt() / 20.0);
|
||||
position.set(Position.KEY_RPM, buf.readUnsignedShort() * 0.125);
|
||||
position.set(Position.KEY_OBD_SPEED, buf.readUnsignedShort() / 256.0);
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() * 0.5);
|
||||
@@ -551,7 +551,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("ambientTemperature", buf.readUnsignedShort() * 0.03125 - 273);
|
||||
buf.readUnsignedShort(); // fuel rate
|
||||
position.set("fuelEconomy", buf.readUnsignedShort() / 512.0);
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt() * 0.001);
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt() / 1000.0);
|
||||
buf.readUnsignedByte(); // pto drive engagement
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_ODOMETER, parser.nextHexInt());
|
||||
|
||||
if (parser.hasNext()) {
|
||||
position.set(Position.KEY_HDOP, parser.nextInt() * 0.1);
|
||||
position.set(Position.KEY_HDOP, parser.nextInt() / 10.0);
|
||||
}
|
||||
if (parser.hasNext()) {
|
||||
position.set("alarms", parser.next());
|
||||
@@ -127,10 +127,10 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_G_SENSOR, parser.next());
|
||||
}
|
||||
if (parser.hasNext()) {
|
||||
position.set(Position.KEY_POWER, parser.nextHexInt() * 0.01);
|
||||
position.set(Position.KEY_POWER, parser.nextHexInt() / 100.0);
|
||||
}
|
||||
if (parser.hasNext()) {
|
||||
position.set(Position.KEY_BATTERY, parser.nextHexInt() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextHexInt() / 100.0);
|
||||
}
|
||||
if (parser.hasNext()) {
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
|
||||
|
||||
@@ -82,8 +82,8 @@ public class ArnaviTextProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setDeviceId(deviceSession.getDeviceId());
|
||||
|
||||
position.set(Position.KEY_INDEX, parser.nextInt());
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 100.0);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 100.0);
|
||||
position.set(Position.KEY_IGNITION, parser.nextInt() == 1);
|
||||
position.set(Position.KEY_INPUT, parser.nextInt());
|
||||
position.set(Position.KEY_SATELLITES, parser.nextInt());
|
||||
|
||||
@@ -94,8 +94,8 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedByte(); // index
|
||||
|
||||
position.setValid(true);
|
||||
position.setLatitude(buf.readInt() * 0.000001);
|
||||
position.setLongitude(buf.readInt() * 0.000001);
|
||||
position.setLatitude(buf.readInt() / 1000000.0);
|
||||
position.setLongitude(buf.readInt() / 1000000.0);
|
||||
position.setTime(readTime(buf));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte() * 2));
|
||||
position.setCourse(buf.readUnsignedByte() * 2);
|
||||
@@ -164,15 +164,15 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_STATUS, buf.readUnsignedShort());
|
||||
|
||||
if ((mask & 1L) > 0) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedByte() * 0.2);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedByte() / 5.0);
|
||||
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
|
||||
}
|
||||
|
||||
if ((mask & 2L) > 0) {
|
||||
position.setValid(true);
|
||||
position.setFixTime(readTime(buf));
|
||||
position.setLatitude(buf.readInt() * 0.000001);
|
||||
position.setLongitude(buf.readInt() * 0.000001);
|
||||
position.setLatitude(buf.readInt() / 1000000.0);
|
||||
position.setLongitude(buf.readInt() / 1000000.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte() * 2));
|
||||
buf.readUnsignedByte(); // max speed since last report
|
||||
position.setCourse(buf.readUnsignedByte() * 2);
|
||||
@@ -268,7 +268,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("obdStatus", buf.readUnsignedShort());
|
||||
position.set("obdEvents", buf.readUnsignedShort());
|
||||
position.set(Position.KEY_FUEL, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedShort() * 0.1);
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedShort() / 10.0);
|
||||
}
|
||||
|
||||
if ((mask & 16384L) > 0) {
|
||||
@@ -281,7 +281,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium() * 1000);
|
||||
position.set(Position.KEY_HOURS, buf.readUnsignedShort() * 3_600_000);
|
||||
position.set("axleWeight", buf.readUnsignedShort());
|
||||
position.set("tripFuelUsed", buf.readUnsignedShort() * 0.1);
|
||||
position.set("tripFuelUsed", buf.readUnsignedShort() / 10.0);
|
||||
position.set("tripCruise", buf.readUnsignedShort());
|
||||
position.set(Position.KEY_ODOMETER_SERVICE, buf.readUnsignedShort() * 5);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if ((mask & 131072L) > 0) {
|
||||
for (int j = 1; j <= 6; j++) {
|
||||
position.set(Position.PREFIX_TEMP + j, buf.readShort() * 0.1);
|
||||
position.set(Position.PREFIX_TEMP + j, buf.readShort() / 10.0);
|
||||
}
|
||||
for (int j = 1; j <= 3; j++) {
|
||||
position.set("setpoint" + j, buf.readByte() * 0.5);
|
||||
@@ -309,7 +309,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if ((mask & 262144L) > 0) {
|
||||
for (int j = 1; j <= 4; j++) {
|
||||
position.set(Position.PREFIX_TEMP + j, (buf.readUnsignedShort() - 550) * 0.1);
|
||||
position.set(Position.PREFIX_TEMP + j, (buf.readUnsignedShort() - 550) / 10.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ public class At2000ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShortLE());
|
||||
position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShortLE());
|
||||
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 1000.0);
|
||||
|
||||
buf.readUnsignedShortLE(); // cid
|
||||
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
|
||||
|
||||
@@ -205,8 +205,8 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
for (int i = 0; i < Math.min(keys.length, values.length); i++) {
|
||||
switch (keys[i]) {
|
||||
case "SA" -> position.set(Position.KEY_SATELLITES, Integer.parseInt(values[i]));
|
||||
case "MV" -> position.set(Position.KEY_POWER, Integer.parseInt(values[i]) * 0.1);
|
||||
case "BV" -> position.set(Position.KEY_BATTERY, Integer.parseInt(values[i]) * 0.1);
|
||||
case "MV" -> position.set(Position.KEY_POWER, Integer.parseInt(values[i]) / 10.0);
|
||||
case "BV" -> position.set(Position.KEY_BATTERY, Integer.parseInt(values[i]) / 10.0);
|
||||
case "GQ" -> cellTower.setSignalStrength(Integer.parseInt(values[i]));
|
||||
case "CE" -> cellTower.setCellId(Long.parseLong(values[i]));
|
||||
case "LC" -> cellTower.setLocationAreaCode(Integer.parseInt(values[i]));
|
||||
@@ -228,8 +228,8 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
case "FC" -> position.set(Position.KEY_FUEL_CONSUMPTION, Integer.parseInt(values[i]));
|
||||
case "AV1" -> position.set(Position.PREFIX_ADC + 1, Integer.parseInt(values[i]));
|
||||
case "CD" -> position.set(Position.KEY_ICCID, values[i]);
|
||||
case "EH" ->
|
||||
position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(Integer.parseInt(values[i]) * 0.1));
|
||||
case "EH" -> position.set(
|
||||
Position.KEY_HOURS, UnitsConverter.msFromHours(Integer.parseInt(values[i]) / 10.0));
|
||||
case "IA" -> position.set("intakeTemp", Integer.parseInt(values[i]));
|
||||
case "EL" -> position.set(Position.KEY_ENGINE_LOAD, Integer.parseInt(values[i]));
|
||||
case "HA" -> {
|
||||
@@ -293,8 +293,8 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
switch (key) {
|
||||
case "SA" -> position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
|
||||
case "MT" -> position.set(Position.KEY_MOTION, buf.readUnsignedByte() > 0);
|
||||
case "MV" -> position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1);
|
||||
case "BV" -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.1);
|
||||
case "MV" -> position.set(Position.KEY_POWER, buf.readUnsignedShort() / 10.0);
|
||||
case "BV" -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 10.0);
|
||||
case "GQ" -> cellTower.setSignalStrength((int) buf.readUnsignedByte());
|
||||
case "CE" -> cellTower.setCellId(buf.readUnsignedInt());
|
||||
case "LC" -> cellTower.setLocationAreaCode(buf.readUnsignedShort());
|
||||
@@ -379,12 +379,12 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
case "JH8" -> position.set(Position.KEY_ODOMETER_SERVICE, buf.readUnsignedShort() * 5);
|
||||
case "JH9" -> buf.readUnsignedShort(); // tachograph speed
|
||||
case "JH10" -> buf.readUnsignedShort(); // ambient air temperature
|
||||
case "JH11" -> position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() * 0.05);
|
||||
case "JH11" -> position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() / 20.0);
|
||||
case "JH12" -> buf.readUnsignedShort(); // fuel economy
|
||||
case "JL1" -> position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() * 0.5);
|
||||
case "JL2" -> position.set(Position.KEY_HOURS, buf.readUnsignedInt() * 5 * 36000);
|
||||
case "JL3" -> position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000);
|
||||
case "JL4" -> position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() * 0.001);
|
||||
case "JL4" -> position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() / 1000.0);
|
||||
case "JS1" -> position.set(Position.KEY_VIN, readString(buf));
|
||||
case "JS2" -> readString(buf); // fms version supported
|
||||
case "JS3" -> position.set("driver1", readString(buf));
|
||||
@@ -457,8 +457,8 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.set("model", parser.next());
|
||||
position.set(Position.KEY_VERSION_FW, parser.next());
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.1);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.1);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 10.0);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 10.0);
|
||||
position.set(Position.KEY_SATELLITES, parser.nextInt());
|
||||
position.set(Position.KEY_RSSI, parser.nextInt());
|
||||
|
||||
@@ -554,13 +554,13 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setTime(new Date(Long.parseLong(time) * 1000));
|
||||
}
|
||||
|
||||
position.setLongitude(parser.nextInt() * 0.000001);
|
||||
position.setLatitude(parser.nextInt() * 0.000001);
|
||||
position.setLongitude(parser.nextInt() / 1000000.0);
|
||||
position.setLatitude(parser.nextInt() / 1000000.0);
|
||||
position.setCourse(parser.nextInt());
|
||||
|
||||
position.set(Position.KEY_EVENT, parser.nextInt());
|
||||
position.set(Position.KEY_ODOMETER, parser.nextDouble() * 100);
|
||||
position.set(Position.KEY_HDOP, parser.nextInt() * 0.1);
|
||||
position.set(Position.KEY_HDOP, parser.nextInt() / 10.0);
|
||||
position.set(Position.KEY_INPUT, parser.nextInt());
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt()));
|
||||
@@ -640,8 +640,8 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
position.setValid(true);
|
||||
position.setLongitude(buf.readInt() * 0.000001);
|
||||
position.setLatitude(buf.readInt() * 0.000001);
|
||||
position.setLongitude(buf.readInt() / 1000000.0);
|
||||
position.setLatitude(buf.readInt() / 1000000.0);
|
||||
position.setCourse(buf.readUnsignedShort());
|
||||
|
||||
int type = buf.readUnsignedByte();
|
||||
@@ -649,25 +649,25 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.addAlarm(alarmMap.get(type));
|
||||
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 100);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedShort() * 0.1);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedShort() / 10.0);
|
||||
position.set(Position.KEY_INPUT, buf.readUnsignedByte());
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
|
||||
|
||||
position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
|
||||
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort() / 1000.0);
|
||||
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, readString(buf));
|
||||
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readShort() * 0.1);
|
||||
position.set(Position.PREFIX_TEMP + 2, buf.readShort() * 0.1);
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readShort() / 10.0);
|
||||
position.set(Position.PREFIX_TEMP + 2, buf.readShort() / 10.0);
|
||||
|
||||
String message = readString(buf);
|
||||
if (message != null && !message.isEmpty()) {
|
||||
Matcher matcher = PATTERN_FULS.matcher(message);
|
||||
if (matcher.find()) {
|
||||
int value = Integer.parseInt(matcher.group(3), decimalFuel ? 10 : 16);
|
||||
position.set(Position.KEY_FUEL, value * 0.1);
|
||||
position.set(Position.KEY_FUEL, value / 10.0);
|
||||
} else {
|
||||
position.set("message", message);
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ public class AutoTrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setDeviceId(deviceSession.getDeviceId());
|
||||
|
||||
position.setTime(new Date(1009843200000L + buf.readUnsignedIntLE() * 1000)); // seconds since 2002
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedIntLE());
|
||||
|
||||
@@ -122,7 +122,7 @@ public class B2316ProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (item.containsKey("te")) {
|
||||
String[] temperatures = item.getString("te").split(",");
|
||||
for (int j = 0; j < temperatures.length; j++) {
|
||||
position.set(Position.PREFIX_TEMP + (j + 1), Integer.parseInt(temperatures[j]) * 0.1);
|
||||
position.set(Position.PREFIX_TEMP + (j + 1), Integer.parseInt(temperatures[j]) / 10.0);
|
||||
}
|
||||
}
|
||||
if (item.containsKey("st")) {
|
||||
|
||||
@@ -174,7 +174,7 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(buf.readLongLE()));
|
||||
}
|
||||
if (BitUtil.check(mask, 7)) {
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShortLE() * 0.1 - 273);
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShortLE() / 10.0 - 273);
|
||||
}
|
||||
if (BitUtil.check(mask, 8)) {
|
||||
buf.readUnsignedShortLE(); // dallas humidity
|
||||
@@ -226,9 +226,9 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedShortLE();
|
||||
}
|
||||
if (BitUtil.check(mask, 6)) {
|
||||
position.set("maxAcceleration", buf.readUnsignedByte() * 0.02);
|
||||
position.set("maxBraking", buf.readUnsignedByte() * 0.02);
|
||||
position.set("maxCornering", buf.readUnsignedByte() * 0.02);
|
||||
position.set("maxAcceleration", buf.readUnsignedByte() / 50.0);
|
||||
position.set("maxBraking", buf.readUnsignedByte() / 50.0);
|
||||
position.set("maxCornering", buf.readUnsignedByte() / 50.0);
|
||||
}
|
||||
if (BitUtil.check(mask, 7)) {
|
||||
buf.skipBytes(16);
|
||||
@@ -237,7 +237,7 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
int temperature = buf.readUnsignedShortLE();
|
||||
if (temperature > 0) {
|
||||
position.set(Position.PREFIX_TEMP + i, temperature * 0.1 - 273);
|
||||
position.set(Position.PREFIX_TEMP + i, temperature / 10.0 - 273);
|
||||
}
|
||||
buf.skipBytes(8);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class BlackKiteProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
case TAG_SPEED_COURSE:
|
||||
position.setSpeed(buf.readUnsignedShortLE() * 0.0539957);
|
||||
position.setCourse(buf.readUnsignedShortLE() * 0.1);
|
||||
position.setCourse(buf.readUnsignedShortLE() / 10.0);
|
||||
break;
|
||||
|
||||
case TAG_ALTITUDE:
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BlueProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
int value = buf.readUnsignedShort();
|
||||
int degrees = value / 100;
|
||||
double minutes = value % 100 + buf.readUnsignedShort() * 0.0001;
|
||||
double minutes = value % 100 + buf.readUnsignedShort() / 10000.0;
|
||||
double coordinate = degrees + minutes / 60;
|
||||
return negative ? -coordinate : coordinate;
|
||||
}
|
||||
@@ -112,8 +112,8 @@ public class BlueProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setValid(BitUtil.check(flags, 7));
|
||||
position.setLatitude(readCoordinate(buf, BitUtil.check(flags, 6)));
|
||||
position.setLongitude(readCoordinate(buf, BitUtil.check(flags, 5)));
|
||||
position.setSpeed(buf.readUnsignedShort() + buf.readUnsignedShort() * 0.001);
|
||||
position.setCourse(buf.readUnsignedShort() + buf.readUnsignedByte() * 0.01);
|
||||
position.setSpeed(buf.readUnsignedShort() + buf.readUnsignedShort() / 1000.0);
|
||||
position.setCourse(buf.readUnsignedShort() + buf.readUnsignedByte() / 100.0);
|
||||
|
||||
DateBuilder dateBuilder = new DateBuilder()
|
||||
.setDate(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte())
|
||||
|
||||
@@ -102,7 +102,7 @@ public class C2stekProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setCourse(parser.nextDouble());
|
||||
position.setAltitude(parser.nextDouble());
|
||||
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 1000.0);
|
||||
position.addAlarm(decodeAlarm(parser.nextHexInt()));
|
||||
|
||||
if (parser.hasNext()) {
|
||||
|
||||
@@ -77,10 +77,10 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (type != MSG_MINI_EVENT_REPORT) {
|
||||
buf.readUnsignedInt(); // fix time
|
||||
}
|
||||
position.setLatitude(buf.readInt() * 0.0000001);
|
||||
position.setLongitude(buf.readInt() * 0.0000001);
|
||||
position.setLatitude(buf.readInt() / 10000000.0);
|
||||
position.setLongitude(buf.readInt() / 10000000.0);
|
||||
if (type != MSG_MINI_EVENT_REPORT) {
|
||||
position.setAltitude(buf.readInt() * 0.01);
|
||||
position.setAltitude(buf.readInt() / 100.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromCps(buf.readUnsignedInt()));
|
||||
}
|
||||
position.setCourse(buf.readShort());
|
||||
|
||||
@@ -113,7 +113,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
|
||||
double lat = buf.readUnsignedIntLE() / 3600000.0;
|
||||
double lon = buf.readUnsignedIntLE() / 3600000.0;
|
||||
position.setSpeed(UnitsConverter.knotsFromCps(buf.readUnsignedShortLE()));
|
||||
position.setCourse(buf.readUnsignedShortLE() * 0.1);
|
||||
position.setCourse(buf.readUnsignedShortLE() / 10.0);
|
||||
|
||||
int flags = buf.readUnsignedByte();
|
||||
if ((flags & 0x02) == 0) {
|
||||
|
||||
@@ -161,13 +161,13 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setLatitude(buf.readIntLE() / Math.PI * 180 / 100000000);
|
||||
}
|
||||
|
||||
position.setAltitude(buf.readIntLE() * 0.01);
|
||||
position.setAltitude(buf.readIntLE() / 100.0);
|
||||
|
||||
if (alternative) {
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedIntLE()));
|
||||
position.setCourse(buf.readUnsignedShortLE() / 1000.0);
|
||||
} else {
|
||||
position.setSpeed(UnitsConverter.knotsFromMps(buf.readUnsignedIntLE() * 0.01));
|
||||
position.setSpeed(UnitsConverter.knotsFromMps(buf.readUnsignedIntLE() / 100.0));
|
||||
position.setCourse(buf.readUnsignedShortLE() / Math.PI * 180.0 / 1000.0);
|
||||
}
|
||||
|
||||
@@ -212,8 +212,8 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedByte(); // satellites
|
||||
position.setLongitude(buf.readIntLE() / Math.PI * 180 / 100000000);
|
||||
position.setLatitude(buf.readIntLE() / Math.PI * 180 / 100000000);
|
||||
position.setAltitude(buf.readIntLE() * 0.01);
|
||||
position.setSpeed(UnitsConverter.knotsFromMps(buf.readUnsignedByte() * 0.01));
|
||||
position.setAltitude(buf.readIntLE() / 100.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromMps(buf.readUnsignedByte() / 100.0));
|
||||
position.setCourse(buf.readUnsignedShortLE() / Math.PI * 180.0 / 1000.0);
|
||||
break;
|
||||
case 7:
|
||||
|
||||
@@ -70,7 +70,7 @@ public class DingtekProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_STATUS, buf.readUnsignedInt());
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
position.set(Position.KEY_RSSI, buf.readFloat());
|
||||
position.set(Position.KEY_INDEX, buf.readUnsignedShort());
|
||||
|
||||
|
||||
@@ -116,19 +116,19 @@ public class DmtHttpProtocolDecoder extends BaseHttpProtocolDecoder {
|
||||
case 6:
|
||||
JsonObject adc = field.getJsonObject("AnalogueData");
|
||||
if (adc.containsKey("1")) {
|
||||
position.set(Position.KEY_BATTERY, adc.getInt("1") * 0.001);
|
||||
position.set(Position.KEY_BATTERY, adc.getInt("1") / 1000.0);
|
||||
}
|
||||
if (adc.containsKey("2")) {
|
||||
position.set(Position.KEY_POWER, adc.getInt("2") * 0.01);
|
||||
position.set(Position.KEY_POWER, adc.getInt("2") / 100.0);
|
||||
}
|
||||
if (adc.containsKey("3")) {
|
||||
position.set(Position.KEY_DEVICE_TEMP, adc.getInt("3") * 0.01);
|
||||
position.set(Position.KEY_DEVICE_TEMP, adc.getInt("3") / 100.0);
|
||||
}
|
||||
if (adc.containsKey("4")) {
|
||||
position.set(Position.KEY_RSSI, adc.getInt("4"));
|
||||
}
|
||||
if (adc.containsKey("5")) {
|
||||
position.set("solarPower", adc.getInt("5") * 0.001);
|
||||
position.set("solarPower", adc.getInt("5") / 1000.0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -193,8 +193,8 @@ public class DmtHttpProtocolDecoder extends BaseHttpProtocolDecoder {
|
||||
JsonArray counters = root.getJsonArray("counters");
|
||||
for (JsonObject counter : counters.getValuesAs(JsonObject.class)) {
|
||||
switch (counter.getInt("id")) {
|
||||
case 0 -> position.set(Position.KEY_BATTERY, counter.getInt("val") * 0.001);
|
||||
case 1 -> position.set(Position.KEY_BATTERY_LEVEL, counter.getInt("val") * 0.01);
|
||||
case 0 -> position.set(Position.KEY_BATTERY, counter.getInt("val") / 1000.0);
|
||||
case 1 -> position.set(Position.KEY_BATTERY_LEVEL, counter.getInt("val") / 100.0);
|
||||
default -> position.set("counter" + counter.getInt("id"), counter.getInt("val"));
|
||||
}
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
|
||||
.setSecond((int) (time >> 26) & 0x3F)
|
||||
.getDate());
|
||||
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromCps(buf.readUnsignedShortLE()));
|
||||
position.setCourse(buf.readUnsignedByte() * 2);
|
||||
position.setAltitude(buf.readShortLE());
|
||||
@@ -121,7 +121,7 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
buf.skipBytes(8); // device id
|
||||
|
||||
position.set(Position.KEY_PDOP, buf.readUnsignedShortLE() * 0.01);
|
||||
position.set(Position.KEY_PDOP, buf.readUnsignedShortLE() / 100.0);
|
||||
|
||||
buf.skipBytes(2); // reserved
|
||||
|
||||
@@ -165,8 +165,8 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (fieldId == 0) {
|
||||
|
||||
position.setFixTime(new Date(1356998400000L + buf.readUnsignedIntLE() * 1000));
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setAltitude(buf.readShortLE());
|
||||
position.setSpeed(UnitsConverter.knotsFromCps(buf.readUnsignedShortLE()));
|
||||
|
||||
@@ -174,7 +174,7 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setCourse(buf.readUnsignedByte() * 2);
|
||||
|
||||
position.set(Position.KEY_PDOP, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_PDOP, buf.readUnsignedByte() / 10.0);
|
||||
|
||||
position.setAccuracy(buf.readUnsignedByte());
|
||||
position.setValid(buf.readUnsignedByte() != 0);
|
||||
@@ -216,11 +216,11 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
|
||||
while (buf.readerIndex() < fieldEnd) {
|
||||
int number = buf.readUnsignedByte();
|
||||
switch (number) {
|
||||
case 1 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
|
||||
case 2 -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.01);
|
||||
case 3 -> position.set(Position.KEY_DEVICE_TEMP, buf.readShortLE() * 0.01);
|
||||
case 1 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
case 2 -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 100.0);
|
||||
case 3 -> position.set(Position.KEY_DEVICE_TEMP, buf.readShortLE() / 100.0);
|
||||
case 4 -> position.set(Position.KEY_RSSI, buf.readUnsignedShortLE());
|
||||
case 5 -> position.set("solarPower", buf.readUnsignedShortLE() * 0.001);
|
||||
case 5 -> position.set("solarPower", buf.readUnsignedShortLE() / 1000.0);
|
||||
default -> position.set(Position.PREFIX_IO + number, buf.readUnsignedShortLE());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Dsf22ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setTime(new Date(buf.readUnsignedIntLE() * 1000));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
|
||||
|
||||
position.set(Position.KEY_FUEL, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_FUEL, buf.readUnsignedShortLE() / 1000.0);
|
||||
|
||||
int status = buf.readUnsignedByte();
|
||||
position.set(Position.KEY_IGNITION, BitUtil.check(status, 0));
|
||||
|
||||
@@ -92,9 +92,9 @@ public class DwayProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_INPUT, parser.nextBinInt());
|
||||
position.set(Position.KEY_OUTPUT, parser.nextBinInt());
|
||||
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextInt() * 0.001);
|
||||
position.set(Position.PREFIX_ADC + 2, parser.nextInt() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 1000.0);
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextInt() / 1000.0);
|
||||
position.set(Position.PREFIX_ADC + 2, parser.nextInt() / 1000.0);
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
|
||||
|
||||
return position;
|
||||
|
||||
@@ -214,7 +214,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextHexInt() / 100.0));
|
||||
double course = parser.nextHexInt() * 0.01;
|
||||
double course = parser.nextHexInt() / 100.0;
|
||||
if (course < 360) {
|
||||
position.setCourse(course);
|
||||
}
|
||||
@@ -245,7 +245,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
|
||||
}
|
||||
|
||||
position.set(Position.PREFIX_TEMP + 1, parser.nextHexInt() * 0.01);
|
||||
position.set(Position.PREFIX_TEMP + 1, parser.nextHexInt() / 100.0);
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextDouble());
|
||||
position.set(Position.KEY_SATELLITES, parser.nextInt());
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (buf.readableBytes() >= 2 * 4) {
|
||||
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
|
||||
position.set(Position.KEY_RSSI, buf.readUnsignedShort());
|
||||
|
||||
@@ -277,7 +277,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (type == MSG_NORMAL) {
|
||||
|
||||
if (buf.readableBytes() >= 2) {
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
|
||||
if (buf.readableBytes() >= 4) {
|
||||
@@ -301,7 +301,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (buf.readableBytes() >= 12) {
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readShort() / 256.0);
|
||||
position.set(Position.KEY_HUMIDITY, buf.readUnsignedShort() * 0.1);
|
||||
position.set(Position.KEY_HUMIDITY, buf.readUnsignedShort() / 10.0);
|
||||
position.set("illuminance", buf.readUnsignedInt() / 256.0);
|
||||
position.set("co2", buf.readUnsignedInt());
|
||||
}
|
||||
@@ -319,7 +319,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedByte(); // reserved
|
||||
buf.readUnsignedByte(); // model
|
||||
buf.readUnsignedByte(); // version
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedShort() * 0.001);
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedShort() / 1000.0);
|
||||
position.set("tag" + i + "Temp", buf.readShort() / 256.0);
|
||||
position.set("tag" + i + "Data", buf.readUnsignedShort());
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
int speed = buf.readUnsignedShortLE();
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BitUtil.to(speed, 14) * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BitUtil.to(speed, 14) / 10.0));
|
||||
position.setCourse(buf.readUnsignedByte() + (BitUtil.check(speed, 15) ? 0x100 : 0));
|
||||
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedMediumLE() * 100);
|
||||
|
||||
@@ -89,8 +89,8 @@ public class EnvotechProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setDeviceTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
|
||||
|
||||
position.set(Position.KEY_RSSI, parser.nextInt());
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 100.0);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 100.0);
|
||||
position.set(Position.KEY_INPUT, parser.nextHexInt());
|
||||
position.set(Position.PREFIX_OUT, parser.nextHexInt());
|
||||
position.set(Position.KEY_FUEL, parser.nextHexInt());
|
||||
|
||||
@@ -95,7 +95,7 @@ public class EskyProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextInt());
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 100.0);
|
||||
|
||||
int index = sentence.lastIndexOf('+');
|
||||
if (index > 0 && channel instanceof DatagramChannel) {
|
||||
|
||||
@@ -127,7 +127,7 @@ public class FleetGuideProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setLatitude(data.readUnsignedIntLE() * 90.0 / 0xFFFFFFFFL);
|
||||
position.setLongitude(data.readUnsignedIntLE() * 180.0 / 0xFFFFFFFFL);
|
||||
int speed = data.readUnsignedShortLE();
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BitUtil.to(speed, 14) * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BitUtil.to(speed, 14) / 10.0));
|
||||
if (BitUtil.check(speed, 14)) {
|
||||
position.setLatitude(-position.getLatitude());
|
||||
}
|
||||
@@ -151,9 +151,9 @@ public class FleetGuideProtocolDecoder extends BaseProtocolDecoder {
|
||||
int powerLow = data.readUnsignedByte();
|
||||
int powerFlags = data.readUnsignedByte();
|
||||
int batteryHigh = data.readUnsignedByte();
|
||||
position.set(Position.KEY_POWER, (powerLow + (BitUtil.to(powerFlags, 5) << 8)) * 0.01);
|
||||
position.set(Position.KEY_POWER, (powerLow + (BitUtil.to(powerFlags, 5) << 8)) / 100.0);
|
||||
position.set(Position.KEY_IGNITION, BitUtil.check(powerFlags, 5));
|
||||
position.set(Position.KEY_BATTERY, (BitUtil.from(powerFlags, 6) + (batteryHigh << 2)) * 0.01);
|
||||
position.set(Position.KEY_BATTERY, (BitUtil.from(powerFlags, 6) + (batteryHigh << 2)) / 100.0);
|
||||
if (recordLength >= 4) {
|
||||
int extraFlags = data.readUnsignedByte();
|
||||
if (BitUtil.check(extraFlags, 0)) {
|
||||
@@ -198,7 +198,7 @@ public class FleetGuideProtocolDecoder extends BaseProtocolDecoder {
|
||||
int tempMask = data.readUnsignedByte();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (BitUtil.check(tempMask, i)) {
|
||||
position.set(Position.PREFIX_TEMP + (i + 1), data.readShortLE() * 0.01);
|
||||
position.set(Position.PREFIX_TEMP + (i + 1), data.readShortLE() / 100.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -116,7 +116,7 @@ public class FlexCommProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_FUEL, parser.nextInt());
|
||||
position.set(Position.PREFIX_TEMP + 1, parseSignedValue(parser, 0));
|
||||
position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt());
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.1);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 10.0);
|
||||
|
||||
if (channel != null) {
|
||||
channel.writeAndFlush(new NetworkMessage("{01}", remoteAddress));
|
||||
|
||||
@@ -124,16 +124,16 @@ public class FlexibleReportProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedShort(); // gps accuracy
|
||||
}
|
||||
if (BitUtil.check(mask, 6)) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
if (BitUtil.check(mask, 7)) {
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
if (BitUtil.check(mask, 8)) {
|
||||
position.set("auxPower", buf.readUnsignedShort() * 0.001);
|
||||
position.set("auxPower", buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
if (BitUtil.check(mask, 9)) {
|
||||
position.set("solarPower", buf.readUnsignedShort() * 0.001);
|
||||
position.set("solarPower", buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
if (BitUtil.check(mask, 10)) {
|
||||
int cellService = buf.readUnsignedByte();
|
||||
@@ -156,7 +156,7 @@ public class FlexibleReportProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000);
|
||||
}
|
||||
if (BitUtil.check(mask, 15)) {
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort() / 100.0);
|
||||
}
|
||||
|
||||
return position;
|
||||
|
||||
@@ -128,7 +128,7 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setAltitude(parser.nextInt(0));
|
||||
|
||||
position.set(Position.KEY_HDOP, parser.nextInt(0) * 0.1);
|
||||
position.set(Position.KEY_HDOP, parser.nextInt(0) / 10.0);
|
||||
|
||||
position.setNetwork(new Network(CellTower.from(
|
||||
mcc, mnc, parser.nextHexInt(0), parser.nextHexInt(0), rssi)));
|
||||
|
||||
@@ -103,7 +103,7 @@ public class FoxProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setCourse(parser.nextDouble(0));
|
||||
|
||||
position.set(Position.KEY_INPUT, parser.nextBinInt(0));
|
||||
position.set(Position.KEY_POWER, parser.nextDouble(0) * 0.1);
|
||||
position.set(Position.KEY_POWER, parser.nextDouble(0) / 10.0);
|
||||
position.set(Position.PREFIX_TEMP + 1, parser.nextInt(0));
|
||||
position.set(Position.KEY_RPM, parser.nextInt(0));
|
||||
position.set(Position.KEY_FUEL, parser.nextInt(0));
|
||||
|
||||
@@ -127,9 +127,9 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 0xF -> position.set(Position.KEY_SATELLITES, Integer.parseInt(value));
|
||||
case 0x12 -> position.set(Position.KEY_HDOP, Integer.parseInt(value));
|
||||
case 0x20 -> position.set(Position.KEY_ACCELERATION, value);
|
||||
case 0x24 -> position.set(Position.KEY_BATTERY, Integer.parseInt(value) * 0.01);
|
||||
case 0x24 -> position.set(Position.KEY_BATTERY, Integer.parseInt(value) / 100.0);
|
||||
case 0x81 -> position.set(Position.KEY_RSSI, Integer.parseInt(value));
|
||||
case 0x82 -> position.set(Position.KEY_DEVICE_TEMP, Double.parseDouble(value) * 0.1);
|
||||
case 0x82 -> position.set(Position.KEY_DEVICE_TEMP, Double.parseDouble(value) / 10.0);
|
||||
case 0x104 -> position.set(Position.KEY_ENGINE_LOAD, Integer.parseInt(value));
|
||||
case 0x105 -> position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(value));
|
||||
case 0x10c -> position.set(Position.KEY_RPM, Integer.parseInt(value));
|
||||
|
||||
@@ -145,11 +145,11 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 0x10 -> position.set(Position.KEY_INDEX, buf.readUnsignedShortLE());
|
||||
case 0x20 -> position.setTime(new Date(buf.readUnsignedIntLE() * 1000));
|
||||
case 0x33 -> {
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE() * 0.1));
|
||||
position.setCourse(buf.readUnsignedShortLE() * 0.1);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE() / 10.0));
|
||||
position.setCourse(buf.readUnsignedShortLE() / 10.0);
|
||||
}
|
||||
case 0x34 -> position.setAltitude(buf.readShortLE());
|
||||
case 0x35 -> position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
|
||||
case 0x35 -> position.set(Position.KEY_HDOP, buf.readUnsignedByte() / 10.0);
|
||||
case 0x40 -> position.set(Position.KEY_STATUS, buf.readUnsignedShortLE());
|
||||
case 0x41 -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 1000.0);
|
||||
case 0x42 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
|
||||
@@ -148,8 +148,8 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_STATUS, buf.readUnsignedByte());
|
||||
position.set("key", buf.readUnsignedByte());
|
||||
|
||||
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01);
|
||||
position.set(Position.PREFIX_ADC + 2, buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01);
|
||||
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0);
|
||||
position.set(Position.PREFIX_ADC + 2, buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0);
|
||||
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
|
||||
|
||||
|
||||
@@ -141,10 +141,10 @@ public class Gl200BinaryProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setValid(true);
|
||||
position.setTime(new Date(time * 1000));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(speed * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(speed / 10.0));
|
||||
position.setCourse(heading);
|
||||
position.setLongitude(longitude * 0.000001);
|
||||
position.setLatitude(latitude * 0.000001);
|
||||
position.setLongitude(longitude / 1000000.0);
|
||||
position.setLatitude(latitude / 1000000.0);
|
||||
|
||||
positions.add(position);
|
||||
|
||||
@@ -167,11 +167,11 @@ public class Gl200BinaryProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setValid(hdop > 0);
|
||||
position.set(Position.KEY_HDOP, hdop);
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedMedium() * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedMedium() / 10.0));
|
||||
position.setCourse(buf.readUnsignedShort());
|
||||
position.setAltitude(buf.readShort());
|
||||
position.setLongitude(buf.readInt() * 0.000001);
|
||||
position.setLatitude(buf.readInt() * 0.000001);
|
||||
position.setLongitude(buf.readInt() / 1000000.0);
|
||||
position.setLatitude(buf.readInt() / 1000000.0);
|
||||
|
||||
position.setTime(decodeTime(buf));
|
||||
|
||||
@@ -271,11 +271,11 @@ public class Gl200BinaryProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setValid(hdop > 0);
|
||||
position.set(Position.KEY_HDOP, hdop);
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedMedium() * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedMedium() / 10.0));
|
||||
position.setCourse(buf.readUnsignedShort());
|
||||
position.setAltitude(buf.readShort());
|
||||
position.setLongitude(buf.readInt() * 0.000001);
|
||||
position.setLatitude(buf.readInt() * 0.000001);
|
||||
position.setLongitude(buf.readInt() / 1000000.0);
|
||||
position.setLatitude(buf.readInt() / 1000000.0);
|
||||
|
||||
position.setTime(decodeTime(buf));
|
||||
|
||||
@@ -339,8 +339,8 @@ public class Gl200BinaryProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (type == MSG_INF_BAT) {
|
||||
position.set(Position.KEY_CHARGE, buf.readUnsignedByte() != 0);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (adcString.startsWith("F")) {
|
||||
position.set("fuel" + index, Integer.parseInt(adcString.substring(1)));
|
||||
} else {
|
||||
position.set(Position.PREFIX_ADC + index, Integer.parseInt(adcString) * 0.001);
|
||||
position.set(Position.PREFIX_ADC + index, Integer.parseInt(adcString) / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
|
||||
index += 1; // tachograph direction
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 7) && !v[index++].isEmpty()) {
|
||||
position.set(Position.PREFIX_ADC + 1, Integer.parseInt(v[index - 1]) * 0.001);
|
||||
position.set(Position.PREFIX_ADC + 1, Integer.parseInt(v[index - 1]) / 1000.0);
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 8)) {
|
||||
index += 1; // pedal breaking factor
|
||||
@@ -882,14 +882,14 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
|
||||
skipLocation(parser);
|
||||
|
||||
if (power != null && power > 10) {
|
||||
position.set(Position.KEY_POWER, power * 0.001); // only on some devices
|
||||
position.set(Position.KEY_POWER, power / 1000.0); // only on some devices
|
||||
}
|
||||
if (battery != null) {
|
||||
position.set(Position.KEY_BATTERY_LEVEL, battery);
|
||||
}
|
||||
|
||||
if (parser.hasNext()) {
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 1000.0);
|
||||
}
|
||||
position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt());
|
||||
position.set(Position.PREFIX_TEMP + 1, parser.nextDouble());
|
||||
@@ -943,7 +943,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
|
||||
String model = getDeviceModel(deviceSession, protocolVersion);
|
||||
index += 1; // device name
|
||||
long mask = Long.parseLong(v[index++], 16);
|
||||
Double power = v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1]) * 0.001;
|
||||
Double power = v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1]) / 1000.0;
|
||||
index += 1; // report type
|
||||
|
||||
int count = Integer.parseInt(v[index++]);
|
||||
@@ -1448,7 +1448,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("accessoryStatus", Integer.parseInt(values[index++]));
|
||||
}
|
||||
if (BitUtil.check(mask, 3)) {
|
||||
position.set("accessoryVoltage", Integer.parseInt(values[index++]) * 0.001);
|
||||
position.set("accessoryVoltage", Integer.parseInt(values[index++]) / 1000.0);
|
||||
}
|
||||
if (BitUtil.check(mask, 4)) {
|
||||
position.set("accessoryTemp", Integer.parseInt(values[index++]));
|
||||
@@ -1496,7 +1496,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("accessoryMac", values[index++]);
|
||||
}
|
||||
if (BitUtil.check(mask, 3)) {
|
||||
position.set("accessoryVoltage", Integer.parseInt(values[index]) * 0.001);
|
||||
position.set("accessoryVoltage", Integer.parseInt(values[index]) / 1000.0);
|
||||
}
|
||||
|
||||
decodeLocation(position, parser);
|
||||
|
||||
@@ -167,7 +167,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setLongitude(longitude);
|
||||
break;
|
||||
case '3':
|
||||
position.setLongitude(Double.parseDouble(value) * 0.000001);
|
||||
position.setLongitude(Double.parseDouble(value) / 1000000.0);
|
||||
break;
|
||||
case '6':
|
||||
double latitude = Double.parseDouble(value.substring(1));
|
||||
@@ -185,7 +185,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setLatitude(latitude);
|
||||
break;
|
||||
case '8':
|
||||
position.setLatitude(Double.parseDouble(value) * 0.000001);
|
||||
position.setLatitude(Double.parseDouble(value) / 1000000.0);
|
||||
break;
|
||||
case 'G':
|
||||
position.setAltitude(Double.parseDouble(value));
|
||||
|
||||
@@ -50,7 +50,7 @@ public class Gps056ProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
private static double decodeCoordinate(ByteBuf buf) {
|
||||
double degrees = buf.getUnsignedShort(buf.readerIndex()) / 100;
|
||||
double minutes = buf.readUnsignedShort() % 100 + buf.readUnsignedShort() * 0.0001;
|
||||
double minutes = buf.readUnsignedShort() % 100 + buf.readUnsignedShort() / 10000.0;
|
||||
degrees += minutes / 60;
|
||||
byte hemisphere = buf.readByte();
|
||||
if (hemisphere == 'S' || hemisphere == 'W') {
|
||||
|
||||
@@ -96,9 +96,9 @@ public class Gs100ProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
String coordinates = ByteBufUtil.hexDump(buf.readSlice(9));
|
||||
position.setLongitude(Integer.parseInt(coordinates.substring(0, 3))
|
||||
+ Integer.parseInt(coordinates.substring(3, 9)) * 0.0001 / 60);
|
||||
+ Integer.parseInt(coordinates.substring(3, 9)) / 10000.0 / 60);
|
||||
position.setLatitude(Integer.parseInt(coordinates.substring(10, 12))
|
||||
+ Integer.parseInt(coordinates.substring(12, 18)) * 0.0001 / 60);
|
||||
+ Integer.parseInt(coordinates.substring(12, 18)) / 10000.0 / 60);
|
||||
int flags = Integer.parseInt(coordinates.substring(9, 10), 16);
|
||||
if (!BitUtil.check(flags, 3)) {
|
||||
position.setLongitude(-position.getLongitude());
|
||||
@@ -108,7 +108,7 @@ public class Gs100ProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
String other = ByteBufUtil.hexDump(buf.readSlice(4));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(Integer.parseInt(other.substring(0, 5)) * 0.01));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(Integer.parseInt(other.substring(0, 5)) / 100.0));
|
||||
position.setCourse(Integer.parseInt(other.substring(5, 8)));
|
||||
|
||||
} else {
|
||||
|
||||
@@ -530,7 +530,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_CHARGE, BitUtil.check(status, 2));
|
||||
|
||||
if (buf.readableBytes() >= 2 + 6) {
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0);
|
||||
}
|
||||
if (buf.readableBytes() >= 1 + 6) {
|
||||
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
|
||||
@@ -584,8 +584,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(driverId));
|
||||
}
|
||||
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
|
||||
long portInfo = buf.readUnsignedInt();
|
||||
|
||||
@@ -593,7 +593,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
|
||||
|
||||
for (int i = 1; i <= BitUtil.between(portInfo, 20, 24); i++) {
|
||||
position.set(Position.PREFIX_ADC + i, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.PREFIX_ADC + i, buf.readUnsignedShort() / 100.0);
|
||||
}
|
||||
|
||||
return position;
|
||||
@@ -681,7 +681,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
getLastLocation(position, null);
|
||||
|
||||
position.set(Position.KEY_POWER, buf.readShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readShort() / 100.0);
|
||||
|
||||
return position;
|
||||
|
||||
@@ -692,8 +692,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
decodeLbs(position, buf, type, false);
|
||||
|
||||
position.set(Position.KEY_IGNITION, buf.readUnsignedByte() > 0);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0);
|
||||
|
||||
return position;
|
||||
|
||||
@@ -775,12 +775,12 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("absoluteCapacity", buf.readUnsignedByte());
|
||||
position.set("fullCapacity", buf.readUnsignedShort());
|
||||
position.set("batteryHealth", buf.readUnsignedByte());
|
||||
position.set("batteryTemp", buf.readUnsignedShort() * 0.1 - 273.1);
|
||||
position.set("batteryTemp", buf.readUnsignedShort() / 10.0 - 273.1);
|
||||
position.set("current", buf.readUnsignedShort());
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
position.set("cycleIndex", buf.readUnsignedShort());
|
||||
for (int i = 1; i <= 14; i++) {
|
||||
position.set("batteryCell" + i, buf.readUnsignedShort() * 0.001);
|
||||
position.set("batteryCell" + i, buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
position.set("currentChargeInterval", buf.readUnsignedShort());
|
||||
position.set("maxChargeInterval", buf.readUnsignedShort());
|
||||
@@ -814,7 +814,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedShort(); // working time
|
||||
|
||||
int value = buf.readUnsignedShort();
|
||||
double temperature = BitUtil.to(value, 15) * 0.1;
|
||||
double temperature = BitUtil.to(value, 15) / 10.0;
|
||||
position.set(Position.PREFIX_TEMP + 1, BitUtil.check(value, 15) ? temperature : -temperature);
|
||||
|
||||
} else if (type == MSG_IBUTTON) {
|
||||
@@ -883,10 +883,10 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
} else {
|
||||
if (type == MSG_GPS_LBS_STATUS_5
|
||||
|| (modelNT && (type == MSG_GPS_LBS_2 || type == MSG_GPS_LBS_DRIVER))) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
}
|
||||
if (type == MSG_STATUS && "R11".equals(model)) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
} else {
|
||||
int battery = buf.readUnsignedByte();
|
||||
if (modelNT && (type == MSG_GPS_LBS_2 || type == MSG_GPS_LBS_DRIVER)) {
|
||||
@@ -962,17 +962,17 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (BitUtil.check(mask, 8 + 5)) {
|
||||
position.set(Position.PREFIX_ADC + 1, value);
|
||||
} else {
|
||||
position.set(Position.PREFIX_ADC + 1, value * 0.1);
|
||||
position.set(Position.PREFIX_ADC + 1, value / 10.0);
|
||||
}
|
||||
}
|
||||
} else if (variant == Variant.VXT01) {
|
||||
decodeStatus(position, buf);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
|
||||
buf.readUnsignedByte(); // alarm extension
|
||||
} else if (variant == Variant.S5) {
|
||||
decodeStatus(position, buf);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
|
||||
position.addAlarm(decodeAlarm(buf.readUnsignedByte(), modelLW, modelSW, modelVL));
|
||||
position.set("oil", buf.readUnsignedShort());
|
||||
@@ -1002,8 +1002,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (BitUtil.check(temperature, 15)) {
|
||||
temperature = -BitUtil.to(temperature, 15);
|
||||
}
|
||||
position.set(Position.PREFIX_TEMP + 1, temperature * 0.01);
|
||||
position.set(Position.KEY_HUMIDITY, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.PREFIX_TEMP + 1, temperature / 100.0);
|
||||
position.set(Position.KEY_HUMIDITY, buf.readUnsignedShort() / 100.0);
|
||||
}
|
||||
|
||||
if (type == MSG_GPS_LBS_STATUS_4 && variant == Variant.SL4X) {
|
||||
@@ -1027,9 +1027,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
int module = buf.readUnsignedShort();
|
||||
int subLength = buf.readUnsignedByte();
|
||||
switch (module) {
|
||||
case 0x0027 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
case 0x0027 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
case 0x002E -> position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
|
||||
case 0x003B -> position.setAccuracy(buf.readUnsignedShort() * 0.01);
|
||||
case 0x003B -> position.setAccuracy(buf.readUnsignedShort() / 100.0);
|
||||
default -> buf.skipBytes(subLength);
|
||||
}
|
||||
}
|
||||
@@ -1083,7 +1083,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
getLastLocation(position, decodeDate(buf, deviceSession));
|
||||
}
|
||||
if (variant == Variant.JC400) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 10.0);
|
||||
}
|
||||
short event = buf.readUnsignedByte();
|
||||
position.set(Position.KEY_EVENT, event);
|
||||
@@ -1181,7 +1181,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (subType == 0x00) {
|
||||
|
||||
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort() / 100.0);
|
||||
return position;
|
||||
|
||||
} else if (subType == 0x04) {
|
||||
@@ -1334,13 +1334,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
String[] values = pair.split("=");
|
||||
if (values.length >= 2) {
|
||||
switch (Integer.parseInt(values[0].substring(0, 2), 16)) {
|
||||
case 40 -> position.set(Position.KEY_ODOMETER, Integer.parseInt(values[1], 16) * 0.01);
|
||||
case 43 -> position.set(Position.KEY_FUEL, Integer.parseInt(values[1], 16) * 0.01);
|
||||
case 45 -> position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(values[1], 16) * 0.01);
|
||||
case 53 -> position.set(Position.KEY_OBD_SPEED, Integer.parseInt(values[1], 16) * 0.01);
|
||||
case 54 -> position.set(Position.KEY_RPM, Integer.parseInt(values[1], 16) * 0.01);
|
||||
case 71 -> position.set(Position.KEY_FUEL_USED, Integer.parseInt(values[1], 16) * 0.01);
|
||||
case 73 -> position.set(Position.KEY_HOURS, Integer.parseInt(values[1], 16) * 0.01);
|
||||
case 40 -> position.set(Position.KEY_ODOMETER, Integer.parseInt(values[1], 16) / 100.0);
|
||||
case 43 -> position.set(Position.KEY_FUEL, Integer.parseInt(values[1], 16) / 100.0);
|
||||
case 45 -> position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(values[1], 16) / 100.0);
|
||||
case 53 -> position.set(Position.KEY_OBD_SPEED, Integer.parseInt(values[1], 16) / 100.0);
|
||||
case 54 -> position.set(Position.KEY_RPM, Integer.parseInt(values[1], 16) / 100.0);
|
||||
case 71 -> position.set(Position.KEY_FUEL_USED, Integer.parseInt(values[1], 16) / 100.0);
|
||||
case 73 -> position.set(Position.KEY_HOURS, Integer.parseInt(values[1], 16) / 100.0);
|
||||
case 74 -> position.set(Position.KEY_VIN, values[1]);
|
||||
}
|
||||
}
|
||||
@@ -1369,8 +1369,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setNetwork(new Network(cellTower));
|
||||
}
|
||||
}
|
||||
case 0x18 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
|
||||
case 0x28 -> position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
|
||||
case 0x18 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0);
|
||||
case 0x28 -> position.set(Position.KEY_HDOP, buf.readUnsignedByte() / 10.0);
|
||||
case 0x29 -> position.set(Position.KEY_INDEX, buf.readUnsignedInt());
|
||||
case 0x2a -> {
|
||||
int input = buf.readUnsignedByte();
|
||||
|
||||
@@ -68,7 +68,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
|
||||
length = 5;
|
||||
}
|
||||
|
||||
result = result * 10 + BcdUtil.readInteger(buf, length) * 0.0001;
|
||||
result = result * 10 + BcdUtil.readInteger(buf, length) / 10000.0;
|
||||
|
||||
result /= 60;
|
||||
result += degrees;
|
||||
|
||||
@@ -101,7 +101,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("powersaveCountdown", parser.next());
|
||||
position.set(Position.KEY_INPUT, parser.next());
|
||||
position.set(Position.KEY_OUTPUT, parser.next());
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble(0) * 0.1);
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble(0) / 10.0);
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
@@ -205,8 +205,8 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder {
|
||||
.setSecond(Integer.parseInt(time.substring(10, 12)));
|
||||
position.setTime(dateBuilder.getDate());
|
||||
|
||||
position.setLongitude(buf.readInt() * 0.00001);
|
||||
position.setLatitude(buf.readInt() * 0.00001);
|
||||
position.setLongitude(buf.readInt() / 100000.0);
|
||||
position.setLatitude(buf.readInt() / 100000.0);
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
|
||||
position.setCourse(buf.readUnsignedShort());
|
||||
@@ -232,9 +232,9 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
position.set("averageSpeed", buf.readUnsignedByte());
|
||||
buf.readUnsignedShort(); // interval fuel consumption
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() / 100.0);
|
||||
position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedShort());
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
position.set(Position.KEY_FUEL, buf.readUnsignedByte() * 0.4);
|
||||
buf.readUnsignedInt(); // trip id
|
||||
if (buf.readerIndex() < endIndex) {
|
||||
@@ -254,13 +254,13 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readCharSequence(length, StandardCharsets.US_ASCII).toString()) * 1000);
|
||||
break;
|
||||
case 0x0011:
|
||||
position.set(Position.KEY_HOURS, buf.readUnsignedInt() * 0.05);
|
||||
position.set(Position.KEY_HOURS, buf.readUnsignedInt() / 20.0);
|
||||
break;
|
||||
case 0x0014:
|
||||
position.set(Position.KEY_ENGINE_LOAD, buf.readUnsignedByte() / 255.0);
|
||||
position.set("timingAdvance", buf.readUnsignedByte() * 0.5);
|
||||
position.set("airTemp", buf.readUnsignedByte() - 40);
|
||||
position.set("airFlow", buf.readUnsignedShort() * 0.01);
|
||||
position.set("airFlow", buf.readUnsignedShort() / 100.0);
|
||||
position.set(Position.KEY_THROTTLE, buf.readUnsignedByte() / 255.0);
|
||||
break;
|
||||
case 0x0020:
|
||||
|
||||
@@ -91,14 +91,14 @@ public class IotmProtocolDecoder extends BaseMqttProtocolDecoder {
|
||||
case 0x2009 -> position.set("fuel2", record.readUnsignedByte());
|
||||
case 0x200A -> position.set(Position.KEY_ENGINE_LOAD, record.readUnsignedByte());
|
||||
case 0x2041 -> position.set(Position.KEY_BATTERY_LEVEL, record.readUnsignedByte());
|
||||
case 0x3000 -> position.set(Position.KEY_POWER, record.readUnsignedShortLE() * 0.001);
|
||||
case 0x3000 -> position.set(Position.KEY_POWER, record.readUnsignedShortLE() / 1000.0);
|
||||
case 0x3001, 0x3002, 0x3003 -> {
|
||||
key = Position.PREFIX_ADC + (0x3003 - sensorId + 3);
|
||||
position.set(key, record.readUnsignedShortLE() * 0.001);
|
||||
position.set(key, record.readUnsignedShortLE() / 1000.0);
|
||||
}
|
||||
case 0x3004 -> position.set(Position.KEY_BATTERY, record.readUnsignedShortLE() * 0.001);
|
||||
case 0x3004 -> position.set(Position.KEY_BATTERY, record.readUnsignedShortLE() / 1000.0);
|
||||
case 0x300C -> position.set(Position.KEY_RPM, record.readUnsignedShortLE());
|
||||
case 0x3021 -> position.set(Position.KEY_FUEL_CONSUMPTION, record.readUnsignedShortLE() * 0.05);
|
||||
case 0x3021 -> position.set(Position.KEY_FUEL_CONSUMPTION, record.readUnsignedShortLE() / 20.0);
|
||||
case 0x3037 -> position.set("cargoWeight", record.readUnsignedShortLE() * 2);
|
||||
case 0x4001 -> position.set(Position.KEY_FUEL_USED, record.readUnsignedIntLE());
|
||||
case 0x4002 -> position.set(Position.KEY_HOURS, record.readUnsignedIntLE());
|
||||
|
||||
@@ -508,17 +508,17 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
int length = buf.readUnsignedByte();
|
||||
switch (type) {
|
||||
case 0x01 -> position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 100L);
|
||||
case 0x02 -> position.set(Position.KEY_FUEL, buf.readUnsignedShort() * 0.1);
|
||||
case 0x03 -> position.set(Position.KEY_OBD_SPEED, buf.readUnsignedShort() * 0.1);
|
||||
case 0x02 -> position.set(Position.KEY_FUEL, buf.readUnsignedShort() / 10.0);
|
||||
case 0x03 -> position.set(Position.KEY_OBD_SPEED, buf.readUnsignedShort() / 10.0);
|
||||
case 0x56 -> {
|
||||
buf.readUnsignedByte(); // power level
|
||||
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
|
||||
}
|
||||
case 0x61 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
case 0x69 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
|
||||
case 0x61 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
case 0x69 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0);
|
||||
case 0x80 -> position.set(Position.KEY_OBD_SPEED, buf.readUnsignedByte());
|
||||
case 0x81 -> position.set(Position.KEY_RPM, buf.readUnsignedShort());
|
||||
case 0x82 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1);
|
||||
case 0x82 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() / 10.0);
|
||||
case 0x83 -> position.set(Position.KEY_ENGINE_LOAD, buf.readUnsignedByte());
|
||||
case 0x84 -> position.set(Position.KEY_COOLANT_TEMP, buf.readUnsignedByte() - 40);
|
||||
case 0x85 -> position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort());
|
||||
@@ -562,8 +562,8 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setValid(BitUtil.check(status, 1));
|
||||
|
||||
double lat = buf.readUnsignedInt() * 0.000001;
|
||||
double lon = buf.readUnsignedInt() * 0.000001;
|
||||
double lat = buf.readUnsignedInt() / 1000000.0;
|
||||
double lon = buf.readUnsignedInt() / 1000000.0;
|
||||
|
||||
if (BitUtil.check(status, 2)) {
|
||||
position.setLatitude(-lat);
|
||||
@@ -597,7 +597,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
decodeCoordinates(position, deviceSession, buf);
|
||||
|
||||
position.setAltitude(buf.readShort());
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() / 10.0));
|
||||
position.setCourse(buf.readUnsignedShort());
|
||||
position.setTime(readDate(buf, deviceSession.get(DeviceSession.KEY_TIMEZONE)));
|
||||
|
||||
@@ -605,7 +605,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
buf.skipBytes(4); // remaining battery and mileage
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.1);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 10.0);
|
||||
buf.readUnsignedInt(); // area id
|
||||
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
|
||||
buf.skipBytes(3); // reserved
|
||||
@@ -673,7 +673,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
stringValue = buf.readCharSequence(length, StandardCharsets.US_ASCII).toString();
|
||||
if (stringValue.startsWith("*M00")) {
|
||||
String lockStatus = stringValue.substring(8, 8 + 7);
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(lockStatus.substring(2, 5)) * 0.01);
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(lockStatus.substring(2, 5)) / 100.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -718,7 +718,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 0x63:
|
||||
for (int i = 1; i <= length / 11; i++) {
|
||||
position.set("lock" + i + "Id", ByteBufUtil.hexDump(buf.readSlice(6)));
|
||||
position.set("lock" + i + "Battery", buf.readUnsignedShort() * 0.001);
|
||||
position.set("lock" + i + "Battery", buf.readUnsignedShort() / 1000.0);
|
||||
position.set("lock" + i + "Seal", buf.readUnsignedByte() == 0x31);
|
||||
buf.readUnsignedByte(); // physical state
|
||||
buf.readUnsignedByte(); // rssi
|
||||
@@ -749,10 +749,10 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
break;
|
||||
case 0x68:
|
||||
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedShort() / 100.0);
|
||||
break;
|
||||
case 0x69:
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0);
|
||||
break;
|
||||
case 0x77:
|
||||
while (buf.readerIndex() < endIndex) {
|
||||
@@ -772,18 +772,18 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 10.0);
|
||||
break;
|
||||
case 0x91:
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.1);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 10.0);
|
||||
position.set(Position.KEY_RPM, buf.readUnsignedShort());
|
||||
position.set(Position.KEY_OBD_SPEED, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_THROTTLE, buf.readUnsignedByte() * 100 / 255);
|
||||
position.set(Position.KEY_ENGINE_LOAD, buf.readUnsignedByte() * 100 / 255);
|
||||
position.set(Position.KEY_COOLANT_TEMP, buf.readUnsignedByte() - 40);
|
||||
buf.readUnsignedShort();
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() / 100.0);
|
||||
buf.readUnsignedShort();
|
||||
buf.readUnsignedInt();
|
||||
buf.readUnsignedShort();
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedShort() / 100.0);
|
||||
break;
|
||||
case 0x94:
|
||||
if (length > 0) {
|
||||
@@ -809,7 +809,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
break;
|
||||
case 0xD3:
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 10.0);
|
||||
break;
|
||||
case 0xD4:
|
||||
case 0xE1:
|
||||
@@ -827,7 +827,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
break;
|
||||
case 0xD5:
|
||||
if (length == 2) {
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0);
|
||||
} else {
|
||||
int count = buf.readUnsignedByte();
|
||||
for (int i = 1; i <= count; i++) {
|
||||
@@ -848,7 +848,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
break;
|
||||
case 0xE2:
|
||||
if (!"DT800".equals(model)) {
|
||||
position.set(Position.KEY_FUEL, buf.readUnsignedInt() * 0.1);
|
||||
position.set(Position.KEY_FUEL, buf.readUnsignedInt() / 10.0);
|
||||
}
|
||||
break;
|
||||
case 0xE3:
|
||||
@@ -999,7 +999,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
int extendedType = buf.readUnsignedShort();
|
||||
switch (extendedType) {
|
||||
case 0x0001:
|
||||
position.set("fuel1", buf.readUnsignedShort() * 0.1);
|
||||
position.set("fuel1", buf.readUnsignedShort() / 10.0);
|
||||
buf.readUnsignedByte(); // unused
|
||||
break;
|
||||
case 0x0023:
|
||||
@@ -1051,7 +1051,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("batteryAlarm", batteryAlarm);
|
||||
break;
|
||||
case 0x00CE:
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
break;
|
||||
case 0x00D8:
|
||||
network.addCellTower(CellTower.from(
|
||||
@@ -1075,24 +1075,24 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
break;
|
||||
case 0xEE:
|
||||
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
|
||||
break;
|
||||
case 0xF1:
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedInt() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedInt() / 1000.0);
|
||||
break;
|
||||
case 0xF3:
|
||||
while (buf.readerIndex() < endIndex) {
|
||||
int extendedType = buf.readUnsignedShort();
|
||||
int extendedLength = buf.readUnsignedByte();
|
||||
switch (extendedType) {
|
||||
case 0x0002 -> position.set(Position.KEY_OBD_SPEED, buf.readUnsignedShort() * 0.1);
|
||||
case 0x0002 -> position.set(Position.KEY_OBD_SPEED, buf.readUnsignedShort() / 10.0);
|
||||
case 0x0003 -> position.set(Position.KEY_RPM, buf.readUnsignedShort());
|
||||
case 0x0004 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
|
||||
case 0x0004 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
|
||||
case 0x0005 -> position.set(Position.KEY_OBD_ODOMETER, buf.readUnsignedInt() * 100);
|
||||
case 0x0007 -> position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() * 0.1);
|
||||
case 0x0008 -> position.set(Position.KEY_ENGINE_LOAD, buf.readUnsignedShort() * 0.1);
|
||||
case 0x0007 -> position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() / 10.0);
|
||||
case 0x0008 -> position.set(Position.KEY_ENGINE_LOAD, buf.readUnsignedShort() / 10.0);
|
||||
case 0x0009 -> position.set(Position.KEY_COOLANT_TEMP, buf.readUnsignedShort() - 40);
|
||||
case 0x000B -> position.set("intakePressure", buf.readUnsignedShort());
|
||||
case 0x000C -> position.set("intakeTemp", buf.readUnsignedShort() - 40);
|
||||
@@ -1109,8 +1109,8 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("calid", BufferUtil.readString(buf, extendedLength));
|
||||
}
|
||||
}
|
||||
case 0x0100 -> position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedShort() * 0.1);
|
||||
case 0x0102 -> position.set("tripFuel", buf.readUnsignedShort() * 0.1);
|
||||
case 0x0100 -> position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedShort() / 10.0);
|
||||
case 0x0102 -> position.set("tripFuel", buf.readUnsignedShort() / 10.0);
|
||||
case 0x0112 -> position.set("hardAccelerationCount", buf.readUnsignedShort());
|
||||
case 0x0113 -> position.set("hardDecelerationCount", buf.readUnsignedShort());
|
||||
case 0x0114 -> position.set("hardCorneringCount", buf.readUnsignedShort());
|
||||
@@ -1144,10 +1144,10 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("lightSensor", buf.readUnsignedShort());
|
||||
}
|
||||
if (BitUtil.check(fieldMask, 1)) {
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readShort() * 0.1);
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readShort() / 10.0);
|
||||
}
|
||||
if (BitUtil.check(fieldMask, 2)) {
|
||||
position.set(Position.KEY_HUMIDITY, buf.readShort() * 0.1);
|
||||
position.set(Position.KEY_HUMIDITY, buf.readShort() / 10.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1155,7 +1155,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (length == 2) {
|
||||
position.set(Position.KEY_HUMIDITY, buf.readUnsignedShort() / 10.0);
|
||||
} else {
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedInt() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedInt() / 1000.0);
|
||||
if (length >= 5) {
|
||||
short batteryStatus = buf.readUnsignedByte();
|
||||
if (batteryStatus == 2 || batteryStatus == 3) {
|
||||
@@ -1180,7 +1180,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (length == 1) {
|
||||
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
|
||||
} else if (length == 2) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 10.0);
|
||||
} else if (length == 4) {
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
|
||||
} else {
|
||||
@@ -1421,21 +1421,21 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 0x0102, 0x0528, 0x0546 -> {
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 100);
|
||||
}
|
||||
case 0x0103 -> position.set(Position.KEY_FUEL, buf.readUnsignedInt() * 0.01);
|
||||
case 0x0103 -> position.set(Position.KEY_FUEL, buf.readUnsignedInt() / 100.0);
|
||||
case 0x0111 -> position.set("fuelTemp", buf.readUnsignedByte() - 40);
|
||||
case 0x012E -> position.set("oilLevel", buf.readUnsignedShort() * 0.1);
|
||||
case 0x052A -> position.set(Position.KEY_FUEL, buf.readUnsignedShort() * 0.01);
|
||||
case 0x0105, 0x052C -> position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() * 0.01);
|
||||
case 0x012E -> position.set("oilLevel", buf.readUnsignedShort() / 10.0);
|
||||
case 0x052A -> position.set(Position.KEY_FUEL, buf.readUnsignedShort() / 100.0);
|
||||
case 0x0105, 0x052C -> position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() / 100.0);
|
||||
case 0x014A, 0x0537, 0x0538, 0x0539 -> {
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() / 100.0);
|
||||
}
|
||||
case 0x052B -> position.set(Position.KEY_FUEL, buf.readUnsignedByte());
|
||||
case 0x052D -> position.set(Position.KEY_COOLANT_TEMP, buf.readUnsignedByte() - 40);
|
||||
case 0x052E -> position.set("airTemp", buf.readUnsignedByte() - 40);
|
||||
case 0x0530 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
|
||||
case 0x0535 -> position.set(Position.KEY_OBD_SPEED, buf.readUnsignedShort() * 0.1);
|
||||
case 0x0530 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
|
||||
case 0x0535 -> position.set(Position.KEY_OBD_SPEED, buf.readUnsignedShort() / 10.0);
|
||||
case 0x0536 -> position.set(Position.KEY_RPM, buf.readUnsignedShort());
|
||||
case 0x053D -> position.set("intakePressure", buf.readUnsignedShort() * 0.1);
|
||||
case 0x053D -> position.set("intakePressure", buf.readUnsignedShort() / 10.0);
|
||||
case 0x0544 -> position.set("liquidLevel", buf.readUnsignedByte());
|
||||
case 0x0547, 0x0548 -> position.set(Position.KEY_THROTTLE, buf.readUnsignedByte());
|
||||
default -> {
|
||||
@@ -1548,10 +1548,10 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setValid(true);
|
||||
position.setTime(readDate(buf, deviceSession.get(DeviceSession.KEY_TIMEZONE)));
|
||||
position.setLatitude(buf.readInt() * 0.000001);
|
||||
position.setLongitude(buf.readInt() * 0.000001);
|
||||
position.setLatitude(buf.readInt() / 1000000.0);
|
||||
position.setLongitude(buf.readInt() / 1000000.0);
|
||||
position.setAltitude(buf.readShort());
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() / 10.0));
|
||||
position.setCourse(buf.readUnsignedShort());
|
||||
|
||||
// TODO more positions and g sensor data
|
||||
|
||||
@@ -316,7 +316,7 @@ public class L100ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_HEM));
|
||||
position.setSpeed(parser.nextDouble());
|
||||
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 1000.0);
|
||||
|
||||
position.setNetwork(new Network(CellTower.from(
|
||||
parser.nextInt(), parser.nextInt(), parser.nextInt(), parser.nextHexInt())));
|
||||
|
||||
@@ -221,13 +221,13 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
|
||||
String event = parser.next();
|
||||
position.addAlarm(decodeAlarm(event));
|
||||
position.set(Position.KEY_EVENT, decodeEvent(event, position, model));
|
||||
position.set(Position.KEY_BATTERY, Double.parseDouble(parser.next().replaceAll("\\.", "")) * 0.001);
|
||||
position.set(Position.KEY_BATTERY, Double.parseDouble(parser.next().replaceAll("\\.", "")) / 1000.0);
|
||||
position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
|
||||
position.set(Position.KEY_GPS, parser.nextInt());
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextDouble() * 0.001);
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextDouble() / 1000.0);
|
||||
|
||||
if ("AVL110".equals(model) || "AVL120".equals(model)) {
|
||||
position.set(Position.PREFIX_ADC + 2, parser.nextDouble() * 0.001);
|
||||
position.set(Position.PREFIX_ADC + 2, parser.nextDouble() / 1000.0);
|
||||
} else {
|
||||
parser.next();
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ public class M2cProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_ODOMETER, parser.nextLong());
|
||||
position.set(Position.KEY_INPUT, parser.nextInt());
|
||||
position.set(Position.KEY_OUTPUT, parser.nextInt());
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 1000.0);
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextInt());
|
||||
position.set(Position.PREFIX_ADC + 2, parser.nextInt());
|
||||
position.set(Position.PREFIX_TEMP + 1, parser.nextDouble());
|
||||
|
||||
@@ -224,7 +224,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (parser.hasNext()) {
|
||||
String fuel = parser.next();
|
||||
position.set(Position.KEY_FUEL,
|
||||
Integer.parseInt(fuel.substring(0, 2), 16) + Integer.parseInt(fuel.substring(2), 16) * 0.01);
|
||||
Integer.parseInt(fuel.substring(0, 2), 16) + Integer.parseInt(fuel.substring(2), 16) / 100.0);
|
||||
}
|
||||
|
||||
if (parser.hasNext()) {
|
||||
@@ -232,7 +232,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
int index = Integer.parseInt(temp.substring(0, 2), 16);
|
||||
if (protocol >= 3) {
|
||||
double value = (short) Integer.parseInt(temp.substring(2), 16);
|
||||
position.set(Position.PREFIX_TEMP + index, value * 0.01);
|
||||
position.set(Position.PREFIX_TEMP + index, value / 100.0);
|
||||
} else {
|
||||
double value = Byte.parseByte(temp.substring(2, 4), 16);
|
||||
value += (value < 0 ? -0.01 : 0.01) * Integer.parseInt(temp.substring(4), 16);
|
||||
@@ -292,8 +292,8 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.set(Position.KEY_EVENT, buf.readUnsignedByte());
|
||||
|
||||
position.setLatitude(buf.readIntLE() * 0.000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.000001);
|
||||
position.setLatitude(buf.readIntLE() / 1000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 1000000.0);
|
||||
|
||||
position.setTime(new Date((946684800 + buf.readUnsignedIntLE()) * 1000)); // 946684800 = 2000-01-01
|
||||
|
||||
@@ -305,7 +305,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE()));
|
||||
position.setCourse(buf.readUnsignedShortLE());
|
||||
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedShortLE() * 0.1);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedShortLE() / 10.0);
|
||||
|
||||
position.setAltitude(buf.readUnsignedShortLE());
|
||||
|
||||
@@ -320,7 +320,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_STATUS, buf.readUnsignedShortLE());
|
||||
|
||||
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShortLE());
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 100.0);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE());
|
||||
|
||||
buf.readUnsignedIntLE(); // geo-fence
|
||||
@@ -398,11 +398,11 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 0x09 -> position.setCourse(buf.readUnsignedShortLE());
|
||||
case 0x0A -> position.set(Position.KEY_HDOP, buf.readUnsignedShortLE());
|
||||
case 0x0B -> position.setAltitude(buf.readShortLE());
|
||||
case 0x16 -> position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShortLE() * 0.01);
|
||||
case 0x17 -> position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShortLE() * 0.01);
|
||||
case 0x19 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.01);
|
||||
case 0x1A -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.01);
|
||||
case 0x29 -> position.set(Position.KEY_FUEL, buf.readUnsignedShortLE() * 0.01);
|
||||
case 0x16 -> position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShortLE() / 100.0);
|
||||
case 0x17 -> position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShortLE() / 100.0);
|
||||
case 0x19 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 100.0);
|
||||
case 0x1A -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 100.0);
|
||||
case 0x29 -> position.set(Position.KEY_FUEL, buf.readUnsignedShortLE() / 100.0);
|
||||
case 0x40 -> position.set(Position.KEY_EVENT, buf.readUnsignedShortLE());
|
||||
case 0x91, 0x92 -> position.set(Position.KEY_OBD_SPEED, buf.readUnsignedShortLE());
|
||||
case 0x98 -> position.set(Position.KEY_FUEL_USED, buf.readUnsignedShortLE());
|
||||
@@ -419,15 +419,15 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
boolean extension = buf.getUnsignedByte(buf.readerIndex()) == 0xFE;
|
||||
int id = extension ? buf.readUnsignedShort() : buf.readUnsignedByte();
|
||||
switch (id) {
|
||||
case 0x02 -> position.setLatitude(buf.readIntLE() * 0.000001);
|
||||
case 0x03 -> position.setLongitude(buf.readIntLE() * 0.000001);
|
||||
case 0x02 -> position.setLatitude(buf.readIntLE() / 1000000.0);
|
||||
case 0x03 -> position.setLongitude(buf.readIntLE() / 1000000.0);
|
||||
case 0x04 -> position.setTime(new Date((946684800 + buf.readUnsignedIntLE()) * 1000)); // 2000-01-01
|
||||
case 0x0C -> position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());
|
||||
case 0x0D -> position.set("runtime", buf.readUnsignedIntLE());
|
||||
case 0x25 -> position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(buf.readUnsignedIntLE()));
|
||||
case 0x9B -> position.set(Position.KEY_OBD_ODOMETER, buf.readUnsignedIntLE());
|
||||
case 0xA0 -> position.set(Position.KEY_FUEL_USED, buf.readUnsignedIntLE() * 0.001);
|
||||
case 0xA2 -> position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedIntLE() * 0.01);
|
||||
case 0xA0 -> position.set(Position.KEY_FUEL_USED, buf.readUnsignedIntLE() / 1000.0);
|
||||
case 0xA2 -> position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedIntLE() / 100.0);
|
||||
case 0xFEF4 -> position.set(Position.KEY_HOURS, buf.readUnsignedIntLE() * 60000);
|
||||
default -> buf.readUnsignedIntLE();
|
||||
}
|
||||
@@ -451,7 +451,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
case 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31 -> {
|
||||
buf.readUnsignedByte(); // label
|
||||
position.set(Position.PREFIX_TEMP + (id - 0x2A), buf.readShortLE() * 0.01);
|
||||
position.set(Position.PREFIX_TEMP + (id - 0x2A), buf.readShortLE() / 100.0);
|
||||
}
|
||||
case 0x4B -> buf.skipBytes(length); // network information
|
||||
case 0xFE31 -> {
|
||||
|
||||
@@ -87,7 +87,7 @@ public class MictrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
int event = Integer.parseInt(values[index++]);
|
||||
position.addAlarm(decodeAlarm(event));
|
||||
position.set(Position.KEY_EVENT, event);
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(values[index++]) * 0.001);
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(values[index++]) / 1000.0);
|
||||
}
|
||||
|
||||
private void decodeCell(Network network, String data) {
|
||||
@@ -134,7 +134,7 @@ public class MictrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
int event = Integer.parseInt(values[index++]);
|
||||
position.addAlarm(decodeAlarm(event));
|
||||
position.set(Position.KEY_EVENT, event);
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(values[index++]) * 0.001);
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(values[index++]) / 1000.0);
|
||||
}
|
||||
|
||||
private void decodeStatus(Position position, String data) {
|
||||
@@ -150,7 +150,7 @@ public class MictrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
int event = Integer.parseInt(values[index++]);
|
||||
position.addAlarm(decodeAlarm(event));
|
||||
position.set(Position.KEY_EVENT, event);
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(values[index++]) * 0.001);
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(values[index++]) / 1000.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -206,17 +206,17 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
|
||||
break;
|
||||
case 0x14:
|
||||
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
break;
|
||||
case 0x20:
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE()));
|
||||
position.setCourse(buf.readUnsignedShortLE());
|
||||
position.setAltitude(buf.readShortLE());
|
||||
int hdop = buf.readUnsignedShortLE();
|
||||
position.setValid(hdop > 0);
|
||||
position.set(Position.KEY_HDOP, hdop * 0.1);
|
||||
position.set(Position.KEY_HDOP, hdop / 10.0);
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());
|
||||
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
|
||||
break;
|
||||
@@ -260,12 +260,12 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("tagId", readTagId(buf));
|
||||
}
|
||||
if (length >= 15) {
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setValid(true);
|
||||
}
|
||||
if (key == 0x26) {
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedShortLE() * 0.1);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedShortLE() / 10.0);
|
||||
position.setAltitude(buf.readShortLE());
|
||||
} else if (length > 15) {
|
||||
position.set("description", buf.readCharSequence(
|
||||
@@ -295,10 +295,10 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
|
||||
endIndex - buf.readerIndex(), StandardCharsets.US_ASCII).toString());
|
||||
break;
|
||||
case 0x27:
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setValid(true);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedShortLE() * 0.1);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedShortLE() / 10.0);
|
||||
position.setAltitude(buf.readShortLE());
|
||||
break;
|
||||
case 0x28:
|
||||
@@ -312,8 +312,8 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("tagBattery" + beaconIndex, buf.readUnsignedByte());
|
||||
}
|
||||
if (BitUtil.check(beaconFlags, 7)) {
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setValid(true);
|
||||
}
|
||||
if (BitUtil.check(beaconFlags, 6)) {
|
||||
@@ -334,8 +334,8 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedByte(); // flags
|
||||
buf.skipBytes(6); // mac
|
||||
buf.readUnsignedByte(); // rssi
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setValid(true);
|
||||
if (endIndex > buf.readerIndex()) {
|
||||
position.set("description", buf.readCharSequence(
|
||||
@@ -458,11 +458,11 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 0x13 -> position.set("deviceName", BufferUtil.readString(buf, length));
|
||||
case 0x14 -> {
|
||||
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
case 0x15 -> {
|
||||
position.set("bleLatitude", buf.readIntLE() * 0.0000001);
|
||||
position.set("bleLongitude", buf.readIntLE() * 0.0000001);
|
||||
position.set("bleLatitude", buf.readIntLE() / 10000000.0);
|
||||
position.set("bleLongitude", buf.readIntLE() / 10000000.0);
|
||||
position.set("bleLocation", BufferUtil.readString(buf, length - 8));
|
||||
}
|
||||
case 0x17 -> position.set("gpsUrl", BufferUtil.readString(buf, length));
|
||||
@@ -471,8 +471,8 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 0x1B -> position.set("gsmModule", BufferUtil.readString(buf, length));
|
||||
case 0x1D -> {
|
||||
position.set("agpsUpdate", buf.readUnsignedByte());
|
||||
position.set("agpsLatitude", buf.readIntLE() * 0.0000001);
|
||||
position.set("agpsLongitude", buf.readIntLE() * 0.0000001);
|
||||
position.set("agpsLatitude", buf.readIntLE() / 10000000.0);
|
||||
position.set("agpsLongitude", buf.readIntLE() / 10000000.0);
|
||||
}
|
||||
case 0x30 -> {
|
||||
position.set("numberFlag", buf.readUnsignedByte());
|
||||
|
||||
@@ -64,10 +64,10 @@ public class MotorProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.addAlarm(Position.ALARM_GENERAL);
|
||||
}
|
||||
|
||||
position.setLatitude(BcdUtil.readInteger(buf, 2) + BcdUtil.readInteger(buf, 6) * 0.0001 / 60);
|
||||
position.setLongitude(BcdUtil.readInteger(buf, 4) + BcdUtil.readInteger(buf, 6) * 0.0001 / 60);
|
||||
position.setSpeed(BcdUtil.readInteger(buf, 4) * 0.1);
|
||||
position.setCourse(BcdUtil.readInteger(buf, 4) * 0.1);
|
||||
position.setLatitude(BcdUtil.readInteger(buf, 2) + BcdUtil.readInteger(buf, 6) / 10000.0 / 60);
|
||||
position.setLongitude(BcdUtil.readInteger(buf, 4) + BcdUtil.readInteger(buf, 6) / 10000.0 / 60);
|
||||
position.setSpeed(BcdUtil.readInteger(buf, 4) / 10.0);
|
||||
position.setCourse(BcdUtil.readInteger(buf, 4) / 10.0);
|
||||
|
||||
position.setTime(new DateBuilder()
|
||||
.setYear(BcdUtil.readInteger(buf, 2))
|
||||
|
||||
@@ -155,7 +155,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
if (BitUtil.check(infoGroups, 6)) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE());
|
||||
}
|
||||
|
||||
|
||||
@@ -90,8 +90,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedShortLE(); // report trigger
|
||||
position.set(Position.KEY_FLAGS, buf.readUnsignedShortLE());
|
||||
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setAltitude(buf.readUnsignedShortLE());
|
||||
|
||||
position.set(Position.KEY_SATELLITES, buf.readUnsignedShortLE());
|
||||
@@ -104,7 +104,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());
|
||||
position.set(Position.KEY_DISTANCE, buf.readUnsignedIntLE());
|
||||
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
|
||||
position.set(Position.KEY_CHARGE, buf.readUnsignedShortLE());
|
||||
|
||||
@@ -127,8 +127,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setTime(convertTimestamp(buf.readUnsignedIntLE()));
|
||||
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setAltitude(buf.readUnsignedShortLE());
|
||||
|
||||
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
|
||||
@@ -145,7 +145,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.PREFIX_IO + 2, buf.readUnsignedShortLE()); // VSAUT2 voltage
|
||||
position.set(Position.PREFIX_IO + 3, buf.readUnsignedShortLE()); // solar voltage
|
||||
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
|
||||
return position;
|
||||
}
|
||||
@@ -158,8 +158,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setDeviceId(deviceSession.getDeviceId());
|
||||
position.setTime(convertTimestamp(timestamp));
|
||||
|
||||
position.setLatitude(buf.readMediumLE() * 0.00002);
|
||||
position.setLongitude(buf.readMediumLE() * 0.00002);
|
||||
position.setLatitude(buf.readMediumLE() / 50000.0);
|
||||
position.setLongitude(buf.readMediumLE() / 50000.0);
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
|
||||
position.setCourse(buf.readUnsignedByte() * 2);
|
||||
@@ -180,8 +180,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setDeviceId(deviceSession.getDeviceId());
|
||||
position.setTime(convertTimestamp(timestamp));
|
||||
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
|
||||
buf.readUnsignedByte(); // report trigger
|
||||
|
||||
@@ -213,15 +213,15 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setTime(convertTimestamp(buf.readUnsignedIntLE()));
|
||||
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setAltitude(buf.readUnsignedShortLE());
|
||||
|
||||
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte());
|
||||
|
||||
position.setSpeed(buf.readUnsignedShortLE() * 0.194384);
|
||||
position.setCourse(buf.readUnsignedShortLE() * 0.1);
|
||||
position.setCourse(buf.readUnsignedShortLE() / 10.0);
|
||||
|
||||
position.set("maximumSpeed", buf.readUnsignedByte());
|
||||
position.set("minimumSpeed", buf.readUnsignedByte());
|
||||
@@ -229,7 +229,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
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.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
|
||||
return position;
|
||||
}
|
||||
@@ -249,14 +249,14 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
buf.readUnsignedShortLE(); // duration
|
||||
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
|
||||
position.setCourse(buf.readUnsignedByte() * 2.0);
|
||||
|
||||
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());
|
||||
|
||||
return position;
|
||||
|
||||
@@ -155,8 +155,8 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
|
||||
if (isFormat(format, F10, F20, F30)) {
|
||||
position.set(Position.PREFIX_TEMP + 1, buf.readShortLE());
|
||||
@@ -220,7 +220,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (isFormat(format, F60)) {
|
||||
position.setLatitude(buf.readIntLE() / 600000.0);
|
||||
position.setLongitude(buf.readIntLE() / 600000.0);
|
||||
position.setAltitude(buf.readIntLE() * 0.1);
|
||||
position.setAltitude(buf.readIntLE() / 10.0);
|
||||
} else {
|
||||
position.setLatitude(buf.readFloatLE() / Math.PI * 180);
|
||||
position.setLongitude(buf.readFloatLE() / Math.PI * 180);
|
||||
@@ -343,13 +343,13 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 8 -> position.setTime(new DateBuilder(new Date(buf.readUnsignedIntLE() * 1000)).getDate());
|
||||
case 9 -> position.setLatitude(buf.readIntLE() / 600000.0);
|
||||
case 10 -> position.setLongitude(buf.readIntLE() / 600000.0);
|
||||
case 11 -> position.setAltitude(buf.readIntLE() * 0.1);
|
||||
case 11 -> position.setAltitude(buf.readIntLE() / 10.0);
|
||||
case 12 -> position.setSpeed(UnitsConverter.knotsFromKph(buf.readFloatLE()));
|
||||
case 13 -> position.setCourse(buf.readUnsignedShortLE());
|
||||
case 14 -> position.set(Position.KEY_ODOMETER, buf.readFloatLE() * 1000);
|
||||
case 15 -> position.set(Position.KEY_DISTANCE, buf.readFloatLE() * 1000);
|
||||
case 18 -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.001);
|
||||
case 19 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
|
||||
case 18 -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 1000.0);
|
||||
case 19 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
case 20, 21, 22, 23, 24, 25, 26, 27 ->
|
||||
position.set(Position.PREFIX_ADC + (i - 19), buf.readUnsignedShortLE());
|
||||
case 28 -> {
|
||||
@@ -393,8 +393,8 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_SATELLITES_VISIBLE, satVisible);
|
||||
}
|
||||
case 70 -> {
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_PDOP, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedByte() / 10.0);
|
||||
position.set(Position.KEY_PDOP, buf.readUnsignedByte() / 10.0);
|
||||
}
|
||||
default -> {
|
||||
if (i < FLEX_FIELDS_SIZES.length) {
|
||||
@@ -429,7 +429,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setTime(new DateBuilder(new Date(buf.readUnsignedIntLE() * 1000)).getDate());
|
||||
position.setLatitude(buf.readIntLE() / 600000.0);
|
||||
position.setLongitude(buf.readIntLE() / 600000.0);
|
||||
position.setAltitude(buf.readIntLE() * 0.1);
|
||||
position.setAltitude(buf.readIntLE() / 10.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readFloatLE()));
|
||||
position.setCourse(buf.readUnsignedShortLE());
|
||||
position.set(Position.KEY_ODOMETER, buf.readFloatLE() * 1000);
|
||||
|
||||
@@ -83,9 +83,9 @@ public class NavisetProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_STATUS, buf.readUnsignedByte());
|
||||
position.setValid(true);
|
||||
position.setTime(new Date(buf.readUnsignedIntLE() * 1000));
|
||||
position.setLatitude(buf.readUnsignedIntLE() * 0.000001);
|
||||
position.setLongitude(buf.readUnsignedIntLE() * 0.000001);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE() * 0.1));
|
||||
position.setLatitude(buf.readUnsignedIntLE() / 1000000.0);
|
||||
position.setLongitude(buf.readUnsignedIntLE() / 1000000.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE() / 10.0));
|
||||
|
||||
if (BitUtil.check(blockMask, 0)) {
|
||||
int dataMask = buf.readUnsignedByte();
|
||||
@@ -95,17 +95,17 @@ public class NavisetProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_SATELLITES, BitUtil.to(satellites, 7));
|
||||
}
|
||||
if (BitUtil.check(dataMask, 1)) {
|
||||
position.setCourse(buf.readUnsignedShortLE() * 0.1);
|
||||
position.setCourse(buf.readUnsignedShortLE() / 10.0);
|
||||
}
|
||||
if (BitUtil.check(dataMask, 2)) {
|
||||
position.setAltitude(buf.readShortLE());
|
||||
}
|
||||
if (BitUtil.check(dataMask, 3)) {
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedByte() / 10.0);
|
||||
}
|
||||
if (BitUtil.check(dataMask, 4)) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 1000.0);
|
||||
}
|
||||
if (BitUtil.check(dataMask, 5)) {
|
||||
position.set(Position.KEY_INPUT, buf.readUnsignedByte());
|
||||
|
||||
@@ -233,13 +233,13 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setFixTime(new Date(buf.readUnsignedIntLE() * 1000));
|
||||
break;
|
||||
case 10:
|
||||
position.setLatitude(buf.readIntLE() * 0.0001 / 60);
|
||||
position.setLatitude(buf.readIntLE() / 10000.0 / 60);
|
||||
break;
|
||||
case 11:
|
||||
position.setLongitude(buf.readIntLE() * 0.0001 / 60);
|
||||
position.setLongitude(buf.readIntLE() / 10000.0 / 60);
|
||||
break;
|
||||
case 12:
|
||||
position.setAltitude(buf.readIntLE() * 0.1);
|
||||
position.setAltitude(buf.readIntLE() / 10.0);
|
||||
break;
|
||||
case 13:
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readFloatLE()));
|
||||
@@ -251,10 +251,10 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_ODOMETER, buf.readFloatLE() * 1000);
|
||||
break;
|
||||
case 19:
|
||||
position.set(Position.KEY_POWER, buf.readShortLE() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readShortLE() / 1000.0);
|
||||
break;
|
||||
case 20:
|
||||
position.set(Position.KEY_BATTERY, buf.readShortLE() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readShortLE() / 1000.0);
|
||||
break;
|
||||
case 21:
|
||||
case 22:
|
||||
@@ -262,7 +262,8 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 24:
|
||||
case 25:
|
||||
case 26:
|
||||
position.set(Position.PREFIX_ADC + (j + 1 - 21), buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(
|
||||
Position.PREFIX_ADC + (j + 1 - 21), buf.readUnsignedShortLE() / 1000.0);
|
||||
break;
|
||||
case 29:
|
||||
value = buf.readUnsignedByte();
|
||||
@@ -319,7 +320,7 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (BitUtil.check(value, 15)) {
|
||||
position.set("obdFuelLevel", BitUtil.to(value, 14));
|
||||
} else {
|
||||
position.set("obdFuel", BitUtil.to(value, 14) * 0.1);
|
||||
position.set("obdFuel", BitUtil.to(value, 14) / 10.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -364,7 +365,7 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (BitUtil.check(value, 15)) {
|
||||
position.set("obdAdBlueLevel", BitUtil.to(value, 14));
|
||||
} else {
|
||||
position.set("obdAdBlue", BitUtil.to(value, 14) * 0.1);
|
||||
position.set("obdAdBlue", BitUtil.to(value, 14) / 10.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -396,7 +397,7 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
|
||||
value = buf.readShortLE();
|
||||
position.set(
|
||||
Position.PREFIX_TEMP + (j + 1 + 8 - 163),
|
||||
(value != (short) 0x8000) ? value * 0.05 : null);
|
||||
(value != (short) 0x8000) ? value / 20.0 : null);
|
||||
break;
|
||||
case 167:
|
||||
case 168:
|
||||
|
||||
@@ -80,7 +80,7 @@ public class NetProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN) * hemisphereLongitude);
|
||||
|
||||
position.set(Position.KEY_STATUS, parser.nextHexLong());
|
||||
position.setSpeed(parser.nextHexInt() * 0.01);
|
||||
position.setSpeed(parser.nextHexInt() / 100.0);
|
||||
position.set(Position.KEY_ODOMETER, parser.nextHexInt() * 1852.0 / 16);
|
||||
position.setCourse(parser.nextHexInt());
|
||||
|
||||
|
||||
@@ -114,8 +114,8 @@ public class NiotProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedByte(); // statusB
|
||||
buf.readUnsignedByte(); // statusC
|
||||
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedByte() / 10.0);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 10.0);
|
||||
buf.readUnsignedByte(); // speed limit
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
|
||||
buf.readUnsignedByte(); // sensor speed
|
||||
|
||||
@@ -58,8 +58,8 @@ public class NyitechProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setLongitude(BitUtil.check(flags, 3) ? lon : -lon);
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromCps(buf.readUnsignedShortLE()));
|
||||
position.setCourse(buf.readUnsignedShortLE() * 0.1);
|
||||
position.setAltitude(buf.readShortLE() * 0.1);
|
||||
position.setCourse(buf.readUnsignedShortLE() / 10.0);
|
||||
position.setAltitude(buf.readShortLE() / 10.0);
|
||||
}
|
||||
|
||||
private String decodeAlarm(int type) {
|
||||
@@ -124,7 +124,7 @@ public class NyitechProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() * 0.01);
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() / 100.0);
|
||||
position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt());
|
||||
|
||||
|
||||
|
||||
@@ -105,14 +105,14 @@ public class ObdDongleProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.set(Position.KEY_SATELLITES, BitUtil.to(flags, 4));
|
||||
|
||||
double longitude = ((BitUtil.to(buf.readUnsignedShort(), 1) << 24) + buf.readUnsignedMedium()) * 0.00001;
|
||||
double longitude = ((BitUtil.to(buf.readUnsignedShort(), 1) << 24) + buf.readUnsignedMedium()) / 100000.0;
|
||||
position.setLongitude(BitUtil.check(flags, 5) ? longitude : -longitude);
|
||||
|
||||
double latitude = buf.readUnsignedMedium() * 0.00001;
|
||||
double latitude = buf.readUnsignedMedium() / 100000.0;
|
||||
position.setLatitude(BitUtil.check(flags, 4) ? latitude : -latitude);
|
||||
|
||||
int speedCourse = buf.readUnsignedMedium();
|
||||
position.setSpeed(UnitsConverter.knotsFromMph(BitUtil.from(speedCourse, 10) * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromMph(BitUtil.from(speedCourse, 10) / 10.0));
|
||||
position.setCourse(BitUtil.to(speedCourse, 10));
|
||||
|
||||
ByteBuf response = Unpooled.buffer();
|
||||
|
||||
@@ -95,15 +95,15 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
if (BitUtil.check(mask, 3)) {
|
||||
position.setLatitude(buf.readUnsignedInt() * 0.000001 - 90);
|
||||
position.setLongitude(buf.readUnsignedInt() * 0.000001 - 180.0);
|
||||
position.setLatitude(buf.readUnsignedInt() / 1000000.0 - 90);
|
||||
position.setLongitude(buf.readUnsignedInt() / 1000000.0 - 180.0);
|
||||
}
|
||||
|
||||
if (BitUtil.check(mask, 4)) {
|
||||
int status = buf.readUnsignedByte();
|
||||
position.setValid(BitUtil.between(status, 4, 8) != 0);
|
||||
position.set(Position.KEY_SATELLITES, BitUtil.to(status, 4));
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_HDOP, buf.readUnsignedByte() / 10.0);
|
||||
}
|
||||
|
||||
if (BitUtil.check(mask, 5)) {
|
||||
@@ -123,11 +123,11 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
if (BitUtil.check(mask, 9)) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
|
||||
if (BitUtil.check(mask, 10)) {
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
|
||||
if (BitUtil.check(mask, 11)) {
|
||||
@@ -156,7 +156,7 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder {
|
||||
private double convertCoordinate(long value) {
|
||||
boolean negative = value < 0;
|
||||
value = Math.abs(value);
|
||||
double minutes = (value % 100000) * 0.001;
|
||||
double minutes = (value % 100000) / 1000.0;
|
||||
value /= 100000;
|
||||
double degrees = value + minutes / 60;
|
||||
return negative ? -degrees : degrees;
|
||||
@@ -199,7 +199,7 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setCourse(buf.readUnsignedShort());
|
||||
position.setSpeed(UnitsConverter.knotsFromMph(buf.readUnsignedByte()));
|
||||
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedByte() / 10.0);
|
||||
position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte());
|
||||
|
||||
dateBuilder.setSecond(buf.readUnsignedByte());
|
||||
|
||||
@@ -59,7 +59,7 @@ public class OkoProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (value.contains(".")) {
|
||||
return Double.parseDouble(value);
|
||||
} else {
|
||||
return Integer.parseInt(value, 16) * 0.1;
|
||||
return Integer.parseInt(value, 16) / 10.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public class OmnicommProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (message.hasGeneral()) {
|
||||
OmnicommMessageOuterClass.OmnicommMessage.General data = message.getGeneral();
|
||||
position.set(Position.KEY_POWER, data.getUboard() * 0.1);
|
||||
position.set(Position.KEY_POWER, data.getUboard() / 10.0);
|
||||
position.set(Position.KEY_BATTERY_LEVEL, data.getBatLife());
|
||||
position.set(Position.KEY_IGNITION, BitUtil.check(data.getFLG(), 0));
|
||||
position.set(Position.KEY_RPM, data.getTImp());
|
||||
@@ -124,11 +124,11 @@ public class OmnicommProtocolDecoder extends BaseProtocolDecoder {
|
||||
OmnicommMessageOuterClass.OmnicommMessage.NAV data = message.getNAV();
|
||||
position.setValid(true);
|
||||
position.setTime(new Date((data.getGPSTime() + 1230768000) * 1000L)); // from 2009-01-01 12:00
|
||||
position.setLatitude(data.getLAT() * 0.0000001);
|
||||
position.setLongitude(data.getLON() * 0.0000001);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(data.getGPSVel() * 0.1));
|
||||
position.setLatitude(data.getLAT() / 10000000.0);
|
||||
position.setLongitude(data.getLON() / 10000000.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(data.getGPSVel() / 10.0));
|
||||
position.setCourse(data.getGPSDir());
|
||||
position.setAltitude(data.getGPSAlt() * 0.1);
|
||||
position.setAltitude(data.getGPSAlt() / 10.0);
|
||||
position.set(Position.KEY_SATELLITES, data.getGPSNSat());
|
||||
}
|
||||
|
||||
|
||||
@@ -80,13 +80,13 @@ public class PacificTrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setLongitude(buf.readUnsignedInt() / 1000000.0 - 180.0);
|
||||
int speedAndCourse = buf.readUnsignedMedium();
|
||||
position.setCourse(BitUtil.from(speedAndCourse, 12));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BitUtil.to(speedAndCourse, 12) * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BitUtil.to(speedAndCourse, 12) / 10.0));
|
||||
position.set(Position.KEY_INDEX, buf.readUnsignedShort());
|
||||
break;
|
||||
case 0x20:
|
||||
int voltage = buf.readUnsignedMedium();
|
||||
position.set(Position.KEY_BATTERY, BitUtil.between(voltage, 0, 12) * 0.01);
|
||||
position.set(Position.KEY_POWER, BitUtil.between(voltage, 12, 24) * 0.01);
|
||||
position.set(Position.KEY_BATTERY, BitUtil.between(voltage, 0, 12) / 100.0);
|
||||
position.set(Position.KEY_POWER, BitUtil.between(voltage, 12, 24) / 100.0);
|
||||
break;
|
||||
case 0x92:
|
||||
while (buf.readerIndex() < segmentEnd) {
|
||||
|
||||
@@ -150,11 +150,11 @@ public class PiligrimProtocolDecoder extends BaseHttpProtocolDecoder {
|
||||
if (type == MSG_GPS_SENSORS) {
|
||||
double power = buf.readUnsignedByte();
|
||||
power += buf.readUnsignedByte() << 8;
|
||||
position.set(Position.KEY_POWER, power * 0.01);
|
||||
position.set(Position.KEY_POWER, power / 100.0);
|
||||
|
||||
double battery = buf.readUnsignedByte();
|
||||
battery += buf.readUnsignedByte() << 8;
|
||||
position.set(Position.KEY_BATTERY, battery * 0.01);
|
||||
position.set(Position.KEY_BATTERY, battery / 100.0);
|
||||
|
||||
buf.skipBytes(6);
|
||||
}
|
||||
|
||||
@@ -118,8 +118,8 @@ public class PluginProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.PREFIX_TEMP + 2, parser.nextDouble());
|
||||
position.set(Position.KEY_RPM, parser.nextInt());
|
||||
position.set(Position.KEY_OBD_SPEED, parser.nextInt());
|
||||
position.set(Position.KEY_THROTTLE, parser.nextInt() * 0.1);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.1);
|
||||
position.set(Position.KEY_THROTTLE, parser.nextInt() / 10.0);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 10.0);
|
||||
}
|
||||
|
||||
if (parser.hasNext()) {
|
||||
|
||||
@@ -91,7 +91,7 @@ public class PortmanProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.PREFIX_TEMP + 1, parser.next());
|
||||
position.set(Position.KEY_STATUS, parser.nextHexLong());
|
||||
if (parser.hasNext()) {
|
||||
position.set(Position.KEY_FUEL, parser.nextInt() * 0.1);
|
||||
position.set(Position.KEY_FUEL, parser.nextInt() / 10.0);
|
||||
}
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
|
||||
|
||||
|
||||
@@ -89,8 +89,8 @@ public class PositrexProtocolDecoder extends BaseProtocolDecoder {
|
||||
int longitude = buf.readMedium();
|
||||
|
||||
position.setValid(BitUtil.check(latitude, 23));
|
||||
position.setLatitude(BitUtil.to(latitude, 23) * 0.000025);
|
||||
position.setLongitude(longitude * 0.000025);
|
||||
position.setLatitude(BitUtil.to(latitude, 23) / 40000.0);
|
||||
position.setLongitude(longitude / 40000.0);
|
||||
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
|
||||
position.setCourse(buf.readUnsignedByte() * 2);
|
||||
@@ -102,8 +102,8 @@ public class PositrexProtocolDecoder extends BaseProtocolDecoder {
|
||||
buf.readUnsignedInt(); // number of records
|
||||
|
||||
if (buf.isReadable()) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0);
|
||||
}
|
||||
|
||||
return position;
|
||||
|
||||
@@ -100,10 +100,10 @@ public class PretraceProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (value.charAt(4) == '%') {
|
||||
position.set(Position.KEY_BATTERY_LEVEL, Integer.parseInt(value.substring(2, 4)));
|
||||
} else {
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(value.substring(2), 16) * 0.01);
|
||||
position.set(Position.KEY_BATTERY, Integer.parseInt(value.substring(2), 16) / 100.0);
|
||||
}
|
||||
} else {
|
||||
position.set(Position.KEY_POWER, Integer.parseInt(value.substring(2), 16) * 0.01);
|
||||
position.set(Position.KEY_POWER, Integer.parseInt(value.substring(2), 16) / 100.0);
|
||||
}
|
||||
break;
|
||||
case 'T':
|
||||
@@ -115,7 +115,9 @@ public class PretraceProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
position.set("fuel" + (value.charAt(1) - '0'), Integer.parseInt(value.substring(2), 16) * 0.01);
|
||||
position.set(
|
||||
"fuel" + (value.charAt(1) - '0'),
|
||||
Integer.parseInt(value.substring(2), 16) / 100.0);
|
||||
break;
|
||||
case 'R':
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, value.substring(3));
|
||||
|
||||
@@ -120,9 +120,9 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setTime(new Date(buf.readUnsignedIntLE() * 1000));
|
||||
position.setLatitude(buf.readIntLE() * 180.0 / 0x7FFFFFFF);
|
||||
position.setLongitude(buf.readIntLE() * 180.0 / 0x7FFFFFFF);
|
||||
position.setSpeed(buf.readUnsignedIntLE() * 0.01);
|
||||
position.setCourse(buf.readUnsignedShortLE() * 0.01);
|
||||
position.setAltitude(buf.readUnsignedShortLE() * 0.01);
|
||||
position.setSpeed(buf.readUnsignedIntLE() / 100.0);
|
||||
position.setCourse(buf.readUnsignedShortLE() / 100.0);
|
||||
position.setAltitude(buf.readUnsignedShortLE() / 100.0);
|
||||
|
||||
int satellites = buf.readUnsignedByte();
|
||||
position.setValid(satellites >= 3);
|
||||
|
||||
@@ -144,8 +144,8 @@ public class RaceDynamicsProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_IGNITION, parser.nextInt() == 1);
|
||||
position.set(Position.KEY_INDEX, parser.nextInt());
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 100.0);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 100.0);
|
||||
position.addAlarm(parser.nextInt() > 0 ? Position.ALARM_SOS : null);
|
||||
position.addAlarm(parser.nextInt() > 0 ? Position.ALARM_OVERSPEED : null);
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class RadarProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
|
||||
}
|
||||
if (mask.get(5)) {
|
||||
position.setCourse(buf.readUnsignedShort() * 0.1);
|
||||
position.setCourse(buf.readUnsignedShort() / 10.0);
|
||||
}
|
||||
if (mask.get(6)) {
|
||||
position.setAltitude(buf.readShort());
|
||||
|
||||
@@ -67,7 +67,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.set("mode", buf.readUnsignedByte());
|
||||
position.set(Position.KEY_COMMAND, buf.readUnsignedByte());
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 1000.0);
|
||||
|
||||
buf.skipBytes(5); // status
|
||||
buf.readUnsignedShortLE(); // idleCount
|
||||
|
||||
@@ -84,8 +84,8 @@ public class RoboTrackProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setValid(true);
|
||||
position.setFixTime(position.getDeviceTime());
|
||||
position.setLatitude(buf.readIntLE() * 0.000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.000001);
|
||||
position.setLatitude(buf.readIntLE() / 1000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 1000000.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readByte()));
|
||||
|
||||
} else {
|
||||
|
||||
@@ -107,14 +107,14 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 21 -> position.set(Position.PREFIX_ADC + 4, readValue(buf, length, false));
|
||||
case 22 -> position.set(Position.PREFIX_ADC + 1, readValue(buf, length, false));
|
||||
case 23 -> position.set(Position.PREFIX_ADC + 2, readValue(buf, length, false));
|
||||
case 29 -> position.set(Position.KEY_POWER, readValue(buf, length, false) * 0.001);
|
||||
case 30 -> position.set(Position.KEY_BATTERY, readValue(buf, length, false) * 0.001);
|
||||
case 29 -> position.set(Position.KEY_POWER, readValue(buf, length, false) / 1000.0);
|
||||
case 30 -> position.set(Position.KEY_BATTERY, readValue(buf, length, false) / 1000.0);
|
||||
case 32 -> position.set(Position.KEY_DEVICE_TEMP, readValue(buf, length, true));
|
||||
case 34 -> position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(length)));
|
||||
case 39 -> position.set(Position.KEY_ENGINE_LOAD, readValue(buf, length, false));
|
||||
case 65 -> position.set(Position.KEY_ODOMETER, readValue(buf, length, false));
|
||||
case 74 -> position.set(Position.PREFIX_TEMP + 3, readValue(buf, length, true) * 0.1);
|
||||
case 78, 79, 80 -> position.set(Position.PREFIX_TEMP + (id - 78), readValue(buf, length, true) * 0.1);
|
||||
case 74 -> position.set(Position.PREFIX_TEMP + 3, readValue(buf, length, true) / 10.0);
|
||||
case 78, 79, 80 -> position.set(Position.PREFIX_TEMP + (id - 78), readValue(buf, length, true) / 10.0);
|
||||
case 88 -> {
|
||||
if (readValue(buf, length, false) > 0) {
|
||||
position.addAlarm(Position.ALARM_JAMMING);
|
||||
|
||||
@@ -67,9 +67,9 @@ public class SatsolProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setDeviceId(deviceSession.getDeviceId());
|
||||
|
||||
position.setTime(new Date(buf.readUnsignedIntLE() * 1000));
|
||||
position.setLatitude(buf.readUnsignedIntLE() * 0.000001);
|
||||
position.setLongitude(buf.readUnsignedIntLE() * 0.000001);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE() * 0.01));
|
||||
position.setLatitude(buf.readUnsignedIntLE() / 1000000.0);
|
||||
position.setLongitude(buf.readUnsignedIntLE() / 1000000.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE() / 100.0));
|
||||
position.setAltitude(buf.readShortLE());
|
||||
position.setCourse(buf.readUnsignedShortLE());
|
||||
position.setValid(buf.readUnsignedByte() > 0);
|
||||
|
||||
@@ -159,7 +159,7 @@ public class SigfoxProtocolDecoder extends BaseHttpProtocolDecoder {
|
||||
int flags = buf.readUnsignedByte();
|
||||
position.set(Position.KEY_MOTION, BitUtil.check(flags, 1));
|
||||
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.02);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedByte() / 50.0);
|
||||
position.set(Position.PREFIX_TEMP + 1, (int) buf.readByte());
|
||||
|
||||
position.setValid(true);
|
||||
@@ -169,8 +169,8 @@ public class SigfoxProtocolDecoder extends BaseHttpProtocolDecoder {
|
||||
} else if (header == 0x0f || header == 0x1f) {
|
||||
|
||||
position.setValid(header >> 4 > 0);
|
||||
position.setLatitude(BufferUtil.readSignedMagnitudeInt(buf) * 0.000001);
|
||||
position.setLongitude(BufferUtil.readSignedMagnitudeInt(buf) * 0.000001);
|
||||
position.setLatitude(BufferUtil.readSignedMagnitudeInt(buf) / 1000000.0);
|
||||
position.setLongitude(BufferUtil.readSignedMagnitudeInt(buf) / 1000000.0);
|
||||
|
||||
position.set(Position.KEY_BATTERY, (int) buf.readUnsignedByte());
|
||||
|
||||
@@ -178,12 +178,12 @@ public class SigfoxProtocolDecoder extends BaseHttpProtocolDecoder {
|
||||
|
||||
if (BitUtil.to(header, 4) == 0) {
|
||||
position.setValid(true);
|
||||
position.setLatitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLongitude(buf.readIntLE() * 0.0000001);
|
||||
position.setLatitude(buf.readIntLE() / 10000000.0);
|
||||
position.setLongitude(buf.readIntLE() / 10000000.0);
|
||||
position.setCourse(buf.readUnsignedByte() * 2);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
|
||||
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.025);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedByte() / 40.0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public class SigfoxProtocolDecoder extends BaseHttpProtocolDecoder {
|
||||
position.setLongitude(buf.readFloat());
|
||||
}
|
||||
case 0x03 -> position.set(Position.PREFIX_TEMP + 1, buf.readByte() * 0.5);
|
||||
case 0x04 -> position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.1);
|
||||
case 0x04 -> position.set(Position.KEY_BATTERY, buf.readUnsignedByte() / 10.0);
|
||||
case 0x05 -> position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
|
||||
case 0x06 -> {
|
||||
String mac = ByteBufUtil.hexDump(buf.readSlice(6)).replaceAll("(..)", "$1:");
|
||||
|
||||
@@ -103,8 +103,8 @@ public class SiwiProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY, "IST"));
|
||||
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 1000.0);
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextInt() / 100.0);
|
||||
position.set(Position.KEY_INPUT, parser.nextInt());
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
|
||||
@@ -173,7 +173,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
|
||||
if (BitUtil.check(mask, 24)) {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0);
|
||||
}
|
||||
|
||||
if (BitUtil.check(mask, 25)) {
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SnapperProtocolDecoder extends BaseProtocolDecoder {
|
||||
int type = buf.readUnsignedByte();
|
||||
switch (type) {
|
||||
case 0x00 -> {
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedByte() * 0.1);
|
||||
position.set(Position.KEY_POWER, buf.readUnsignedByte() / 10.0);
|
||||
position.set(Position.KEY_DEVICE_TEMP, buf.readByte());
|
||||
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
|
||||
}
|
||||
|
||||
@@ -68,11 +68,11 @@ public class SolarPoweredProtocolDecoder extends BaseProtocolDecoder {
|
||||
.setDate(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte())
|
||||
.setTime(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte());
|
||||
position.setTime(dateBuilder.getDate());
|
||||
position.setLatitude(buf.readUnsignedInt() * 0.000001);
|
||||
position.setLatitude(buf.readUnsignedInt() / 1000000.0);
|
||||
if (BitUtil.check(status, 3)) {
|
||||
position.setLatitude(-position.getLatitude());
|
||||
}
|
||||
position.setLongitude(buf.readUnsignedInt() * 0.000001);
|
||||
position.setLongitude(buf.readUnsignedInt() / 1000000.0);
|
||||
if (BitUtil.check(status, 2)) {
|
||||
position.setLongitude(-position.getLongitude());
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class SolarPoweredProtocolDecoder extends BaseProtocolDecoder {
|
||||
} else {
|
||||
position.set(Position.KEY_DEVICE_TEMP, BitUtil.to(temperature, 7));
|
||||
}
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.02);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedByte() / 50.0);
|
||||
position.setCourse(buf.readUnsignedByte());
|
||||
break;
|
||||
case 0x82:
|
||||
|
||||
@@ -210,9 +210,9 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
|
||||
StarLinkMessage.mEventReport_TDx message =
|
||||
StarLinkMessage.mEventReport_TDx.parseFrom(DataConverter.parseBase64(data[i]));
|
||||
position.set("sensor" + message.getSensorNumber() + "Id", message.getSensorID());
|
||||
position.set("sensor" + message.getSensorNumber() + "Temp", message.getTemperature() * 0.1);
|
||||
position.set("sensor" + message.getSensorNumber() + "Humidity", message.getTemperature() * 0.1);
|
||||
position.set("sensor" + message.getSensorNumber() + "Voltage", message.getVoltage() * 0.001);
|
||||
position.set("sensor" + message.getSensorNumber() + "Temp", message.getTemperature() / 10.0);
|
||||
position.set("sensor" + message.getSensorNumber() + "Humidity", message.getTemperature() / 10.0);
|
||||
position.set("sensor" + message.getSensorNumber() + "Voltage", message.getVoltage() / 1000.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,13 +187,13 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_INPUT, input);
|
||||
position.set(Position.KEY_OUTPUT, output);
|
||||
|
||||
position.set(Position.KEY_POWER, parser.nextHexInt() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextHexInt() * 0.01);
|
||||
position.set(Position.KEY_POWER, parser.nextHexInt() / 100.0);
|
||||
position.set(Position.KEY_BATTERY, parser.nextHexInt() / 100.0);
|
||||
|
||||
if (parser.hasNext()) {
|
||||
String[] adc = parser.next().split("\\|");
|
||||
for (int i = 1; i < adc.length; i++) {
|
||||
position.set(Position.PREFIX_ADC + (i + 1), Integer.parseInt(adc[i], 16) * 0.01);
|
||||
position.set(Position.PREFIX_ADC + (i + 1), Integer.parseInt(adc[i], 16) / 100.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
|
||||
for (String fuel : fuels) {
|
||||
int index = Integer.parseInt(fuel.substring(0, 2));
|
||||
int value = Integer.parseInt(fuel.substring(2), 16);
|
||||
position.set("fuel" + index, value * 0.1);
|
||||
position.set("fuel" + index, value / 10.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (BitUtil.check(value, 15)) {
|
||||
convertedValue = -convertedValue;
|
||||
}
|
||||
position.set(Position.PREFIX_TEMP + index, convertedValue * 0.1);
|
||||
position.set(Position.PREFIX_TEMP + index, convertedValue / 10.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_COOLANT_TEMP, parser.nextInt() - 40);
|
||||
}
|
||||
if (parser.hasNext()) {
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextInt() * 0.1);
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextInt() / 10.0);
|
||||
}
|
||||
position.set(Position.KEY_FUEL, parser.nextInt());
|
||||
}
|
||||
|
||||
@@ -894,10 +894,10 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.setValid(true);
|
||||
position.setTime(time);
|
||||
position.setLatitude(crash.readIntLE() * 0.0000001);
|
||||
position.setLongitude(crash.readIntLE() * 0.0000001);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(crash.readUnsignedShort() * 0.01));
|
||||
position.setCourse(crash.readUnsignedShort() * 0.01);
|
||||
position.setLatitude(crash.readIntLE() / 10000000.0);
|
||||
position.setLongitude(crash.readIntLE() / 10000000.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(crash.readUnsignedShort() / 100.0));
|
||||
position.setCourse(crash.readUnsignedShort() / 100.0);
|
||||
|
||||
StringBuilder value = new StringBuilder("[");
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
||||
@@ -83,8 +83,8 @@ public class SviasProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
|
||||
position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN_MIN));
|
||||
position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN_MIN));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble() * 0.01));
|
||||
position.setCourse(parser.nextDouble() * 0.01);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble() / 100.0));
|
||||
position.setCourse(parser.nextDouble() / 100.0);
|
||||
|
||||
position.set(Position.KEY_ODOMETER, parser.nextInt() * 100);
|
||||
|
||||
@@ -95,7 +95,7 @@ public class SviasProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_IGNITION, BitUtil.check(input, 4));
|
||||
position.setValid(BitUtil.check(output, 0));
|
||||
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.001);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 1000.0);
|
||||
position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt());
|
||||
position.set(Position.KEY_RSSI, parser.nextInt());
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ public class SwiftechProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
position.set(Position.KEY_CHARGE, parser.nextInt() > 0);
|
||||
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextInt() * 0.001);
|
||||
position.set(Position.PREFIX_ADC + 2, parser.nextInt() * 0.001);
|
||||
position.set(Position.PREFIX_ADC + 1, parser.nextInt() / 1000.0);
|
||||
position.set(Position.PREFIX_ADC + 2, parser.nextInt() / 1000.0);
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
@@ -92,14 +92,14 @@ public class T622IridiumProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 0x07 -> position.set(Position.KEY_RSSI, buf.readUnsignedByte());
|
||||
case 0x08 -> position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE()));
|
||||
case 0x09 -> position.setCourse(buf.readUnsignedShortLE());
|
||||
case 0x0A -> position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
|
||||
case 0x0A -> position.set(Position.KEY_HDOP, buf.readUnsignedByte() / 10.0);
|
||||
case 0x0B -> position.setAltitude(buf.readShortLE());
|
||||
case 0x0C -> position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());
|
||||
case 0x0D -> position.set(Position.KEY_HOURS, buf.readUnsignedIntLE() * 1000);
|
||||
case 0x14 -> position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
|
||||
case 0x15 -> position.set(Position.KEY_INPUT, buf.readUnsignedByte());
|
||||
case 0x19 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.01);
|
||||
case 0x1A -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.01);
|
||||
case 0x19 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 100.0);
|
||||
case 0x1A -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() / 100.0);
|
||||
case 0x1B -> buf.readUnsignedByte(); // geofence
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setAltitude(buf.readFloatLE());
|
||||
position.setLongitude(buf.readFloatLE());
|
||||
position.setLatitude(buf.readFloatLE());
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BcdUtil.readInteger(buf, 4) * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BcdUtil.readInteger(buf, 4) / 10.0));
|
||||
position.setCourse(buf.readUnsignedShort());
|
||||
|
||||
position.set(Position.KEY_RPM, buf.readUnsignedShort());
|
||||
@@ -228,7 +228,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
private double decodeBleTemp(ByteBuf buf) {
|
||||
int value = buf.readUnsignedShort();
|
||||
return (BitUtil.check(value, 15) ? -BitUtil.to(value, 15) : BitUtil.to(value, 15)) * 0.01;
|
||||
return (BitUtil.check(value, 15) ? -BitUtil.to(value, 15) : BitUtil.to(value, 15)) / 100.0;
|
||||
}
|
||||
|
||||
private Position decodeBle(
|
||||
@@ -246,14 +246,14 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
switch (buf.readUnsignedShort()) {
|
||||
case 0x01 -> {
|
||||
position.set("tag" + i + "Id", ByteBufUtil.hexDump(buf.readSlice(6)));
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedByte() * 0.01 + 1.22);
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedByte() / 100.0 + 1.22);
|
||||
position.set("tag" + i + "TirePressure", buf.readUnsignedByte() * 1.527 * 2);
|
||||
position.set("tag" + i + "TireTemp", buf.readUnsignedByte() - 55);
|
||||
position.set("tag" + i + "TireStatus", buf.readUnsignedByte());
|
||||
}
|
||||
case 0x02 -> {
|
||||
position.set("tag" + i + "Id", ByteBufUtil.hexDump(buf.readSlice(6)));
|
||||
position.set("tag" + i + "Battery", BcdUtil.readInteger(buf, 2) * 0.1);
|
||||
position.set("tag" + i + "Battery", BcdUtil.readInteger(buf, 2) / 10.0);
|
||||
switch (buf.readUnsignedByte()) {
|
||||
case 0:
|
||||
position.addAlarm(Position.ALARM_SOS);
|
||||
@@ -269,7 +269,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
case 0x03 -> {
|
||||
position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(6)));
|
||||
position.set("tag" + i + "Battery", BcdUtil.readInteger(buf, 2) * 0.1);
|
||||
position.set("tag" + i + "Battery", BcdUtil.readInteger(buf, 2) / 10.0);
|
||||
if (buf.readUnsignedByte() == 1) {
|
||||
position.addAlarm(Position.ALARM_LOW_BATTERY);
|
||||
}
|
||||
@@ -278,16 +278,16 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
case 0x04 -> {
|
||||
position.set("tag" + i + "Id", ByteBufUtil.hexDump(buf.readSlice(6)));
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedByte() * 0.01 + 2);
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedByte() / 100.0 + 2);
|
||||
buf.readUnsignedByte(); // battery level
|
||||
position.set("tag" + i + "Temp", decodeBleTemp(buf));
|
||||
position.set("tag" + i + "Humidity", buf.readUnsignedShort() * 0.01);
|
||||
position.set("tag" + i + "Humidity", buf.readUnsignedShort() / 100.0);
|
||||
position.set("tag" + i + "LightSensor", buf.readUnsignedShort());
|
||||
position.set("tag" + i + "Rssi", buf.readUnsignedByte() - 128);
|
||||
}
|
||||
case 0x05 -> {
|
||||
position.set("tag" + i + "Id", ByteBufUtil.hexDump(buf.readSlice(6)));
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedByte() * 0.01 + 2);
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedByte() / 100.0 + 2);
|
||||
buf.readUnsignedByte(); // battery level
|
||||
position.set("tag" + i + "Temp", decodeBleTemp(buf));
|
||||
position.set("tag" + i + "Door", buf.readUnsignedByte() > 0);
|
||||
@@ -295,7 +295,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
case 0x06 -> {
|
||||
position.set("tag" + i + "Id", ByteBufUtil.hexDump(buf.readSlice(6)));
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedByte() * 0.01 + 2);
|
||||
position.set("tag" + i + "Battery", buf.readUnsignedByte() / 100.0 + 2);
|
||||
position.set("tag" + i + "Output", buf.readUnsignedByte() > 0);
|
||||
position.set("tag" + i + "Rssi", buf.readUnsignedByte() - 128);
|
||||
}
|
||||
@@ -358,7 +358,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
for (int i = 1; i <= adcCount; i++) {
|
||||
String value = ByteBufUtil.hexDump(buf.readSlice(2));
|
||||
if (!value.equals("ffff")) {
|
||||
position.set(Position.PREFIX_ADC + i, Integer.parseInt(value, 16) * 0.01);
|
||||
position.set(Position.PREFIX_ADC + i, Integer.parseInt(value, 16) / 100.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -390,7 +390,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
if (header == 0x2626) {
|
||||
buf.readUnsignedShort(); // reserved or hdop
|
||||
} else {
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BcdUtil.readInteger(buf, 4) * 0.1));
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BcdUtil.readInteger(buf, 4) / 10.0));
|
||||
}
|
||||
position.setCourse(buf.readUnsignedShort());
|
||||
|
||||
@@ -417,15 +417,15 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
byte[] accelerationBytes = new byte[5];
|
||||
buf.readBytes(accelerationBytes);
|
||||
long acceleration = new BigInteger(accelerationBytes).longValue();
|
||||
double accelerationZ = BitUtil.between(acceleration, 8, 15) + BitUtil.between(acceleration, 4, 8) * 0.1;
|
||||
double accelerationZ = BitUtil.between(acceleration, 8, 15) + BitUtil.between(acceleration, 4, 8) / 10.0;
|
||||
if (!BitUtil.check(acceleration, 15)) {
|
||||
accelerationZ = -accelerationZ;
|
||||
}
|
||||
double accelerationY = BitUtil.between(acceleration, 20, 27) + BitUtil.between(acceleration, 16, 20) * 0.1;
|
||||
double accelerationY = BitUtil.between(acceleration, 20, 27) + BitUtil.between(acceleration, 16, 20) / 10.0;
|
||||
if (!BitUtil.check(acceleration, 27)) {
|
||||
accelerationY = -accelerationY;
|
||||
}
|
||||
double accelerationX = BitUtil.between(acceleration, 28, 32) + BitUtil.between(acceleration, 32, 39) * 0.1;
|
||||
double accelerationX = BitUtil.between(acceleration, 28, 32) + BitUtil.between(acceleration, 32, 39) / 10.0;
|
||||
if (!BitUtil.check(acceleration, 39)) {
|
||||
accelerationX = -accelerationX;
|
||||
}
|
||||
@@ -434,9 +434,9 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
int battery = BcdUtil.readInteger(buf, 2);
|
||||
position.set(Position.KEY_BATTERY_LEVEL, battery > 0 ? battery : 100);
|
||||
position.set(Position.KEY_DEVICE_TEMP, (int) buf.readByte());
|
||||
position.set("lightSensor", BcdUtil.readInteger(buf, 2) * 0.1);
|
||||
position.set(Position.KEY_BATTERY, BcdUtil.readInteger(buf, 2) * 0.1);
|
||||
position.set("solarPanel", BcdUtil.readInteger(buf, 2) * 0.1);
|
||||
position.set("lightSensor", BcdUtil.readInteger(buf, 2) / 10.0);
|
||||
position.set(Position.KEY_BATTERY, BcdUtil.readInteger(buf, 2) / 10.0);
|
||||
position.set("solarPanel", BcdUtil.readInteger(buf, 2) / 10.0);
|
||||
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
|
||||
|
||||
int inputStatus = buf.readUnsignedShort();
|
||||
@@ -461,9 +461,9 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
if (buf.readableBytes() >= 19) {
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(BcdUtil.readInteger(buf, 4) / 10.0));
|
||||
position.set(Position.KEY_OBD_SPEED, BcdUtil.readInteger(buf, 4) * 0.01);
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() * 0.001);
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt() * 0.001);
|
||||
position.set(Position.KEY_OBD_SPEED, BcdUtil.readInteger(buf, 4) / 100.0);
|
||||
position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() / 1000.0);
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt() / 1000.0);
|
||||
position.set(Position.KEY_RPM, buf.readUnsignedShort());
|
||||
int value;
|
||||
value = buf.readUnsignedByte();
|
||||
|
||||
@@ -197,8 +197,8 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (parser.hasNext(7)) {
|
||||
position.set(Position.KEY_ODOMETER, parser.nextInt());
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() * 0.01);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 100.0);
|
||||
position.set(Position.KEY_BATTERY, parser.nextInt() / 100.0);
|
||||
position.set(Position.KEY_RPM, parser.nextInt());
|
||||
position.set(Position.PREFIX_TEMP + 1, parser.nextDouble());
|
||||
position.set(Position.PREFIX_TEMP + 2, parser.nextDouble());
|
||||
@@ -222,8 +222,8 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_RSSI, parser.nextInt());
|
||||
}
|
||||
if (parser.hasNext(2)) {
|
||||
position.set(Position.PREFIX_TEMP + 1, parser.nextInt() * 0.01);
|
||||
position.set(Position.PREFIX_TEMP + 2, parser.nextInt() * 0.01);
|
||||
position.set(Position.PREFIX_TEMP + 1, parser.nextInt() / 100.0);
|
||||
position.set(Position.PREFIX_TEMP + 2, parser.nextInt() / 100.0);
|
||||
}
|
||||
|
||||
position.setValid(valid == null || valid);
|
||||
@@ -284,7 +284,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
|
||||
case "ix" -> position.set(Position.PREFIX_IO + 1, value);
|
||||
case "ad" -> position.set(Position.PREFIX_ADC + 1, Integer.parseInt(value));
|
||||
case "sv" -> position.set(Position.KEY_SATELLITES, Integer.parseInt(value));
|
||||
case "bl" -> position.set(Position.KEY_BATTERY, Integer.parseInt(value) * 0.001);
|
||||
case "bl" -> position.set(Position.KEY_BATTERY, Integer.parseInt(value) / 1000.0);
|
||||
case "vo" -> position.set(Position.KEY_ODOMETER, Long.parseLong(value));
|
||||
default -> position.set(key, value);
|
||||
}
|
||||
|
||||
@@ -201,34 +201,34 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
|
||||
register(2, any, (p, b) -> p.set(Position.PREFIX_IN + 2, b.readUnsignedByte() > 0));
|
||||
register(3, any, (p, b) -> p.set(Position.PREFIX_IN + 3, b.readUnsignedByte() > 0));
|
||||
register(4, any, (p, b) -> p.set(Position.PREFIX_IN + 4, b.readUnsignedByte() > 0));
|
||||
register(9, fmbXXX, (p, b) -> p.set(Position.PREFIX_ADC + 1, b.readUnsignedShort() * 0.001));
|
||||
register(10, fmbXXX, (p, b) -> p.set(Position.PREFIX_ADC + 2, b.readUnsignedShort() * 0.001));
|
||||
register(9, fmbXXX, (p, b) -> p.set(Position.PREFIX_ADC + 1, b.readUnsignedShort() / 1000.0));
|
||||
register(10, fmbXXX, (p, b) -> p.set(Position.PREFIX_ADC + 2, b.readUnsignedShort() / 1000.0));
|
||||
register(11, fmbXXX, (p, b) -> p.set(Position.KEY_ICCID, String.valueOf(b.readLong())));
|
||||
register(12, fmbXXX, (p, b) -> p.set(Position.KEY_FUEL_USED, b.readUnsignedInt() * 0.001));
|
||||
register(13, fmbXXX, (p, b) -> p.set(Position.KEY_FUEL_CONSUMPTION, b.readUnsignedShort() * 0.01));
|
||||
register(12, fmbXXX, (p, b) -> p.set(Position.KEY_FUEL_USED, b.readUnsignedInt() / 1000.0));
|
||||
register(13, fmbXXX, (p, b) -> p.set(Position.KEY_FUEL_CONSUMPTION, b.readUnsignedShort() / 100.0));
|
||||
register(16, any, (p, b) -> p.set(Position.KEY_ODOMETER, b.readUnsignedInt()));
|
||||
register(17, any, (p, b) -> p.set("axisX", b.readShort()));
|
||||
register(18, any, (p, b) -> p.set("axisY", b.readShort()));
|
||||
register(19, any, (p, b) -> p.set("axisZ", b.readShort()));
|
||||
register(21, any, (p, b) -> p.set(Position.KEY_RSSI, b.readUnsignedByte()));
|
||||
register(24, fmbXXX, (p, b) -> p.setSpeed(UnitsConverter.knotsFromKph(b.readUnsignedShort())));
|
||||
register(25, any, (p, b) -> p.set("bleTemp1", b.readShort() * 0.01));
|
||||
register(26, any, (p, b) -> p.set("bleTemp2", b.readShort() * 0.01));
|
||||
register(27, any, (p, b) -> p.set("bleTemp3", b.readShort() * 0.01));
|
||||
register(28, any, (p, b) -> p.set("bleTemp4", b.readShort() * 0.01));
|
||||
register(25, any, (p, b) -> p.set("bleTemp1", b.readShort() / 100.0));
|
||||
register(26, any, (p, b) -> p.set("bleTemp2", b.readShort() / 100.0));
|
||||
register(27, any, (p, b) -> p.set("bleTemp3", b.readShort() / 100.0));
|
||||
register(28, any, (p, b) -> p.set("bleTemp4", b.readShort() / 100.0));
|
||||
register(30, fmbXXX, (p, b) -> p.set("faultCount", b.readUnsignedByte()));
|
||||
register(31, fmbXXX, (p, b) -> p.set(Position.KEY_ENGINE_LOAD, b.readUnsignedByte()));
|
||||
register(32, fmbXXX, (p, b) -> p.set(Position.KEY_COOLANT_TEMP, b.readByte()));
|
||||
register(36, fmbXXX, (p, b) -> p.set(Position.KEY_RPM, b.readUnsignedShort()));
|
||||
register(43, fmbXXX, (p, b) -> p.set("milDistance", b.readUnsignedShort()));
|
||||
register(57, fmbXXX, (p, b) -> p.set("hybridBatteryLevel", b.readByte()));
|
||||
register(66, any, (p, b) -> p.set(Position.KEY_POWER, b.readUnsignedShort() * 0.001));
|
||||
register(67, any, (p, b) -> p.set(Position.KEY_BATTERY, b.readUnsignedShort() * 0.001));
|
||||
register(68, fmbXXX, (p, b) -> p.set("batteryCurrent", b.readUnsignedShort() * 0.001));
|
||||
register(72, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 1, b.readInt() * 0.1));
|
||||
register(73, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 2, b.readInt() * 0.1));
|
||||
register(74, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 3, b.readInt() * 0.1));
|
||||
register(75, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 4, b.readInt() * 0.1));
|
||||
register(66, any, (p, b) -> p.set(Position.KEY_POWER, b.readUnsignedShort() / 1000.0));
|
||||
register(67, any, (p, b) -> p.set(Position.KEY_BATTERY, b.readUnsignedShort() / 1000.0));
|
||||
register(68, fmbXXX, (p, b) -> p.set("batteryCurrent", b.readUnsignedShort() / 1000.0));
|
||||
register(72, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 1, b.readInt() / 10.0));
|
||||
register(73, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 2, b.readInt() / 10.0));
|
||||
register(74, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 3, b.readInt() / 10.0));
|
||||
register(75, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 4, b.readInt() / 10.0));
|
||||
register(78, any, (p, b) -> {
|
||||
long driverUniqueId = b.readLongLE();
|
||||
if (driverUniqueId != 0) {
|
||||
@@ -238,25 +238,25 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
|
||||
register(80, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set("dataMode", b.readUnsignedByte()));
|
||||
register(81, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set(Position.KEY_OBD_SPEED, b.readUnsignedByte()));
|
||||
register(82, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set(Position.KEY_THROTTLE, b.readUnsignedByte()));
|
||||
register(83, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set(Position.KEY_FUEL_USED, b.readUnsignedInt() * 0.1));
|
||||
register(84, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set(Position.KEY_FUEL, b.readUnsignedShort() * 0.1));
|
||||
register(83, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set(Position.KEY_FUEL_USED, b.readUnsignedInt() / 10.0));
|
||||
register(84, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set(Position.KEY_FUEL, b.readUnsignedShort() / 10.0));
|
||||
register(85, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set(Position.KEY_RPM, b.readUnsignedShort()));
|
||||
register(87, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set(Position.KEY_OBD_ODOMETER, b.readUnsignedInt()));
|
||||
register(89, fmbXXX.and(fmb6XX.negate()), (p, b) -> p.set(Position.KEY_FUEL_LEVEL, b.readUnsignedByte()));
|
||||
register(107, fmbXXX, (p, b) -> p.set(Position.KEY_FUEL_USED, b.readUnsignedInt() * 0.1));
|
||||
register(110, fmbXXX, (p, b) -> p.set(Position.KEY_FUEL_CONSUMPTION, b.readUnsignedShort() * 0.1));
|
||||
register(107, fmbXXX, (p, b) -> p.set(Position.KEY_FUEL_USED, b.readUnsignedInt() / 10.0));
|
||||
register(110, fmbXXX, (p, b) -> p.set(Position.KEY_FUEL_CONSUMPTION, b.readUnsignedShort() / 10.0));
|
||||
register(113, fmbXXX, (p, b) -> p.set(Position.KEY_BATTERY_LEVEL, b.readUnsignedByte()));
|
||||
register(115, fmbXXX, (p, b) -> p.set(Position.KEY_ENGINE_TEMP, b.readShort() * 0.1));
|
||||
register(115, fmbXXX, (p, b) -> p.set(Position.KEY_ENGINE_TEMP, b.readShort() / 10.0));
|
||||
register(389, (m) -> "FMB003".equals(m),
|
||||
(p, b) -> p.set(Position.KEY_OBD_ODOMETER, b.readUnsignedInt() * 1000));
|
||||
register(701, fmb6XX, (p, b) -> p.set("bleTemp1", b.readShort() * 0.01));
|
||||
register(702, fmb6XX, (p, b) -> p.set("bleTemp2", b.readShort() * 0.01));
|
||||
register(703, fmb6XX, (p, b) -> p.set("bleTemp3", b.readShort() * 0.01));
|
||||
register(704, fmb6XX, (p, b) -> p.set("bleTemp4", b.readShort() * 0.01));
|
||||
register(701, fmb6XX, (p, b) -> p.set("bleTemp1", b.readShort() / 100.0));
|
||||
register(702, fmb6XX, (p, b) -> p.set("bleTemp2", b.readShort() / 100.0));
|
||||
register(703, fmb6XX, (p, b) -> p.set("bleTemp3", b.readShort() / 100.0));
|
||||
register(704, fmb6XX, (p, b) -> p.set("bleTemp4", b.readShort() / 100.0));
|
||||
register(179, any, (p, b) -> p.set(Position.PREFIX_OUT + 1, b.readUnsignedByte() > 0));
|
||||
register(180, any, (p, b) -> p.set(Position.PREFIX_OUT + 2, b.readUnsignedByte() > 0));
|
||||
register(181, any, (p, b) -> p.set(Position.KEY_PDOP, b.readUnsignedShort() * 0.1));
|
||||
register(182, any, (p, b) -> p.set(Position.KEY_HDOP, b.readUnsignedShort() * 0.1));
|
||||
register(181, any, (p, b) -> p.set(Position.KEY_PDOP, b.readUnsignedShort() / 10.0));
|
||||
register(182, any, (p, b) -> p.set(Position.KEY_HDOP, b.readUnsignedShort() / 10.0));
|
||||
register(199, any, (p, b) -> p.set(Position.KEY_ODOMETER_TRIP, b.readUnsignedInt()));
|
||||
register(200, fmbXXX, (p, b) -> p.set("sleepMode", b.readUnsignedByte()));
|
||||
register(205, fmbXXX, (p, b) -> p.set("cid2g", b.readUnsignedShort()));
|
||||
@@ -303,10 +303,10 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
|
||||
case 1 -> position.set(Position.KEY_BATTERY_LEVEL, readValue(buf, length));
|
||||
case 2 -> position.set("usbConnected", readValue(buf, length) == 1);
|
||||
case 5 -> position.set("uptime", readValue(buf, length));
|
||||
case 20 -> position.set(Position.KEY_HDOP, readValue(buf, length) * 0.1);
|
||||
case 21 -> position.set(Position.KEY_VDOP, readValue(buf, length) * 0.1);
|
||||
case 22 -> position.set(Position.KEY_PDOP, readValue(buf, length) * 0.1);
|
||||
case 67 -> position.set(Position.KEY_BATTERY, readValue(buf, length) * 0.001);
|
||||
case 20 -> position.set(Position.KEY_HDOP, readValue(buf, length) / 10.0);
|
||||
case 21 -> position.set(Position.KEY_VDOP, readValue(buf, length) / 10.0);
|
||||
case 22 -> position.set(Position.KEY_PDOP, readValue(buf, length) / 10.0);
|
||||
case 67 -> position.set(Position.KEY_BATTERY, readValue(buf, length) / 1000.0);
|
||||
case 221 -> position.set("button", readValue(buf, length));
|
||||
case 222 -> {
|
||||
if (readValue(buf, length) == 1) {
|
||||
@@ -552,7 +552,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
position.set("beacon" + index + "Rssi", (int) data.readByte());
|
||||
if (BitUtil.check(flags, 1)) {
|
||||
position.set("beacon" + index + "Battery", data.readUnsignedShort() * 0.01);
|
||||
position.set("beacon" + index + "Battery", data.readUnsignedShort() / 100.0);
|
||||
}
|
||||
if (BitUtil.check(flags, 2)) {
|
||||
position.set("beacon" + index + "Temp", data.readUnsignedShort());
|
||||
|
||||
@@ -65,10 +65,10 @@ public class ThinkPowerProtocolDecoder extends BaseProtocolDecoder {
|
||||
switch (type) {
|
||||
case 0x01 -> {
|
||||
position.setValid(true);
|
||||
position.setLatitude(BufferUtil.readSignedMagnitudeInt(buf) * 0.0000001);
|
||||
position.setLongitude(BufferUtil.readSignedMagnitudeInt(buf) * 0.0000001);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() * 0.1));
|
||||
position.setCourse(buf.readUnsignedShort() * 0.01);
|
||||
position.setLatitude(BufferUtil.readSignedMagnitudeInt(buf) / 10000000.0);
|
||||
position.setLongitude(BufferUtil.readSignedMagnitudeInt(buf) / 10000000.0);
|
||||
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() / 10.0));
|
||||
position.setCourse(buf.readUnsignedShort() / 100.0);
|
||||
}
|
||||
case 0x02 -> position.setValid(buf.readUnsignedByte() > 0);
|
||||
case 0x03 -> buf.skipBytes(3); // geofence
|
||||
@@ -80,7 +80,7 @@ public class ThinkPowerProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.addAlarm(Position.ALARM_SOS);
|
||||
}
|
||||
}
|
||||
case 0x12 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.1);
|
||||
case 0x12 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 10.0);
|
||||
case 0x13 -> {
|
||||
if (buf.readUnsignedByte() > 0) {
|
||||
position.addAlarm(Position.ALARM_LOW_BATTERY);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ThinkRaceProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
private static double convertCoordinate(long raw, boolean negative) {
|
||||
long degrees = raw / 1000000;
|
||||
double minutes = (raw % 1000000) * 0.0001;
|
||||
double minutes = (raw % 1000000) / 10000.0;
|
||||
double result = degrees + minutes / 60;
|
||||
if (negative) {
|
||||
result = -result;
|
||||
|
||||
@@ -228,12 +228,12 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
int battery = parser.nextInt(0);
|
||||
if (battery != 65535) {
|
||||
position.set(Position.KEY_BATTERY, battery * 0.01);
|
||||
position.set(Position.KEY_BATTERY, battery / 100.0);
|
||||
}
|
||||
|
||||
int power = parser.nextInt(0);
|
||||
if (power != 65535) {
|
||||
position.set(Position.KEY_POWER, power * 0.1);
|
||||
position.set(Position.KEY_POWER, power / 10.0);
|
||||
}
|
||||
|
||||
return position;
|
||||
@@ -406,13 +406,13 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
|
||||
for (int i = 1; i <= 24; i++) {
|
||||
int voltage = buf.readUnsignedShortLE();
|
||||
if (i <= batteryCount) {
|
||||
position.set("battery" + i, voltage * 0.001);
|
||||
position.set("battery" + i, voltage / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
position.set(Position.KEY_CHARGE, buf.readUnsignedByte() == 0);
|
||||
position.set("current", buf.readUnsignedShortLE() * 0.1);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.01);
|
||||
position.set("current", buf.readUnsignedShortLE() / 10.0);
|
||||
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() / 100.0);
|
||||
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
|
||||
position.set("batteryOverheat", buf.readUnsignedByte() > 0);
|
||||
position.set("chargeProtection", buf.readUnsignedByte() > 0);
|
||||
@@ -434,7 +434,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
position.set("calibrationCapacity", buf.readUnsignedShortLE() * 0.01);
|
||||
position.set("calibrationCapacity", buf.readUnsignedShortLE() / 100.0);
|
||||
position.set("dischargeCapacity", buf.readUnsignedIntLE());
|
||||
|
||||
} else {
|
||||
@@ -446,15 +446,15 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
|
||||
ByteBuf buf = Unpooled.wrappedBuffer(DataConverter.parseHex(pair[1]));
|
||||
switch (key) {
|
||||
case 0x90 -> {
|
||||
position.set("cumulativeVoltage", buf.readUnsignedShortLE() * 0.1);
|
||||
position.set("gatherVoltage", buf.readUnsignedShortLE() * 0.1);
|
||||
position.set("current", (buf.readUnsignedShortLE() - 30000) * 0.1);
|
||||
position.set("soc", buf.readUnsignedShortLE() * 0.1);
|
||||
position.set("cumulativeVoltage", buf.readUnsignedShortLE() / 10.0);
|
||||
position.set("gatherVoltage", buf.readUnsignedShortLE() / 10.0);
|
||||
position.set("current", (buf.readUnsignedShortLE() - 30000) / 10.0);
|
||||
position.set("soc", buf.readUnsignedShortLE() / 10.0);
|
||||
}
|
||||
case 0x91 -> {
|
||||
position.set("maxCellVoltage", buf.readUnsignedShortLE() * 0.001);
|
||||
position.set("maxCellVoltage", buf.readUnsignedShortLE() / 1000.0);
|
||||
position.set("maxCellVoltageCount", buf.readUnsignedByte());
|
||||
position.set("minCellVoltage", buf.readUnsignedShortLE() * 0.001);
|
||||
position.set("minCellVoltage", buf.readUnsignedShortLE() / 1000.0);
|
||||
position.set("minCellVoltageCount", buf.readUnsignedByte());
|
||||
}
|
||||
case 0x92 -> {
|
||||
|
||||
@@ -140,10 +140,10 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
|
||||
Double temperature = null;
|
||||
if (parser.hasNext(5)) {
|
||||
door = parser.nextInt() == 1;
|
||||
adc = parser.nextInt() * 0.1;
|
||||
power = parser.nextInt() * 0.1;
|
||||
battery = parser.nextInt() * 0.1;
|
||||
temperature = parser.nextInt() * 0.1;
|
||||
adc = parser.nextInt() / 10.0;
|
||||
power = parser.nextInt() / 10.0;
|
||||
battery = parser.nextInt() / 10.0;
|
||||
temperature = parser.nextInt() / 10.0;
|
||||
}
|
||||
|
||||
String status = parser.next();
|
||||
@@ -165,7 +165,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (parser.hasNext()) {
|
||||
int voltage = parser.nextInt();
|
||||
position.set(Position.KEY_BATTERY, voltage > 100 ? voltage * 0.001 : voltage * 0.1);
|
||||
position.set(Position.KEY_BATTERY, voltage > 100 ? voltage / 1000.0 : voltage / 10.0);
|
||||
}
|
||||
|
||||
if (parser.hasNext(4)) {
|
||||
@@ -207,7 +207,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (parser.hasNext()) {
|
||||
int voltage = parser.nextInt();
|
||||
position.set(Position.KEY_BATTERY, voltage > 100 ? voltage * 0.001 : voltage * 0.1);
|
||||
position.set(Position.KEY_BATTERY, voltage > 100 ? voltage / 1000.0 : voltage / 10.0);
|
||||
}
|
||||
|
||||
Network network = new Network();
|
||||
|
||||
@@ -95,7 +95,7 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
|
||||
int degrees = buf.readUnsignedByte();
|
||||
boolean negative = (buf.getUnsignedByte(buf.readerIndex()) & 0xf0) > 0;
|
||||
int decimal = buf.readUnsignedMedium() & 0x0fffff;
|
||||
double result = degrees + decimal * 0.000001;
|
||||
double result = degrees + decimal / 1000000.0;
|
||||
return negative ? -result : result;
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.PREFIX_IN + 2, BitUtil.check(io, 7));
|
||||
position.set(Position.PREFIX_OUT + 1, BitUtil.check(io, 8));
|
||||
position.set(Position.PREFIX_OUT + 2, BitUtil.check(io, 9));
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble(0) * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble(0) / 100.0);
|
||||
} else {
|
||||
position.set(Position.KEY_ANTENNA, BitUtil.check(io, 0));
|
||||
position.set(Position.KEY_CHARGE, BitUtil.check(io, 1));
|
||||
@@ -322,7 +322,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
position.set(Position.PREFIX_OUT + i, BitUtil.check(io, 7 + i));
|
||||
}
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble(0) * 0.1);
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble(0) / 10.0);
|
||||
}
|
||||
|
||||
position.set(Position.KEY_POWER, parser.nextDouble(0));
|
||||
@@ -362,7 +362,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
|
||||
|
||||
position.set(Position.PREFIX_IO + 1, parser.next());
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble(0) * 0.1);
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble(0) / 10.0);
|
||||
position.set(Position.KEY_POWER, parser.nextDouble(0));
|
||||
position.set(Position.PREFIX_ADC + 1, parser.next());
|
||||
position.set(Position.PREFIX_ADC + 2, parser.next());
|
||||
@@ -430,11 +430,11 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.setTime(parser.nextDateTime());
|
||||
|
||||
if (parser.hasNext(2)) {
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble() * 0.1);
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble() / 10.0);
|
||||
position.set(Position.KEY_POWER, parser.nextDouble());
|
||||
}
|
||||
if (parser.hasNext()) {
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble() * 0.01);
|
||||
position.set(Position.KEY_BATTERY, parser.nextDouble() / 100.0);
|
||||
}
|
||||
|
||||
position.set(Position.PREFIX_ADC + 1, parser.next());
|
||||
@@ -523,7 +523,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set(Position.KEY_ODOMETER, parser.nextLong());
|
||||
position.set(Position.KEY_FUEL_USED, parser.nextInt());
|
||||
position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextInt());
|
||||
position.set(Position.KEY_POWER, parser.nextInt() * 0.001);
|
||||
position.set(Position.KEY_POWER, parser.nextInt() / 1000.0);
|
||||
position.set(Position.KEY_RPM, parser.nextInt());
|
||||
position.set(Position.KEY_OBD_SPEED, parser.nextInt());
|
||||
parser.nextInt(); // intake flow
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user