aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-26 15:12:08 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-02-26 15:12:08 +1300
commit3302d7cf5e7d776da723b811f7daf7a7bd24bb25 (patch)
tree1cfa8a9394e10aabb7e5f90f9c883a539f309ae1 /src/org/traccar
parentaea5d9e8df58b37c937db87a272a9d92c64586f5 (diff)
downloadtrackermap-server-3302d7cf5e7d776da723b811f7daf7a7bd24bb25.tar.gz
trackermap-server-3302d7cf5e7d776da723b811f7daf7a7bd24bb25.tar.bz2
trackermap-server-3302d7cf5e7d776da723b811f7daf7a7bd24bb25.zip
Some minor clean up
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/model/Position.java1
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/CellocatorProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/TramigoProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/Tt8850ProtocolDecoder.java5
9 files changed, 25 insertions, 34 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index 18e7f7f46..96dc1d2ad 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -23,6 +23,7 @@ public class Position extends Message {
public static final String KEY_INDEX = "index";
public static final String KEY_HDOP = "hdop";
public static final String KEY_VDOP = "vdop";
+ public static final String KEY_PDOP = "pdop";
public static final String KEY_SATELLITES = "sat"; // in use
public static final String KEY_SATELLITES_VISIBLE = "satVisible";
public static final String KEY_RSSI = "rssi";
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index e2868692e..c4b9d512e 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -99,14 +99,13 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
cellTower.setSignalStrength((int) buf.readUnsignedByte());
break;
case "CE":
- cellTower.setCellId(buf.readUnsignedInt()); // cid
+ cellTower.setCellId(buf.readUnsignedInt());
break;
case "LC":
- cellTower.setLocationAreaCode(buf.readUnsignedShort()); // lac
+ cellTower.setLocationAreaCode(buf.readUnsignedShort());
break;
case "CN":
- int combinedMobileCodes; // Decimal: CCCNN
- combinedMobileCodes = (int) (buf.readUnsignedInt() % 100000);
+ int combinedMobileCodes = (int) (buf.readUnsignedInt() % 100000); // cccnn
cellTower.setMobileCountryCode(combinedMobileCodes / 100);
cellTower.setMobileNetworkCode(combinedMobileCodes % 100);
break;
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index 22a4dee42..1087c8c43 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -88,11 +88,9 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_TEMP + 1, buf.readByte());
int rssi = buf.readUnsignedByte();
- CellTower cellTower = CellTower.from(buf.readUnsignedShort(),
- buf.readUnsignedShort(),
- buf.readUnsignedShort(),
- buf.readUnsignedShort(),
- rssi);
+ CellTower cellTower = CellTower.from(
+ buf.readUnsignedShort(), buf.readUnsignedShort(),
+ buf.readUnsignedShort(), buf.readUnsignedShort(), rssi);
position.setNetwork(new Network(cellTower));
int valid = buf.readUnsignedByte();
@@ -187,7 +185,6 @@ 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/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
index 970f0ee4c..655fadfbd 100644
--- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
@@ -122,14 +122,14 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte()));
buf.readUnsignedByte(); // mode
- buf.readUnsignedInt(); // IO
+ buf.readUnsignedInt(); // io
operator <<= 8;
operator += buf.readUnsignedByte();
position.set("operator", operator);
- buf.readUnsignedInt(); // ADC
- buf.readUnsignedMedium(); // Odometer
+ buf.readUnsignedInt(); // adc
+ buf.readUnsignedMedium(); // odometer
buf.skipBytes(6); // multi-purpose data
buf.readUnsignedShort(); // gps fix
@@ -137,10 +137,9 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // mode 1
buf.readUnsignedByte(); // mode 2
- int satellites = buf.readUnsignedByte();
- position.setValid(satellites >= 3);
- position.set(Position.KEY_SATELLITES, satellites);
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
+ position.setValid(true);
position.setLongitude(buf.readInt() / Math.PI * 180 / 100000000);
position.setLatitude(buf.readInt() / Math.PI * 180 / 100000000.0);
position.setAltitude(buf.readInt() * 0.01);
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index b730c2feb..e632b32d8 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -110,12 +110,8 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_BATTERY, battery + "%");
}
- int cid = buf.readUnsignedShort();
- int lac = buf.readUnsignedShort();
- int rssi = buf.readUnsignedByte();
-
- CellTower cellTower = CellTower.fromCidLac(cid, lac);
- cellTower.setSignalStrength(rssi);
+ CellTower cellTower = CellTower.fromCidLac(buf.readUnsignedShort(), buf.readUnsignedShort());
+ cellTower.setSignalStrength((int) buf.readUnsignedByte());
position.setNetwork(new Network(cellTower));
position.set(Position.KEY_INDEX, buf.readUnsignedByte());
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index 3f75d76da..4862b4937 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 (rssi)
+ .number("(d+),") // 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 id (cid)
+ .number("(x+),") // cid
.number("(x+),") // state
.number("(x+)?|") // adc1
.number("(x+)?|") // adc2
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index 86ee09d95..6a4b2052c 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -244,10 +244,10 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
if (pattern == PATTERN1) {
- position.set("pdop", parser.next());
+ position.set(Position.KEY_PDOP, parser.next());
position.set(Position.KEY_HDOP, parser.next());
- position.set("vdop", parser.next());
- } else if (pattern == PATTERN2) {
+ position.set(Position.KEY_VDOP, parser.next());
+ } else {
position.set(Position.KEY_HDOP, parser.next());
}
diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java
index d5cddb3d2..73356ccfc 100644
--- a/src/org/traccar/protocol/TramigoProtocolDecoder.java
+++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java
@@ -82,10 +82,10 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(buf.readUnsignedInt() * 0.0000001);
position.setLongitude(buf.readUnsignedInt() * 0.0000001);
- 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.set(Position.KEY_RSSI, buf.readUnsignedShort());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedShort());
+ position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedShort());
+ buf.readUnsignedShort(); // gps antenna state
position.setSpeed(buf.readUnsignedShort() * 0.194384);
position.setCourse((double) buf.readUnsignedShort());
diff --git a/src/org/traccar/protocol/Tt8850ProtocolDecoder.java b/src/org/traccar/protocol/Tt8850ProtocolDecoder.java
index c9cb0bb28..32e20c272 100644
--- a/src/org/traccar/protocol/Tt8850ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tt8850ProtocolDecoder.java
@@ -79,9 +79,8 @@ public class Tt8850ProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(deviceSession.getDeviceId());
- int accuracy = parser.nextInt();
- position.setValid(accuracy < 20);
- position.setAccuracy(accuracy);
+ position.setValid(true);
+ position.setAccuracy(parser.nextInt());
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
position.setCourse(parser.nextDouble());
position.setAltitude(parser.nextDouble());