aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/HuabaoProtocolDecoderTest.java3
3 files changed, 14 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 0fdd5ba10..37f64ee02 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -118,6 +118,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
case MSG_GPS_LBS_EXTEND:
case MSG_GPS_2:
case MSG_FENCE_SINGLE:
+ case MSG_FENCE_MULTI:
return true;
default:
return false;
@@ -135,6 +136,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
case MSG_GPS_LBS_STATUS_3:
case MSG_GPS_2:
case MSG_FENCE_SINGLE:
+ case MSG_FENCE_MULTI:
case MSG_LBS_ALARM:
case MSG_LBS_ADDRESS:
return true;
@@ -554,14 +556,14 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, dateBuilder.getDate());
int mcc = buf.readUnsignedShort();
- int mnc = buf.readUnsignedByte();
+ int mnc = BitUtil.check(mcc, 15) ? buf.readUnsignedShort() : buf.readUnsignedByte();
Network network = new Network();
for (int i = 0; i < 7; i++) {
int lac = longFormat ? buf.readInt() : buf.readUnsignedShort();
int cid = longFormat ? (int) buf.readLong() : buf.readUnsignedMedium();
int rssi = -buf.readUnsignedByte();
if (lac > 0) {
- network.addCellTower(CellTower.from(mcc, mnc, lac, cid, rssi));
+ network.addCellTower(CellTower.from(BitUtil.to(mcc, 15), mnc, lac, cid, rssi));
}
}
@@ -630,7 +632,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort();
}
- if (type == MSG_GPS_LBS_STATUS_3) {
+ if (type == MSG_GPS_LBS_STATUS_3 || type == MSG_FENCE_MULTI) {
position.set(Position.KEY_GEOFENCE, buf.readUnsignedByte());
}
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index 50fdd6cba..13bc6e38d 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -20,6 +20,12 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
"78780B23C00122040001000818720D0A"));
verifyNotNull(decoder, binary(
+ "78782EA4110C0C02281BF6026C18720C38D22800149C1181CC00010000260E000000000615F8012C05041102FF001058FD0D0A"));
+
+ verifyNotNull(decoder, binary(
+ "78787aa2110c0e06372c813601040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c0104ff02001801eb4039d10000000000000004fabeb50d0a"));
+
+ verifyNotNull(decoder, binary(
"78782727110c0b0e170f850450059107f461ae001c7e0a81360104cb8a00bef32806030c02ff000316b10d0a"));
verifyNotNull(decoder, binary(
diff --git a/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index ba4c726ec..9ce1c6caa 100644
--- a/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
HuabaoProtocolDecoder decoder = new HuabaoProtocolDecoder(new HuabaoProtocol());
verifyPosition(decoder, binary(
+ "7e02000054093037612710000700000000000000010223aca000dc9dd800000000000017121417122133362a4d30302c34352c31313336393042383030313233303026303030303030303030303030263132333435363738393031323334353623897e"));
+
+ verifyPosition(decoder, binary(
"7e0200002c00160128561400020000000000040001005de1f7065c6cef00000000000017011710044201040000a9002a02000030011b3101030c7e"));
verifyPosition(decoder, binary(