diff options
-rw-r--r-- | src/org/traccar/protocol/StarLinkProtocolDecoder.java | 8 | ||||
-rw-r--r-- | test/org/traccar/protocol/StarLinkProtocolDecoderTest.java | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/org/traccar/protocol/StarLinkProtocolDecoder.java index 8d35ea5ba..97091257f 100644 --- a/src/org/traccar/protocol/StarLinkProtocolDecoder.java +++ b/src/org/traccar/protocol/StarLinkProtocolDecoder.java @@ -151,10 +151,14 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_OUT + 4, Integer.parseInt(data[i])); break; case "#LAC#": - lac = Integer.parseInt(data[i]); + if (!data[i].isEmpty()) { + lac = Integer.parseInt(data[i]); + } break; case "#CID#": - cid = Integer.parseInt(data[i]); + if (!data[i].isEmpty()) { + cid = Integer.parseInt(data[i]); + } break; case "#VIN#": position.set(Position.KEY_POWER, Double.parseDouble(data[i])); diff --git a/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java b/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java index d102ba426..8726b1e18 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( + "$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")); + + verifyPosition(decoder, text( + "$SLU031B2B,06,624,170329035143,01,170329035143,+3158.0171,+03446.6742,006.8,326,000099,1,1,0,0,0,0,0,0,10452,8723,14.212,03.827,,1,1,1,4*6D")); + + 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( |