aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-18 10:56:46 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-03-18 10:56:46 +1300
commit8beecc6b90975c972ba76ffbb5a7c975de25530c (patch)
treebf51d20961b8ca87be146c2e1299da2babe5066a
parenta32c9c12179efef2db2e04e86da446e23b6284a3 (diff)
downloadtraccar-server-8beecc6b90975c972ba76ffbb5a7c975de25530c.tar.gz
traccar-server-8beecc6b90975c972ba76ffbb5a7c975de25530c.tar.bz2
traccar-server-8beecc6b90975c972ba76ffbb5a7c975de25530c.zip
Add driver id for StarLink protocol
-rw-r--r--src/org/traccar/protocol/StarLinkProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/StarLinkProtocolDecoderTest.java6
2 files changed, 13 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/org/traccar/protocol/StarLinkProtocolDecoder.java
index da293f022..eaee07870 100644
--- a/src/org/traccar/protocol/StarLinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/StarLinkProtocolDecoder.java
@@ -96,6 +96,7 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
String[] data = parser.next().split(",");
Integer lac = null, cid = null;
+ int event = 0;
for (int i = 0; i < Math.min(data.length, dataTags.length); i++) {
switch (dataTags[i]) {
@@ -103,7 +104,8 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceTime(dateFormat.parse(data[i]));
break;
case "#EID#":
- position.set(Position.KEY_EVENT, data[i]);
+ event = Integer.parseInt(data[i]);
+ position.set(Position.KEY_EVENT, event);
break;
case "#PDT#":
position.setFixTime(dateFormat.parse(data[i]));
@@ -177,6 +179,10 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
position.setNetwork(new Network(CellTower.fromLacCid(lac, cid)));
}
+ if (event == 20) {
+ position.set(Position.KEY_RFID, data[data.length - 1]);
+ }
+
return position;
}
diff --git a/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java b/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java
index 8bd4427b3..d102ba426 100644
--- a/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class StarLinkProtocolDecoderTest extends ProtocolTest {
StarLinkProtocolDecoder decoder = new StarLinkProtocolDecoder(new StarLinkProtocol());
verifyPosition(decoder, text(
+ "$SLU0330D5,06,3556,170314063523,19,170314061634,+3211.7187,+03452.8106,000.0,332,015074,1,1,0,0,0,0,0,0,10443,32722,12.870,03.790,,0,0*FC"));
+
+ verifyPosition(decoder, text(
+ "$SLU0330D5,06,3555,170314063453,20,170314061634,+3211.7187,+03452.8106,000.0,332,015074,1,1,0,0,0,0,0,0,10443,32722,12.838,03.790,,0,0,1,,1122*74"));
+
+ verifyPosition(decoder, text(
"$SLU006968,06,375153,170117051824,01,170117051823,+3203.2073,+03448.1360,000.0,300,085725,1,1,0,0,0,0,0,0,10422,36201,12.655,04.085,,0,0,0,99*45"));
verifyPosition(decoder, text(