aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-04-27 21:53:19 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-04-27 21:53:19 -0700
commit610a526a33fa1e6d8277f7fd71626ed5858d251e (patch)
tree9ac1119348ebf3a06e06b0ddb5d26e01a2a26c53 /src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
parent309e6a6d4e153b67aa598d67b45f3128716576b8 (diff)
downloadtrackermap-server-610a526a33fa1e6d8277f7fd71626ed5858d251e.tar.gz
trackermap-server-610a526a33fa1e6d8277f7fd71626ed5858d251e.tar.bz2
trackermap-server-610a526a33fa1e6d8277f7fd71626ed5858d251e.zip
Additional status attributes
Diffstat (limited to 'src/main/java/org/traccar/protocol/TopinProtocolDecoder.java')
-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);