aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-06-30 22:34:12 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-06-30 22:34:12 -0700
commit513e94358c48a070eea947e6123c3affc59b4e5e (patch)
treeb105718f3482340ce7eb58c2a6efd59e071452d5 /src/main/java/org/traccar/protocol
parent8edc2c5877b24c2fafdbc6e4bd0350cccb9122a4 (diff)
downloadtrackermap-server-513e94358c48a070eea947e6123c3affc59b4e5e.tar.gz
trackermap-server-513e94358c48a070eea947e6123c3affc59b4e5e.tar.bz2
trackermap-server-513e94358c48a070eea947e6123c3affc59b4e5e.zip
Improve Topin decoder
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/TopinProtocolDecoder.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
index df325bc69..c817f500a 100644
--- a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
@@ -134,19 +134,14 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- int battery = buf.readUnsignedByte();
- int firmware = buf.readUnsignedByte();
- int timezone = buf.readUnsignedByte();
+ position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
+ position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte());
+ buf.readUnsignedByte(); // timezone
int interval = buf.readUnsignedByte();
- int signal = 0;
if (length >= 7) {
- signal = buf.readUnsignedByte();
- position.set(Position.KEY_RSSI, signal);
+ position.set(Position.KEY_RSSI, buf.readUnsignedByte());
}
- position.set(Position.KEY_BATTERY_LEVEL, battery);
- position.set(Position.KEY_VERSION_FW, firmware);
-
ByteBuf content = Unpooled.buffer();
content.writeByte(interval);
sendResponse(channel, length, type, content);