From 610a526a33fa1e6d8277f7fd71626ed5858d251e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 27 Apr 2021 21:53:19 -0700 Subject: Additional status attributes --- src/main/java/org/traccar/protocol/TopinProtocolDecoder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java index fe8de3710..87db95946 100644 --- a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java @@ -190,9 +190,18 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte()); buf.readUnsignedByte(); // timezone int interval = buf.readUnsignedByte(); - if (length >= 7) { + if (buf.readableBytes() >= 1 + 2) { position.set(Position.KEY_RSSI, buf.readUnsignedByte()); } + if (buf.readableBytes() >= 3 + 2) { + buf.skipBytes(3); // temperature + } + if (buf.readableBytes() >= 1 + 2) { + position.set(Position.KEY_CHARGE, buf.readUnsignedByte() > 0); + } + if (buf.readableBytes() >= 1 + 2) { + position.set(Position.KEY_HEART_RATE, buf.readUnsignedByte()); + } ByteBuf content = Unpooled.buffer(); content.writeByte(interval); -- cgit v1.2.3