aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-01-05 22:15:21 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-01-05 22:15:21 -0800
commit61fd2a8f2bb88b073e123807732725da7e03841d (patch)
treebb2d8e83df08000eaef75ebefdd4c8c462d8aa2d
parentbca343a9704aa0040467599f9196eff08e674bc7 (diff)
downloadtrackermap-server-61fd2a8f2bb88b073e123807732725da7e03841d.tar.gz
trackermap-server-61fd2a8f2bb88b073e123807732725da7e03841d.tar.bz2
trackermap-server-61fd2a8f2bb88b073e123807732725da7e03841d.zip
Implement additional parameters
-rw-r--r--src/main/java/org/traccar/protocol/IotmProtocolDecoder.java72
1 files changed, 57 insertions, 15 deletions
diff --git a/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java b/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
index c5a9050e4..5921cb835 100644
--- a/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
@@ -84,17 +84,6 @@ public class IotmProtocolDecoder extends BaseProtocolDecoder {
}
}
- private String getKey(int sensorId) {
- switch (sensorId) {
- case 0x300C:
- return Position.KEY_RPM;
- case 0x4003:
- return Position.KEY_ODOMETER;
- default:
- return null;
- }
- }
-
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -170,10 +159,63 @@ public class IotmProtocolDecoder extends BaseProtocolDecoder {
} else {
- String key = getKey(sensorId);
- Object value = readValue(record, sensorType);
- if (key != null && value != null) {
- position.getAttributes().put(key, value);
+ if (sensorType == 3) continue;
+
+ String key;
+ switch (sensorId) {
+ case 0x0008:
+ if (sensorType > 0) {
+ position.set(Position.KEY_ALARM, Position.ALARM_JAMMING);
+ }
+ break;
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ key = Position.PREFIX_IN + (sensorId - 0x0010 + 2);
+ position.set(key, sensorType > 0);
+ break;
+ case 0x001E:
+ position.set("buttonPresent", sensorType > 0);
+ break;
+ case 0x006D:
+ position.set(Position.KEY_IGNITION, sensorType > 0);
+ break;
+ case 0x3000:
+ position.set(Position.KEY_POWER, record.readUnsignedShortLE() * 0.001);
+ break;
+ case 0x3001:
+ case 0x3002:
+ case 0x3003:
+ key = Position.PREFIX_ADC + (0x3003 - sensorId + 3);
+ position.set(key, record.readUnsignedShortLE() * 0.001);
+ break;
+ case 0x3004:
+ position.set(Position.KEY_BATTERY, record.readUnsignedShortLE() * 0.001);
+ break;
+ case 0x300C:
+ position.set(Position.KEY_RPM, record.readUnsignedShortLE());
+ break;
+ case 0x4003:
+ position.set(Position.KEY_ODOMETER, record.readUnsignedIntLE() * 5);
+ break;
+ case 0x5000:
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(record.readLongLE()));
+ break;
+ case 0xA001:
+ position.set(Position.KEY_ACCELERATION, record.readFloatLE());
+ break;
+ case 0xA002:
+ position.set("cornering", record.readFloatLE());
+ break;
+ case 0xA017:
+ key = Position.PREFIX_TEMP + (sensorId - 0xA017 + 1);
+ position.set(key, record.readFloatLE());
+ break;
+ default:
+ key = Position.PREFIX_IO + sensorId;
+ position.getAttributes().put(key, readValue(record, sensorType));
+ break;
}
}