aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-01-24 23:08:16 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-01-24 23:08:16 -0800
commit08c744db5dd60956827c6002841c30067ae55744 (patch)
tree3b052dbaeeb9e9fd4b5db30fe60ced6f23af2ad2 /src/org/traccar
parent6ff2508c0019c443da7b943f2f71eb9221c47f55 (diff)
downloadtrackermap-server-08c744db5dd60956827c6002841c30067ae55744.tar.gz
trackermap-server-08c744db5dd60956827c6002841c30067ae55744.tar.bz2
trackermap-server-08c744db5dd60956827c6002841c30067ae55744.zip
Handle Vodofo protocol differences
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/UproProtocolDecoder.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/UproProtocolDecoder.java b/src/org/traccar/protocol/UproProtocolDecoder.java
index c5b72ea0a..dc7a9200d 100644
--- a/src/org/traccar/protocol/UproProtocolDecoder.java
+++ b/src/org/traccar/protocol/UproProtocolDecoder.java
@@ -164,11 +164,13 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
position.set("statusExtended", data.toString(StandardCharsets.US_ASCII));
break;
case 'P':
- position.setNetwork(new Network(CellTower.from(
- Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII)),
- Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII)),
- Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII), 16),
- Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII), 16))));
+ if (data.readableBytes() >= 16) {
+ position.setNetwork(new Network(CellTower.from(
+ Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII)),
+ Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII)),
+ Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII), 16),
+ Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII), 16))));
+ }
break;
case 'Q':
position.set("obdPid", ByteBufUtil.hexDump(data));