aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-02-27 15:06:14 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-02-27 15:06:14 -0800
commitfb8fcb940ee0faedecff130554ae62971f5ccb85 (patch)
treeec34a66d4342d76779774432396826f17a937977 /src/main/java/org
parent1499b12fa782a57dbaef294ddd16ba61d2193cc7 (diff)
downloadtrackermap-server-fb8fcb940ee0faedecff130554ae62971f5ccb85.tar.gz
trackermap-server-fb8fcb940ee0faedecff130554ae62971f5ccb85.tar.bz2
trackermap-server-fb8fcb940ee0faedecff130554ae62971f5ccb85.zip
Update Topin protocol
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/TopinProtocolDecoder.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
index 4042e348c..fe8de3710 100644
--- a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.BcdUtil;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.CellTower;
@@ -151,6 +152,21 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
Gt06ProtocolDecoder.decodeGps(position, buf, false, TimeZone.getTimeZone("UTC"));
+ if (buf.readableBytes() >= 5) {
+ position.setAltitude(buf.readShort());
+
+ int alarms = buf.readUnsignedByte();
+ if (BitUtil.check(alarms, 0)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_VIBRATION);
+ }
+ if (BitUtil.check(alarms, 1)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
+ }
+ if (BitUtil.check(alarms, 4)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER);
+ }
+ }
+
ByteBuf content = Unpooled.buffer();
content.writeBytes(time);
sendResponse(channel, length, type, content);