diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/T800xProtocolDecoder.java | 15 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java | 6 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java index 03c64cfd5..6b7f47afd 100644 --- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java @@ -232,8 +232,21 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { } - if (header != 0x2727 && buf.readableBytes() >= 2) { + if (header == 0x2727) { + + buf.skipBytes(5); // acceleration + position.set(Position.KEY_BATTERY_LEVEL, BcdUtil.readInteger(buf, 2)); + position.set(Position.KEY_DEVICE_TEMP, (int) buf.readByte()); + buf.readUnsignedByte(); // front light sensor voltage + position.set(Position.KEY_BATTERY, BcdUtil.readInteger(buf, 2) * 0.1); + buf.readUnsignedByte(); // solar panel voltage + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + position.set(Position.KEY_STATUS, buf.readUnsignedShort()); + + } else if (buf.readableBytes() >= 2) { + position.set(Position.KEY_POWER, BcdUtil.readInteger(buf, 4) * 0.01); + } sendResponse(channel, header, type, index, imei, alarm); diff --git a/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java index 2afc0ef6f..9b564c895 100644 --- a/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java @@ -12,6 +12,12 @@ public class T800xProtocolDecoderTest extends ProtocolTest { T800xProtocolDecoder decoder = new T800xProtocolDecoder(null); verifyNull(decoder, binary( + "272705005e000108664250328807851905301107481054002d004d006f00620069006c006500074341542d4e42310a4c54452042414e4420340f333130323430323030303032333030143839303132343032303531303030323330303746")); + + verifyPosition(decoder, binary( + "272702004904a90866425032880785c800190530080350000000000705eec29bf50842000000000008008090502a003700000a9e358002003c000003841900001e3f90000000000000272702004904aa0866425032880785c800190530081851000000000705eec29bf50842000000000008008090602e003700000a9e358002003c000003841900001e3f90000000000000")); + + verifyNull(decoder, binary( "2727010017000108806168988888881016010207110111")); verifyNull(decoder, binary( |