aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-03-19 23:16:38 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-03-19 23:16:38 -0700
commitfd466266940a49a55b3b2b4ad89a2a4b07326da5 (patch)
treecece47cc8de2cef2b067c15ad02a909f0908e5b1 /src/main/java/org
parent3614e9ad2f40e92a91b796ac815398e7b4f96c02 (diff)
downloadtrackermap-server-fd466266940a49a55b3b2b4ad89a2a4b07326da5.tar.gz
trackermap-server-fd466266940a49a55b3b2b4ad89a2a4b07326da5.tar.bz2
trackermap-server-fd466266940a49a55b3b2b4ad89a2a4b07326da5.zip
Decode cell information
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java48
1 files changed, 30 insertions, 18 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index e715547ed..675a08aef 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -335,24 +335,36 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
position.set("cover", BitUtil.check(deviceStatus, 3));
break;
case 0xEB:
- while (buf.readerIndex() < endIndex) {
- int extendedLength = buf.readUnsignedShort();
- int extendedType = buf.readUnsignedShort();
- switch (extendedType) {
- case 0x0001:
- position.set("fuel1", buf.readUnsignedShort() * 0.1);
- buf.readUnsignedByte(); // unused
- break;
- case 0x0023:
- position.set("fuel2", Double.parseDouble(
- buf.readCharSequence(6, StandardCharsets.US_ASCII).toString()));
- break;
- case 0x00CE:
- position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
- break;
- default:
- buf.skipBytes(extendedLength - 2);
- break;
+ if (buf.getUnsignedShort(buf.readerIndex()) > 200) {
+ Network network = new Network();
+ int mcc = buf.readUnsignedShort();
+ int mnc = buf.readUnsignedByte();
+ while (buf.readerIndex() < endIndex) {
+ network.addCellTower(CellTower.from(
+ mcc, mnc, buf.readUnsignedShort(), buf.readUnsignedShort(),
+ buf.readUnsignedByte()));
+ }
+ position.setNetwork(network);
+ } else {
+ while (buf.readerIndex() < endIndex) {
+ int extendedLength = buf.readUnsignedShort();
+ int extendedType = buf.readUnsignedShort();
+ switch (extendedType) {
+ case 0x0001:
+ position.set("fuel1", buf.readUnsignedShort() * 0.1);
+ buf.readUnsignedByte(); // unused
+ break;
+ case 0x0023:
+ position.set("fuel2", Double.parseDouble(
+ buf.readCharSequence(6, StandardCharsets.US_ASCII).toString()));
+ break;
+ case 0x00CE:
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
+ break;
+ default:
+ buf.skipBytes(extendedLength - 2);
+ break;
+ }
}
}
break;