From 854ad6ce2c39695ed2cdf5f584be10be53ed6c33 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 19 Aug 2018 13:16:30 +1200 Subject: Fix Atrack binary message decoding --- .../traccar/protocol/AtrackProtocolDecoder.java | 28 ++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3