aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-05-04 00:20:00 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-05-04 00:20:00 +1200
commit2c8f3ec81886f8d512088db307b7a4c5f5aee7a0 (patch)
tree8e1a48055291d5ca7427a89d44ad5e0e236a9992 /src/org/traccar
parent651f03bbf560433bf6bb96a2fed42df21fa9864c (diff)
downloadtraccar-server-2c8f3ec81886f8d512088db307b7a4c5f5aee7a0.tar.gz
traccar-server-2c8f3ec81886f8d512088db307b7a4c5f5aee7a0.tar.bz2
traccar-server-2c8f3ec81886f8d512088db307b7a4c5f5aee7a0.zip
Support T880X protocol
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/T800xProtocolDecoder.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/T800xProtocolDecoder.java b/src/org/traccar/protocol/T800xProtocolDecoder.java
index 1fd37864e..a6a647f22 100644
--- a/src/org/traccar/protocol/T800xProtocolDecoder.java
+++ b/src/org/traccar/protocol/T800xProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2018 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.
@@ -116,7 +116,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // distance compensation
buf.readUnsignedShort(); // speed alarm
- int locationStatus = buf.readUnsignedByte();
+ int status = buf.readUnsignedByte();
buf.readUnsignedByte(); // gsensor manager status
buf.readUnsignedByte(); // other flags
@@ -151,9 +151,9 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
.setMinute(BcdUtil.readInteger(buf, 2))
.setSecond(BcdUtil.readInteger(buf, 2));
- if (BitUtil.check(locationStatus, 6)) {
+ if (BitUtil.check(status, 6)) {
- position.setValid(!BitUtil.check(locationStatus, 7));
+ position.setValid(!BitUtil.check(status, 7));
position.setTime(dateBuilder.getDate());
position.setAltitude(readSwappedFloat(buf));
position.setLongitude(readSwappedFloat(buf));
@@ -170,14 +170,24 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
buf.readBytes(array);
ChannelBuffer swapped = ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, array);
- position.setNetwork(new Network(CellTower.from(
- swapped.readUnsignedShort(), swapped.readUnsignedShort(),
- swapped.readUnsignedShort(), swapped.readUnsignedShort())));
+ int mcc = swapped.readUnsignedShort();
+ int mnc = swapped.readUnsignedShort();
- // two more cell towers
+ if (mcc != 0xffff && mnc != 0xffff) {
+ Network network = new Network();
+ for (int i = 0; i < 3; i++) {
+ network.addCellTower(CellTower.from(
+ mcc, mnc, swapped.readUnsignedShort(), swapped.readUnsignedShort()));
+ }
+ position.setNetwork(network);
+ }
}
+ if (buf.readableBytes() >= 2) {
+ position.set(Position.KEY_POWER, BcdUtil.readInteger(buf, 4) * 0.01);
+ }
+
return position;
}