aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-15 14:07:39 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-15 14:07:39 +1300
commitcfe237cf26c6309b8431b3b81d589628ae363804 (patch)
tree64aa120e80bb91e1e8de3995b6dd1494a8962217
parentf9f37325f1161ddc2b726171e8af0dbb25787c6e (diff)
downloadtrackermap-server-cfe237cf26c6309b8431b3b81d589628ae363804.tar.gz
trackermap-server-cfe237cf26c6309b8431b3b81d589628ae363804.tar.bz2
trackermap-server-cfe237cf26c6309b8431b3b81d589628ae363804.zip
Rename cell attribute to cid
-rw-r--r--src/org/traccar/model/Event.java2
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Avl301ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/BceProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/CastelProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/FlextrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/T800xProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TrvProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TzoneProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java2
-rw-r--r--test/org/traccar/ProtocolDecoderTest.java21
22 files changed, 41 insertions, 24 deletions
diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java
index 832e0e7c5..1dbfe5812 100644
--- a/src/org/traccar/model/Event.java
+++ b/src/org/traccar/model/Event.java
@@ -36,7 +36,7 @@ public abstract class Event extends Extensible {
public static final String KEY_MCC = "mcc";
public static final String KEY_MNC = "mnc";
public static final String KEY_LAC = "lac";
- public static final String KEY_CELL = "cell";
+ public static final String KEY_CID = "cid";
public static final String KEY_FUEL = "fuel";
public static final String KEY_RFID = "rfid";
public static final String KEY_VERSION = "version";
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index e939cb88d..2f0d692e9 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -95,7 +95,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_GSM, buf.readUnsignedByte());
break;
case "CE":
- position.set(Event.KEY_CELL, buf.readUnsignedInt());
+ position.set(Event.KEY_CID, buf.readUnsignedInt());
break;
case "LC":
position.set(Event.KEY_LAC, buf.readUnsignedShort());
diff --git a/src/org/traccar/protocol/Avl301ProtocolDecoder.java b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
index 67ea223fa..1b0ee89a7 100644
--- a/src/org/traccar/protocol/Avl301ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
@@ -115,7 +115,7 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
}
position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedMedium());
+ position.set(Event.KEY_CID, buf.readUnsignedMedium());
position.set(Event.KEY_ALARM, true);
int flags = buf.readUnsignedByte();
position.set("acc", (flags & 0x2) != 0);
diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java
index ef70f93d4..c5aa2693f 100644
--- a/src/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/org/traccar/protocol/BceProtocolDecoder.java
@@ -129,7 +129,7 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_MCC, buf.readUnsignedShort());
position.set(Event.KEY_MNC, buf.readUnsignedByte());
position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_CID, buf.readUnsignedShort());
position.set(Event.KEY_GSM, buf.readUnsignedByte());
buf.readUnsignedByte();
}
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java
index 7d4182f7c..4e5bef9f5 100644
--- a/src/org/traccar/protocol/CastelProtocolDecoder.java
+++ b/src/org/traccar/protocol/CastelProtocolDecoder.java
@@ -200,7 +200,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // additional flags
position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_CID, buf.readUnsignedShort());
positions.add(position);
}
diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
index 213dd90d0..4d9d93544 100644
--- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java
+++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
@@ -117,7 +117,7 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_MCC, parser.nextInt());
position.set(Event.KEY_MNC, parser.nextInt());
position.set(Event.KEY_LAC, parser.nextInt());
- position.set(Event.KEY_CELL, parser.nextInt());
+ position.set(Event.KEY_CID, parser.nextInt());
return position;
}
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 6d77abc1b..b3a062db3 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -86,7 +86,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
position.setCourse(buf.readUnsignedShort());
- position.set(Event.KEY_CELL, ChannelBuffers.hexDump(buf.readBytes(9)));
+ position.set(Event.KEY_CID, ChannelBuffers.hexDump(buf.readBytes(9)));
position.setValid((buf.readUnsignedByte() & 0x01) != 0);
diff --git a/src/org/traccar/protocol/FlextrackProtocolDecoder.java b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
index a8acc42be..363d5502c 100644
--- a/src/org/traccar/protocol/FlextrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
@@ -125,7 +125,7 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(parser.nextInt());
position.set(Event.KEY_HDOP, parser.nextInt() * 0.1);
- position.set(Event.KEY_CELL, parser.next());
+ position.set(Event.KEY_CID, parser.next());
position.set(Event.KEY_LAC, parser.next());
position.set(Event.KEY_ODOMETER, parser.nextInt());
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index bf481667e..29884bb00 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -218,7 +218,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_MCC, parser.next());
position.set(Event.KEY_MNC, parser.next());
position.set(Event.KEY_LAC, parser.next());
- position.set(Event.KEY_CELL, parser.next());
+ position.set(Event.KEY_CID, parser.next());
position.set(Event.KEY_ODOMETER, parser.next());
position.set(Event.KEY_BATTERY, parser.next());
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 632e71a8f..486539bc1 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -143,7 +143,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_MCC, buf.readUnsignedShort());
position.set(Event.KEY_MNC, buf.readUnsignedByte());
position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedMedium());
+ position.set(Event.KEY_CID, buf.readUnsignedMedium());
if (lbsLength > 0) {
buf.skipBytes(lbsLength - 9);
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 116625ee9..d9e31fe48 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -94,7 +94,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_CID, buf.readUnsignedShort());
position.set(Event.KEY_LAC, buf.readUnsignedShort());
position.set(Event.KEY_GSM, buf.readUnsignedByte());
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index 3deff20a8..a58e57703 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -295,7 +295,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_ODOMETER, parser.nextDouble());
position.set(Event.KEY_MCC, parser.nextInt());
position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_CELL, parser.next());
+ position.set(Event.KEY_CID, parser.next());
String gsm = parser.next();
if (gsm != null) {
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 3bc27f55c..046162331 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -283,7 +283,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
}
- position.set(Event.KEY_CELL, parser.next());
+ position.set(Event.KEY_CID, parser.next());
if (parser.hasNext()) {
position.set(Event.KEY_GSM, parser.nextInt(16));
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index 86fcac375..2b8460fc7 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -122,7 +122,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_MCC, parser.next());
position.set(Event.KEY_MCC, parser.next());
position.set(Event.KEY_LAC, parser.next());
- position.set(Event.KEY_CELL, parser.next());
+ position.set(Event.KEY_CID, parser.next());
position.set(Event.KEY_STATUS, parser.next());
for (int i = 1; i <= 3; i++) {
@@ -198,7 +198,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_MCC, buf.readUnsignedShort());
position.set(Event.KEY_MCC, buf.readUnsignedShort());
position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_CID, buf.readUnsignedShort());
position.set(Event.KEY_STATUS, buf.readUnsignedShort());
position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort());
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index 81a7c3041..b0d85b101 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -83,7 +83,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_CELL, parser.next());
+ position.set(Event.KEY_CID, parser.next());
position.setValid(true);
position.setLatitude(parser.nextDouble());
diff --git a/src/org/traccar/protocol/T800xProtocolDecoder.java b/src/org/traccar/protocol/T800xProtocolDecoder.java
index ab62110ba..2127be331 100644
--- a/src/org/traccar/protocol/T800xProtocolDecoder.java
+++ b/src/org/traccar/protocol/T800xProtocolDecoder.java
@@ -146,7 +146,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_MCC, buf.readUnsignedShort());
position.set(Event.KEY_MNC, buf.readUnsignedShort());
position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_CID, buf.readUnsignedShort());
// two more cell towers
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 830df2b96..3592cae79 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -115,7 +115,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(locationMask, 5)) {
position.set("area", buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_CID, buf.readUnsignedShort());
}
if (BitUtil.check(locationMask, 6)) {
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index d7e77f8f2..d9d50947e 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -86,7 +86,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
position.setDeviceId(getDeviceId());
- position.set(Event.KEY_CELL, parser.next());
+ position.set(Event.KEY_CID, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
diff --git a/src/org/traccar/protocol/TrvProtocolDecoder.java b/src/org/traccar/protocol/TrvProtocolDecoder.java
index fe1162d24..67713cafc 100644
--- a/src/org/traccar/protocol/TrvProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrvProtocolDecoder.java
@@ -114,7 +114,7 @@ public class TrvProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_MCC, parser.nextInt());
position.set(Event.KEY_MNC, parser.nextInt());
position.set(Event.KEY_LAC, parser.nextInt());
- position.set(Event.KEY_CELL, parser.nextInt());
+ position.set(Event.KEY_CID, parser.nextInt());
return position;
}
diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java
index be62d23d7..4e37863fa 100644
--- a/src/org/traccar/protocol/TzoneProtocolDecoder.java
+++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java
@@ -101,7 +101,7 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder {
if (blockLength > 0) {
position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_CID, buf.readUnsignedShort());
}
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index 68d04906d..5d882ffd8 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -142,7 +142,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_MCC, buf.readUnsignedShort());
position.set(Event.KEY_MNC, buf.readUnsignedByte());
position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CELL, buf.readUnsignedShort());
+ position.set(Event.KEY_CID, buf.readUnsignedShort());
position.set(Event.KEY_GSM, -buf.readUnsignedByte());
break;
diff --git a/test/org/traccar/ProtocolDecoderTest.java b/test/org/traccar/ProtocolDecoderTest.java
index a142f2d4d..2906f2002 100644
--- a/test/org/traccar/ProtocolDecoderTest.java
+++ b/test/org/traccar/ProtocolDecoderTest.java
@@ -8,6 +8,7 @@ import org.jboss.netty.handler.codec.http.HttpVersion;
import org.junit.Assert;
import org.traccar.database.IdentityManager;
import org.traccar.model.Device;
+import org.traccar.model.Event;
import org.traccar.model.Position;
import javax.xml.bind.DatatypeConverter;
@@ -18,6 +19,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import java.util.TimeZone;
public class ProtocolDecoderTest {
@@ -179,12 +181,27 @@ public class ProtocolDecoderTest {
}
+ Map<String, Object> attributes = position.getAttributes();
+
if (checkAttributes) {
+ Assert.assertFalse("no attributes", attributes.isEmpty());
+ }
- Assert.assertFalse("no attributes", position.getAttributes().isEmpty());
+ /*if (attributes.containsKey(Event.KEY_LAC) || attributes.containsKey(Event.KEY_CID)) {
+ checkInteger(attributes.get(Event.KEY_MCC), 100, 999);
+ checkInteger(attributes.get(Event.KEY_MNC), 0, 999);
+ checkInteger(attributes.get(Event.KEY_LAC), 1, 65535);
+ checkInteger(attributes.get(Event.KEY_CID), 1, 65535);
+ }*/
- }
+ }
+ private void checkInteger(Object value, int min, int max) {
+ Assert.assertNotNull("value is null", value);
+ Assert.assertTrue("not int or long", value instanceof Integer || value instanceof Long);
+ long number = ((Number) value).longValue();
+ Assert.assertTrue("value too low", number >= min);
+ Assert.assertTrue("value too high", number <= max);
}
}