diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-10-25 18:52:12 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-10-25 18:52:12 -0700 |
commit | 0dab261a9ec77811c073b328018675d5f9d71fe6 (patch) | |
tree | d2d3cd389bead742bf4b5d03e3f3ff6bdfe05247 | |
parent | 36bcdfc80dc19bc932f03bc8a0da056f46023304 (diff) | |
download | trackermap-server-0dab261a9ec77811c073b328018675d5f9d71fe6.tar.gz trackermap-server-0dab261a9ec77811c073b328018675d5f9d71fe6.tar.bz2 trackermap-server-0dab261a9ec77811c073b328018675d5f9d71fe6.zip |
Handle no cell info
-rw-r--r-- | src/main/java/org/traccar/protocol/WatchProtocolDecoder.java | 4 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java index a6b89dde4..4990cfd65 100644 --- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java @@ -143,8 +143,8 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { int cellCount = Integer.parseInt(values[index++]); index += 1; // timing advance - int mcc = Integer.parseInt(values[index++]); - int mnc = Integer.parseInt(values[index++]); + int mcc = !values[index].isEmpty() ? Integer.parseInt(values[index++]) : 0; + int mnc = !values[index].isEmpty() ? Integer.parseInt(values[index++]) : 0; for (int i = 0; i < cellCount; i++) { network.addCellTower(CellTower.from(mcc, mnc, diff --git a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java index 4544b5827..98e83f491 100644 --- a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java @@ -20,6 +20,9 @@ public class WatchProtocolDecoderTest extends ProtocolTest { Position.PREFIX_TEMP + 1, 35.29); verifyPosition(decoder, buffer( + "[SG*9059056143*0053*UD,251021,223408,A,41.46500,N,081.53128,W,0.926,000,0,00,70,70,0,50,00000000,0,1,,,,00]")); + + verifyPosition(decoder, buffer( "[3G*2104326058*00E9*UD_LTE,300621,135101,A,32.162652,N,34.888748,E,30.84,265.158,65.621,18,100,83,0,0,00000000,1,1,425,01,10223,8012811,100,3,ES4104,22:74:1d:39:64:ff,-46,metropoline-wifi,a8:3f:a1:e0:66:ba,-89,Egged.co.il,00:0c:42:51:cf:cd,-81,1.7055488]")); verifyPosition(decoder, buffer( |