diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-01-24 23:08:16 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-01-24 23:08:16 -0800 |
commit | 08c744db5dd60956827c6002841c30067ae55744 (patch) | |
tree | 3b052dbaeeb9e9fd4b5db30fe60ced6f23af2ad2 /src | |
parent | 6ff2508c0019c443da7b943f2f71eb9221c47f55 (diff) | |
download | trackermap-server-08c744db5dd60956827c6002841c30067ae55744.tar.gz trackermap-server-08c744db5dd60956827c6002841c30067ae55744.tar.bz2 trackermap-server-08c744db5dd60956827c6002841c30067ae55744.zip |
Handle Vodofo protocol differences
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/UproProtocolDecoder.java | 12 |
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)); |