aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java28
-rw-r--r--test/org/traccar/protocol/AtrackProtocolDecoderTest.java3
2 files changed, 29 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index ff4e0efeb..17b0466b1 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -267,6 +267,30 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
case "MA":
readString(buf); // mac address
break;
+ case "PD":
+ buf.readUnsignedByte(); // pending code status
+ break;
+ case "CD":
+ readString(buf); // sim cid
+ break;
+ case "CM":
+ buf.readLong(); // imsi
+ break;
+ case "GN":
+ buf.skipBytes(60); // g sensor data
+ break;
+ case "GV":
+ buf.skipBytes(6); // maximum g force
+ break;
+ case "ME":
+ readString(buf); // imei
+ break;
+ case "IA":
+ buf.readUnsignedByte(); // intake air temperature
+ break;
+ case "MP":
+ buf.readUnsignedByte(); // manifold absolute pressure
+ break;
default:
break;
}
@@ -274,7 +298,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
if (cellTower.getMobileCountryCode() != null
&& cellTower.getMobileNetworkCode() != null
- && cellTower.getCellId() != null
+ && cellTower.getCellId() != null && cellTower.getCellId() != 0
&& cellTower.getLocationAreaCode() != null) {
position.setNetwork(new Network(cellTower));
} else if (cellTower.getSignalStrength() != null) {
@@ -519,7 +543,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
if (custom) {
String form = this.form;
if (form == null) {
- form = readString(buf).substring("%CI".length());
+ form = readString(buf).trim().substring("%CI".length());
}
readBinaryCustomData(position, buf, form);
}
diff --git a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java
index 0c8e49eb1..986b764d3 100644
--- a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java
@@ -34,6 +34,9 @@ public class AtrackProtocolDecoderTest extends ProtocolTest {
decoder.setCustom(true);
+ verifyPositions(decoder, binary(
+ "405ad77c01670410000144a77a21281d5b74d2335b74d2335b74d233fabaf3bc02a38d3d010c0200030f8e000701001a0000000007d007d00025434925434525434e25475125475325464c254d4c25564e25504425464325454c254554254344254154254d46254d5625425625434d25445425474c25474e254756254c43254d4525524c25525025534125534d255452254941254d5000000000000004bbf41c0900003254314b523332453238433730363138350000000000004800543839303132363038383132313532343737353900000000ec06a50089002900011a2e3da1882700687474703a2f2f6d6170732e676f6f676c652e636f6d2f6d6170733f713d34342e3237323935372c2d38382e34313132303120000075ff4903fb006fff63040a004dff5d04080030ffa10407003b001304060026000503f9001e002504020078ff6204000073ff7d03f9007aff6903f3ffc0001804040000000144a77a21281d00073f0c001a182400"));
+
verifyPositions(decoder, buffer(
"@P,6254,235,989,356961075931165,1534381563,1534381564,1534381564,-88429188,44271225,70,2,200563,8,1,0,0,0,,2000,2000,,%CI%CE%CN%GQ%GS%FL%ML%VN%PD%FC%EL%ET%CD%AT%MF%MV,0,310260,18,9,0,0,2T1KR32E28C706185,0,0,0,54,8901260881215247759,252,489,123"));