aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gt06ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-07-09 00:33:21 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-07-09 00:33:21 +1200
commitc9245e2dd791d115011dbb4490733fd9102415d1 (patch)
treed79d231ee3271ff598a350477d3d4450d9026209 /src/org/traccar/protocol/Gt06ProtocolDecoder.java
parenteb8d0d220d4aa1b68331342c839adfd02c574f35 (diff)
downloadtrackermap-server-c9245e2dd791d115011dbb4490733fd9102415d1.tar.gz
trackermap-server-c9245e2dd791d115011dbb4490733fd9102415d1.tar.bz2
trackermap-server-c9245e2dd791d115011dbb4490733fd9102415d1.zip
Decode AZ735 protocol status
Diffstat (limited to 'src/org/traccar/protocol/Gt06ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 357256d76..24bedcabf 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -187,16 +187,19 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
private boolean decodeLbs(Position position, ChannelBuffer buf, boolean hasLength) {
- int lbsLength = 0;
+ int length = 0;
if (hasLength) {
- lbsLength = buf.readUnsignedByte();
+ length = buf.readUnsignedByte();
+ if (length == 0) {
+ return false;
+ }
}
position.setNetwork(new Network(CellTower.from(
buf.readUnsignedShort(), buf.readUnsignedByte(), buf.readUnsignedShort(), buf.readUnsignedMedium())));
- if (lbsLength > 0) {
- buf.skipBytes(lbsLength - 9);
+ if (length > 0) {
+ buf.skipBytes(length - 8);
}
return true;
@@ -543,6 +546,37 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
decodeLbs(position, buf, true);
+ buf.skipBytes(buf.readUnsignedByte()); // additional cell towers
+ buf.skipBytes(buf.readUnsignedByte()); // wifi access point
+
+ int status = buf.readUnsignedByte();
+ position.set(Position.KEY_STATUS, status);
+
+ if (type == MSG_AZ735_ALARM) {
+ switch (status) {
+ case 0xA0:
+ position.set(Position.KEY_ARMED, true);
+ break;
+ case 0xA1:
+ position.set(Position.KEY_ARMED, false);
+ break;
+ case 0xA2:
+ case 0xA3:
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
+ break;
+ case 0xA4:
+ position.set(Position.KEY_ALARM, Position.ALARM_GENERAL);
+ break;
+ case 0xA5:
+ position.set(Position.KEY_ALARM, Position.ALARM_DOOR);
+ break;
+ default:
+ break;
+ }
+ }
+
+ buf.skipBytes(buf.readUnsignedByte()); // reserved extension
+
sendResponse(channel, true, type);
return position;