aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/StarLinkProtocolDecoder.java7
-rw-r--r--test/org/traccar/protocol/StarLinkProtocolDecoderTest.java15
2 files changed, 22 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/org/traccar/protocol/StarLinkProtocolDecoder.java
index 0e9840766..8fbecc35e 100644
--- a/src/org/traccar/protocol/StarLinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/StarLinkProtocolDecoder.java
@@ -100,6 +100,9 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
int event = 0;
for (int i = 0; i < Math.min(data.length, dataTags.length); i++) {
+ if (data[i].isEmpty()) {
+ continue;
+ }
switch (dataTags[i]) {
case "#EDT#":
position.setDeviceTime(dateFormat.parse(data[i]));
@@ -180,6 +183,10 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
}
}
+ if (position.getFixTime() == null) {
+ getLastLocation(position, null);
+ }
+
if (lac != null && cid != null) {
position.setNetwork(new Network(CellTower.fromLacCid(lac, cid)));
}
diff --git a/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java b/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java
index 8726b1e18..ab50e84ca 100644
--- a/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java
@@ -10,6 +10,21 @@ public class StarLinkProtocolDecoderTest extends ProtocolTest {
StarLinkProtocolDecoder decoder = new StarLinkProtocolDecoder(new StarLinkProtocol());
+ verifyAttributes(decoder, text(
+ "$SLU068328,06,55,170518122023,16,,,,,,000000,1,1,0,0,0,0,0,0,10443,32722,12.664,03.910,,0,0,,01000001FDB3A9*BF"));
+
+ verifyAttributes(decoder, text(
+ "$SLU068328,06,56,170518122023,20,,,,,,000000,1,1,0,0,0,0,0,0,10443,32722,12.664,03.910,,0,0,2,01000001FDB3A9,00000000000000000000*D9"));
+
+ verifyAttributes(decoder, text(
+ "$SLU068328,06,57,170518122038,01,,,,,,000000,1,1,0,0,1,0,0,0,10443,32722,12.669,03.910,,0,0,0,99*6E"));
+
+ verifyAttributes(decoder, text(
+ "$SLU068328,06,58,170518122045,19,,,,,,000000,1,1,0,0,1,0,0,0,10443,32722,12.678,03.910,,0,0*7C"));
+
+ verifyAttributes(decoder, text(
+ "$SLU068328,06,59,170518122054,16,,,,,,000000,1,1,0,0,0,0,0,0,10443,32723,12.678,03.910,,0,0,01000001FDB3A9,01000001ACE0A6*BF"));
+
verifyPosition(decoder, text(
"$SLU031B2B,06,622,170329035057,01,170329035057,+3158.0018,+03446.6968,004.9,007,000099,1,1,0,0,0,0,0,0,,,14.176,03.826,,1,1,1,4*B0"));