From b67f1e828ce5bc8fe215d377cd2ae81f23152abd Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Mon, 20 Feb 2017 18:50:42 -0500 Subject: Updated Atrack protocol to report network information; --- .../traccar/protocol/AtrackProtocolDecoder.java | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index d80c19706..e2868692e 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -23,6 +23,8 @@ import org.traccar.Context; import org.traccar.DeviceSession; import org.traccar.helper.DateBuilder; import org.traccar.helper.UnitsConverter; +import org.traccar.model.CellTower; +import org.traccar.model.Network; import org.traccar.model.Position; import java.net.SocketAddress; @@ -80,6 +82,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { } private void readCustomData(Position position, ChannelBuffer buf, String form) { + CellTower cellTower = new CellTower(); String[] keys = form.substring(1).split("%"); for (String key : keys) { switch (key) { @@ -93,16 +96,19 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); break; case "GQ": - position.set(Position.KEY_RSSI, buf.readUnsignedByte()); + cellTower.setSignalStrength((int) buf.readUnsignedByte()); break; case "CE": - buf.readUnsignedInt(); // cid + cellTower.setCellId(buf.readUnsignedInt()); // cid break; case "LC": - buf.readUnsignedShort(); // lac + cellTower.setLocationAreaCode(buf.readUnsignedShort()); // lac break; case "CN": - buf.readUnsignedInt(); // mcc + mnc + int combinedMobileCodes; // Decimal: CCCNN + combinedMobileCodes = (int) (buf.readUnsignedInt() % 100000); + cellTower.setMobileCountryCode(combinedMobileCodes / 100); + cellTower.setMobileNetworkCode(combinedMobileCodes % 100); break; case "RL": buf.readUnsignedByte(); // rxlev @@ -168,6 +174,15 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { break; } } + + if (cellTower.getMobileCountryCode() != null + && cellTower.getMobileNetworkCode() != null + && cellTower.getCellId() != null + && cellTower.getLocationAreaCode() != null) { + position.setNetwork(new Network(cellTower)); + } else if (cellTower.getSignalStrength() != null) { + position.set(Position.KEY_RSSI, cellTower.getSignalStrength()); + } } @Override -- cgit v1.2.3 From 21d8146fc216df827c156b446221c2bc01f05a6f Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Mon, 20 Feb 2017 19:47:07 -0500 Subject: Updated protocols to record CellTower information where appropriate; Removed KEY_RSSI when reported in CellTower; --- .../traccar/protocol/AutoFonProtocolDecoder.java | 16 ++++++++---- src/org/traccar/protocol/BceProtocolDecoder.java | 4 +-- .../traccar/protocol/FlextrackProtocolDecoder.java | 4 +-- src/org/traccar/protocol/Jt600ProtocolDecoder.java | 29 ++++++++++++++-------- .../traccar/protocol/MeitrackProtocolDecoder.java | 13 +++++----- .../traccar/protocol/TeltonikaProtocolDecoder.java | 12 ++++++--- src/org/traccar/protocol/TotemProtocolDecoder.java | 9 +++---- src/org/traccar/protocol/TrvProtocolDecoder.java | 4 +-- 8 files changed, 55 insertions(+), 36 deletions(-) diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java index d75ff2fe1..22a4dee42 100644 --- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java @@ -23,6 +23,8 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; import org.traccar.helper.BitUtil; import org.traccar.helper.DateBuilder; +import org.traccar.model.CellTower; +import org.traccar.model.Network; import org.traccar.model.Position; import java.net.SocketAddress; @@ -84,11 +86,14 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { } position.set(Position.PREFIX_TEMP + 1, buf.readByte()); - position.set(Position.KEY_RSSI, buf.readUnsignedByte()); - buf.readUnsignedShort(); // mcc - buf.readUnsignedShort(); // mnc - buf.readUnsignedShort(); // lac - buf.readUnsignedShort(); // cid + + int rssi = buf.readUnsignedByte(); + CellTower cellTower = CellTower.from(buf.readUnsignedShort(), + buf.readUnsignedShort(), + buf.readUnsignedShort(), + buf.readUnsignedShort(), + rssi); + position.setNetwork(new Network(cellTower)); int valid = buf.readUnsignedByte(); position.setValid((valid & 0xc0) != 0); @@ -182,6 +187,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { buf.readByte(); // mode buf.readByte(); // gprs sending interval + // Should call position.setNetwork() here buf.skipBytes(6); // mcc, mnc, lac, cid int valid = buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java index 06290d50d..b472ac6c9 100644 --- a/src/org/traccar/protocol/BceProtocolDecoder.java +++ b/src/org/traccar/protocol/BceProtocolDecoder.java @@ -132,8 +132,8 @@ public class BceProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(mask, 14)) { position.setNetwork(new Network(CellTower.from( buf.readUnsignedShort(), buf.readUnsignedByte(), - buf.readUnsignedShort(), buf.readUnsignedShort()))); - position.set(Position.KEY_RSSI, buf.readUnsignedByte()); + buf.readUnsignedShort(), buf.readUnsignedShort(), + buf.readUnsignedByte()))); buf.readUnsignedByte(); } diff --git a/src/org/traccar/protocol/FlextrackProtocolDecoder.java b/src/org/traccar/protocol/FlextrackProtocolDecoder.java index 39da99fda..9a9e849ca 100644 --- a/src/org/traccar/protocol/FlextrackProtocolDecoder.java +++ b/src/org/traccar/protocol/FlextrackProtocolDecoder.java @@ -123,7 +123,7 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, parser.nextInt()); position.set(Position.KEY_BATTERY, parser.nextInt()); - position.set(Position.KEY_RSSI, parser.nextInt()); + int rssi = parser.nextInt(); position.set(Position.KEY_STATUS, parser.nextInt(16)); int mcc = parser.nextInt(); @@ -133,7 +133,7 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_HDOP, parser.nextInt() * 0.1); - position.setNetwork(new Network(CellTower.from(mcc, mnc, parser.nextInt(16), parser.nextInt(16)))); + position.setNetwork(new Network(CellTower.from(mcc, mnc, parser.nextInt(16), parser.nextInt(16), rssi))); position.set(Position.KEY_ODOMETER, parser.nextInt()); diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index 0d8b4abbc..b730c2feb 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -110,10 +110,14 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, battery + "%"); } - position.setNetwork(new Network( - CellTower.fromCidLac(buf.readUnsignedShort(), buf.readUnsignedShort()))); + int cid = buf.readUnsignedShort(); + int lac = buf.readUnsignedShort(); + int rssi = buf.readUnsignedByte(); + + CellTower cellTower = CellTower.fromCidLac(cid, lac); + cellTower.setSignalStrength(rssi); + position.setNetwork(new Network(cellTower)); - position.set(Position.KEY_RSSI, buf.readUnsignedByte()); position.set(Position.KEY_INDEX, buf.readUnsignedByte()); } else if (version == 1) { @@ -125,14 +129,18 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(buf.readUnsignedShort()); - int cid = buf.readUnsignedShort(); - int lac = buf.readUnsignedShort(); + int cid = buf.readUnsignedShort(); + int lac = buf.readUnsignedShort(); + int rssi = buf.readUnsignedByte(); + if (cid != 0 && lac != 0) { - position.setNetwork(new Network(CellTower.fromCidLac(cid, lac))); + CellTower cellTower = CellTower.fromCidLac(cid, lac); + cellTower.setSignalStrength(rssi); + position.setNetwork(new Network(cellTower)); + } else { + position.set(Position.KEY_RSSI, rssi); } - position.set(Position.KEY_RSSI, buf.readUnsignedByte()); - } else if (version == 2) { int fuel = buf.readUnsignedByte() << 8; @@ -259,9 +267,10 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, parser.next()); position.set(Position.KEY_STATUS, parser.nextInt(2)); - position.setNetwork(new Network(CellTower.fromCidLac(parser.nextInt(), parser.nextInt()))); + CellTower cellTower = CellTower.fromCidLac(parser.nextInt(), parser.nextInt()); + cellTower.setSignalStrength(parser.nextInt()); + position.setNetwork(new Network(cellTower)); - position.set(Position.KEY_RSSI, parser.nextInt()); position.set(Position.KEY_ODOMETER, parser.nextLong() * 1000); position.set(Position.KEY_INDEX, parser.nextInt()); diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 7b4e38fe6..3f75d76da 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -54,7 +54,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { .number("(dd)(dd)(dd),") // time .number("([AV]),") // validity .number("(d+),") // satellites - .number("(d+),") // gsm signal + .number("(d+),") // gsm signal (rssi) .number("(d+.?d*),") // speed .number("(d+),") // course .number("(d+.?d*),") // hdop @@ -64,7 +64,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { .number("(d+)|") // mcc .number("(d+)|") // mnc .number("(x+)|") // lac - .number("(x+),") // cell + .number("(x+),") // cell id (cid) .number("(x+),") // state .number("(x+)?|") // adc1 .number("(x+)?|") // adc2 @@ -115,7 +115,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.next().equals("A")); position.set(Position.KEY_SATELLITES, parser.next()); - position.set(Position.KEY_RSSI, parser.next()); + int rssi = parser.nextInt(); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); position.setCourse(parser.nextDouble()); @@ -128,7 +128,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.set("runtime", parser.next()); position.setNetwork(new Network( - CellTower.from(parser.nextInt(), parser.nextInt(), parser.nextInt(16), parser.nextInt(16)))); + CellTower.from(parser.nextInt(), parser.nextInt(), parser.nextInt(16), parser.nextInt(16), rssi))); position.set(Position.KEY_STATUS, parser.next()); @@ -200,7 +200,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.setValid(buf.readUnsignedByte() == 1); position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); - position.set(Position.KEY_RSSI, buf.readUnsignedByte()); + int rssi = buf.readUnsignedByte(); position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort())); position.setCourse(buf.readUnsignedShort()); @@ -214,7 +214,8 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.setNetwork(new Network(CellTower.from( buf.readUnsignedShort(), buf.readUnsignedShort(), - buf.readUnsignedShort(), buf.readUnsignedShort()))); + buf.readUnsignedShort(), buf.readUnsignedShort(), + rssi))); position.set(Position.KEY_STATUS, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 9c1e0a2ff..87cc72814 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -166,11 +166,15 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(locationMask, 5)) { - position.setNetwork(new Network( - CellTower.fromLacCid(buf.readUnsignedShort(), buf.readUnsignedShort()))); - } + CellTower cellTower = CellTower.fromLacCid(buf.readUnsignedShort(), buf.readUnsignedShort()); + + if (BitUtil.check(locationMask, 6)) { + cellTower.setSignalStrength((int) buf.readUnsignedByte()); + } + + position.setNetwork(new Network(cellTower)); - if (BitUtil.check(locationMask, 6)) { + } else if (BitUtil.check(locationMask, 6)) { position.set(Position.KEY_RSSI, buf.readUnsignedByte()); } diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 7140190da..128c42ccd 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -151,7 +151,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { .number("(xxxx)") // lac .number("(xxxx)") // cid .number("(dd)") // satellites - .number("(dd)") // gsm + .number("(dd)") // gsm (rssi) .number("(ddd)") // course .number("(ddd)") // speed .number("(dd.d)") // hdop @@ -309,11 +309,10 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_TEMP + 1, parser.next()); position.set(Position.PREFIX_TEMP + 2, parser.next()); - position.setNetwork(new Network( - CellTower.fromLacCid(parser.nextInt(16), parser.nextInt(16)))); - + CellTower cellTower = CellTower.fromLacCid(parser.nextInt(16), parser.nextInt(16)); position.set(Position.KEY_SATELLITES, parser.nextInt()); - position.set(Position.KEY_RSSI, parser.nextInt()); + cellTower.setSignalStrength(parser.nextInt()); + position.setNetwork(new Network(cellTower)); position.setCourse(parser.nextDouble()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); diff --git a/src/org/traccar/protocol/TrvProtocolDecoder.java b/src/org/traccar/protocol/TrvProtocolDecoder.java index 3d8b6c66b..c9a8322ed 100644 --- a/src/org/traccar/protocol/TrvProtocolDecoder.java +++ b/src/org/traccar/protocol/TrvProtocolDecoder.java @@ -140,7 +140,7 @@ public class TrvProtocolDecoder extends BaseProtocolDecoder { position.setCourse(parser.nextDouble()); - position.set(Position.KEY_RSSI, parser.nextInt()); + int rssi = parser.nextInt(); position.set(Position.KEY_SATELLITES, parser.nextInt()); position.set(Position.KEY_BATTERY, parser.nextInt()); @@ -150,7 +150,7 @@ public class TrvProtocolDecoder extends BaseProtocolDecoder { } position.setNetwork(new Network(CellTower.from( - parser.nextInt(), parser.nextInt(), parser.nextInt(), parser.nextInt()))); + parser.nextInt(), parser.nextInt(), parser.nextInt(), parser.nextInt(), rssi))); return position; } -- cgit v1.2.3 From 7dfa56d7e85ad982bc5ed0cf8800a073d86240eb Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Tue, 21 Feb 2017 21:58:48 -0500 Subject: Recorded KEY_SATELLITES in CellocatorProtocol; --- src/org/traccar/protocol/CellocatorProtocolDecoder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java index 7df8cad8a..970f0ee4c 100644 --- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java +++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java @@ -137,7 +137,9 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // mode 1 buf.readUnsignedByte(); // mode 2 - position.setValid(buf.readUnsignedByte() >= 3); // satellites + int satellites = buf.readUnsignedByte(); + position.setValid(satellites >= 3); + position.set(Position.KEY_SATELLITES, satellites); position.setLongitude(buf.readInt() / Math.PI * 180 / 100000000); position.setLatitude(buf.readInt() / Math.PI * 180 / 100000000.0); -- cgit v1.2.3 From 560e01c723a6216f105ea36cafe08ec957aad700 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Tue, 21 Feb 2017 22:12:22 -0500 Subject: Updated TramigoProtocol to record KEY_RSSI, KEY_SATELLITES, KEY_SATELLITES_VISIBLE, and KEY_CHARGE; --- src/org/traccar/protocol/TramigoProtocolDecoder.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java index 9affa08b9..d5cddb3d2 100644 --- a/src/org/traccar/protocol/TramigoProtocolDecoder.java +++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java @@ -82,9 +82,9 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(buf.readUnsignedInt() * 0.0000001); position.setLongitude(buf.readUnsignedInt() * 0.0000001); - buf.readUnsignedShort(); // GSM signal quality - buf.readUnsignedShort(); // satellites in fix - buf.readUnsignedShort(); // satellites in track + position.set(Position.KEY_RSSI, buf.readUnsignedShort()); // GSM signal quality + position.set(Position.KEY_SATELLITES, buf.readUnsignedShort()); // satellites in fix + position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort()); // satellites in track buf.readUnsignedShort(); // GPS antenna state position.setSpeed(buf.readUnsignedShort() * 0.194384); @@ -94,7 +94,7 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); - buf.readUnsignedShort(); // battery charger status + position.set(Position.KEY_CHARGE, buf.readUnsignedShort()); // battery charger status position.setTime(new Date(buf.readUnsignedInt() * 1000)); -- cgit v1.2.3 From 360889705fd6db50c302c40afeeca4ca93e9d780 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Tue, 21 Feb 2017 22:23:41 -0500 Subject: Updated TotemProtocol to record "pdop" and "vdop" in PATTERN1; --- src/org/traccar/protocol/TotemProtocolDecoder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 128c42ccd..db25a3f17 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -50,9 +50,9 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { .number("(dd)(dd)(dd)") // date .expression("[^*]*").text("*") .number("xx|") // checksum - .number("d+.d+|") // pdop + .number("(d+.d+)|") // pdop .number("(d+.d+)|") // hdop - .number("d+.d+|") // vdop + .number("(d+.d+)|") // vdop .number("(d+)|") // io status .number("d+|") // time .number("d") // charged @@ -242,7 +242,9 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { } position.setTime(dateBuilder.getDate()); + position.set("pdop", parser.next()); position.set(Position.KEY_HDOP, parser.next()); + position.set("vdop", parser.next()); position.set(Position.PREFIX_IO + 1, parser.next()); position.set(Position.KEY_BATTERY, parser.next()); position.set(Position.KEY_POWER, parser.nextDouble()); -- cgit v1.2.3 From 97fdf1bbf9f1595b22c9cb8ef5f20ca900a4e885 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Tue, 21 Feb 2017 22:34:41 -0500 Subject: Replaced position.set(Position.KEY_ACCURACY, accuracy) with position.setAccuracy(accuracy); --- src/org/traccar/protocol/CguardProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/CguardProtocolDecoder.java b/src/org/traccar/protocol/CguardProtocolDecoder.java index 2fc3194db..0f58a24c7 100644 --- a/src/org/traccar/protocol/CguardProtocolDecoder.java +++ b/src/org/traccar/protocol/CguardProtocolDecoder.java @@ -73,7 +73,7 @@ public class CguardProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(parser.nextDouble()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); - position.set(Position.KEY_ACCURACY, parser.nextDouble()); + position.setAccuracy(parser.nextDouble()); position.setCourse(parser.nextDouble()); position.setAltitude(parser.nextDouble()); -- cgit v1.2.3 From b96c5afe15d06fedb76bcaf5445b4573c79ce60e Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Tue, 21 Feb 2017 22:35:50 -0500 Subject: Updated {Gpsmta,Mxt,Tt8850} Protocols to record Accuracy; --- src/org/traccar/protocol/GpsmtaProtocolDecoder.java | 2 +- src/org/traccar/protocol/MxtProtocolDecoder.java | 2 +- src/org/traccar/protocol/Tt8850ProtocolDecoder.java | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java index 7360dbc1d..4436b7605 100644 --- a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java +++ b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java @@ -73,7 +73,7 @@ public class GpsmtaProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(parser.nextDouble()); position.setSpeed(parser.nextInt()); position.setCourse(parser.nextInt()); - parser.next(); + position.setAccuracy(parser.nextInt()); position.setAltitude(parser.nextInt()); position.set(Position.KEY_STATUS, parser.nextInt()); diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java index eaeeacc97..bf1d3b342 100644 --- a/src/org/traccar/protocol/MxtProtocolDecoder.java +++ b/src/org/traccar/protocol/MxtProtocolDecoder.java @@ -134,7 +134,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(infoGroups, 2)) { position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); position.set(Position.KEY_HDOP, buf.readUnsignedByte()); - buf.readUnsignedByte(); // GPS accuracy + position.setAccuracy(buf.readUnsignedByte()); position.set(Position.KEY_RSSI, buf.readUnsignedByte()); buf.readUnsignedShort(); // time since boot buf.readUnsignedByte(); // input voltage diff --git a/src/org/traccar/protocol/Tt8850ProtocolDecoder.java b/src/org/traccar/protocol/Tt8850ProtocolDecoder.java index 040783ba2..c9cb0bb28 100644 --- a/src/org/traccar/protocol/Tt8850ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tt8850ProtocolDecoder.java @@ -79,7 +79,9 @@ public class Tt8850ProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.setValid(parser.nextInt() < 20); + int accuracy = parser.nextInt(); + position.setValid(accuracy < 20); + position.setAccuracy(accuracy); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); position.setCourse(parser.nextDouble()); position.setAltitude(parser.nextDouble()); -- cgit v1.2.3 From a36edc4f713bc0e3642fbd60787c0094a6452830 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Tue, 21 Feb 2017 22:42:18 -0500 Subject: Updated AplicomProtocol to record KEY_VIN; --- src/org/traccar/protocol/AplicomProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index bcaac5349..92e0d178c 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -490,7 +490,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { break; } buf.readUnsignedByte(); - buf.readBytes(17); // vin + position.set(Position.KEY_VIN, buf.readBytes(17).toString()); position.set("towedDetectionStatus", buf.readUnsignedByte()); } else if (type == 0x0E) { buf.skipBytes(length); -- cgit v1.2.3 From b07810ad2567088dee585e5fcc18f5a3b8881285 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Tue, 21 Feb 2017 23:30:45 -0500 Subject: Fixed TotemProtocol to only record vdop and pdop while parsing PATTERN1; Increased maximum MethodLength to 160; --- checkstyle.xml | 5 ++++- src/org/traccar/protocol/TotemProtocolDecoder.java | 15 ++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/checkstyle.xml b/checkstyle.xml index 9d0314b06..7d52f4225 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -67,7 +67,10 @@ - + + + + diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index db25a3f17..3f8d66a2b 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -50,9 +50,9 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { .number("(dd)(dd)(dd)") // date .expression("[^*]*").text("*") .number("xx|") // checksum - .number("(d+.d+)|") // pdop + .number("(d+.d+)|") // pdop .number("(d+.d+)|") // hdop - .number("(d+.d+)|") // vdop + .number("(d+.d+)|") // vdop .number("(d+)|") // io status .number("d+|") // time .number("d") // charged @@ -242,9 +242,14 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { } position.setTime(dateBuilder.getDate()); - position.set("pdop", parser.next()); - position.set(Position.KEY_HDOP, parser.next()); - position.set("vdop", parser.next()); + if (pattern == PATTERN1) { + position.set("pdop", parser.next()); + position.set(Position.KEY_HDOP, parser.next()); + position.set("vdop", parser.next()); + } else if (pattern == PATTERN2) { + position.set(Position.KEY_HDOP, parser.next()); + } + position.set(Position.PREFIX_IO + 1, parser.next()); position.set(Position.KEY_BATTERY, parser.next()); position.set(Position.KEY_POWER, parser.nextDouble()); -- cgit v1.2.3 From 0bc1784f51311a9c5f4b37423c88ec54b970fa01 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Fri, 24 Feb 2017 18:47:56 -0500 Subject: Added US_ASCII Charset to ChannelBuffer.toString() call; --- src/org/traccar/protocol/AplicomProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 92e0d178c..daa8844b4 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -490,7 +490,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { break; } buf.readUnsignedByte(); - position.set(Position.KEY_VIN, buf.readBytes(17).toString()); + position.set(Position.KEY_VIN, buf.readBytes(17).toString(StandardCharsets.US_ASCII)); position.set("towedDetectionStatus", buf.readUnsignedByte()); } else if (type == 0x0E) { buf.skipBytes(length); -- cgit v1.2.3 From 7152670b20a40de809db57ae21acb73c5ad5bea5 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 25 Feb 2017 18:33:39 -0500 Subject: Reduced the size of TotemProtocolDecoder.decode() to meet checkstyle restrictions; --- checkstyle.xml | 5 +---- src/org/traccar/protocol/TotemProtocolDecoder.java | 21 ++++++++------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/checkstyle.xml b/checkstyle.xml index 7d52f4225..a1d93e700 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -67,10 +67,7 @@ - - - - + diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 3f8d66a2b..86ee09d95 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -218,11 +218,11 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ALARM, decodeAlarm(Short.parseShort(parser.next(), 16))); } DateBuilder dateBuilder = new DateBuilder(); - int year = 0; + int year = 0, month = 0, day = 0; if (pattern == PATTERN2) { - dateBuilder.setDay(parser.nextInt()).setMonth(parser.nextInt()); - year = parser.nextInt(); - dateBuilder.setYear(year); + day = parser.nextInt(); + month = parser.nextInt(); + year = parser.nextInt(); } dateBuilder.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); @@ -233,13 +233,14 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.setCourse(parser.nextDouble()); if (pattern == PATTERN1) { - dateBuilder.setDay(parser.nextInt()).setMonth(parser.nextInt()); - year = parser.nextInt(); - dateBuilder.setYear(year); + day = parser.nextInt(); + month = parser.nextInt(); + year = parser.nextInt(); } if (year == 0) { return null; // ignore invalid data } + dateBuilder.setDate(year, month, day); position.setTime(dateBuilder.getDate()); if (pattern == PATTERN1) { @@ -286,19 +287,15 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.next().equals("A")); position.set(Position.KEY_SATELLITES, parser.next()); - position.setCourse(parser.nextDouble()); position.setSpeed(parser.nextDouble()); - position.set("pdop", parser.next()); - position.set(Position.KEY_ODOMETER, parser.next()); position.setLatitude(parser.nextCoordinate()); position.setLongitude(parser.nextCoordinate()); } else if (pattern == PATTERN4) { - position.set(Position.KEY_STATUS, parser.next()); DateBuilder dateBuilder = new DateBuilder() @@ -323,14 +320,12 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.setCourse(parser.nextDouble()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); - position.set(Position.KEY_HDOP, parser.nextDouble()); position.set(Position.KEY_ODOMETER, parser.nextInt() * 1000); position.setValid(true); position.setLatitude(parser.nextCoordinate()); position.setLongitude(parser.nextCoordinate()); - } if (channel != null) { channel.write("ACK OK\r\n"); -- cgit v1.2.3