aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/TopinProtocolDecoder.java11
1 files changed, 10 insertions, 1 deletions
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);