aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorjon-stumpf <jon.stumpf@gmail.com>2017-02-20 19:47:07 -0500
committerjon-stumpf <jon.stumpf@gmail.com>2017-02-20 19:47:07 -0500
commit21d8146fc216df827c156b446221c2bc01f05a6f (patch)
tree63972b4df6d5d9180c5c65610bb8ea375d01b984 /src/org/traccar
parentb67f1e828ce5bc8fe215d377cd2ae81f23152abd (diff)
downloadtrackermap-server-21d8146fc216df827c156b446221c2bc01f05a6f.tar.gz
trackermap-server-21d8146fc216df827c156b446221c2bc01f05a6f.tar.bz2
trackermap-server-21d8146fc216df827c156b446221c2bc01f05a6f.zip
Updated protocols to record CellTower information where appropriate; Removed KEY_RSSI when reported in CellTower;
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java16
-rw-r--r--src/org/traccar/protocol/BceProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/FlextrackProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java29
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/TrvProtocolDecoder.java4
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;
}