aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-12-24 18:04:30 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-12-24 18:04:30 -0800
commitfabe54f1e90a068ed2db756ec6fc5d724c705e45 (patch)
tree93e760203eb24b8a57a5adc3f927390994bd5ce8 /src/main/java/org/traccar/protocol
parentb9d7296716168154ced0ad44f4ee8b334944ab72 (diff)
downloadtrackermap-server-fabe54f1e90a068ed2db756ec6fc5d724c705e45.tar.gz
trackermap-server-fabe54f1e90a068ed2db756ec6fc5d724c705e45.tar.bz2
trackermap-server-fabe54f1e90a068ed2db756ec6fc5d724c705e45.zip
Support more BLE sensors
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/AplicomProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/T800xProtocolDecoder.java54
2 files changed, 51 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/AplicomProtocolDecoder.java b/src/main/java/org/traccar/protocol/AplicomProtocolDecoder.java
index 215aa0211..5aaacf5a1 100644
--- a/src/main/java/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -500,7 +500,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_AXLE_WEIGHT, buf.readUnsignedShort() * 2);
break;
case 0x04:
- position.set("tyrePressure", buf.readUnsignedByte() * 10);
+ position.set("tirePressure", buf.readUnsignedByte() * 10);
position.set("pneumaticPressure", buf.readUnsignedByte() * 5);
break;
case 0x05:
diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
index 0c75a8997..8a047fd38 100644
--- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
@@ -191,10 +191,56 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_IGNITION, buf.readUnsignedByte() > 0);
- int dataCode = buf.readUnsignedShort();
-
- if (dataCode == 3) {
- position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(6)));
+ switch (buf.readUnsignedShort()) {
+ case 0x01:
+ position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6)));
+ position.set("tagBattery", buf.readUnsignedByte() * 0.01 + 1.22);
+ position.set("tirePressure", buf.readUnsignedByte() * 1.527 * 2);
+ position.set("tagTemp", buf.readUnsignedByte() - 55);
+ position.set("tagStatus", buf.readUnsignedByte());
+ break;
+ case 0x02:
+ position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6)));
+ position.set("tagBattery", BcdUtil.readInteger(buf, 2) * 0.1);
+ switch (buf.readUnsignedByte()) {
+ case 0:
+ position.set(Position.KEY_ALARM, Position.ALARM_SOS);
+ break;
+ case 1:
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
+ break;
+ default:
+ break;
+ }
+ break;
+ case 0x03:
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(6)));
+ position.set("tagBattery", BcdUtil.readInteger(buf, 2) * 0.1);
+ if (buf.readUnsignedByte() == 1) {
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
+ }
+ break;
+ case 0x04:
+ position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6)));
+ position.set("tagBattery", buf.readUnsignedByte() * 0.01 + 2);
+ buf.readUnsignedByte(); // battery level
+ position.set(Position.KEY_DEVICE_TEMP, buf.readUnsignedShort() * 0.01);
+ position.set("humidity", buf.readUnsignedShort() * 0.01);
+ position.set("lightSensor", BitUtil.to(buf.readUnsignedByte(), 15));
+ break;
+ case 0x05:
+ position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6)));
+ position.set("tagBattery", buf.readUnsignedByte() * 0.01 + 2);
+ position.set(Position.KEY_DEVICE_TEMP, buf.readUnsignedShort() * 0.01);
+ position.set(Position.KEY_DOOR, buf.readUnsignedByte() > 0);
+ break;
+ case 0x06:
+ position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6)));
+ position.set("tagBattery", buf.readUnsignedByte() * 0.01 + 2);
+ position.set(Position.KEY_OUTPUT, buf.readUnsignedByte() > 0);
+ break;
+ default:
+ break;
}
sendResponse(channel, header, type, index, imei, 0);