diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/WatchProtocolDecoder.java | 11 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java index cf58b0fed..4ab7875b7 100644 --- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java @@ -149,9 +149,14 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { int mnc = !values[index].isEmpty() ? Integer.parseInt(values[index++]) : 0; for (int i = 0; i < cellCount; i++) { - network.addCellTower(CellTower.from(mcc, mnc, - Integer.parseInt(values[index++]), Integer.parseInt(values[index++]), - Integer.parseInt(values[index++]))); + int lac = Integer.parseInt(values[index++]); + int cid = Integer.parseInt(values[index++]); + String rssi = values[index++]; + if (!rssi.isEmpty()) { + network.addCellTower(CellTower.from(mcc, mnc, lac, cid, Integer.parseInt(rssi))); + } else { + network.addCellTower(CellTower.from(mcc, mnc, lac, cid)); + } } if (index < values.length && !values[index].isEmpty()) { diff --git a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java index 98e83f491..4fab19f26 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*9159059735*0066*UD2,230322,082138,A,59.55285,N,016.66185,E,0.0,000,26,14,80,70,0,50,00000000,1,1,240,7,34505,80806406,,00]")); + + 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( |