aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorEvgeny S Maksimov <admin@vragam.net>2019-01-29 19:55:31 +0300
committerEvgeny S Maksimov <admin@vragam.net>2019-01-29 19:55:31 +0300
commite9d77d16a99874ef4c5eb44dc15994811d724b9d (patch)
treec86b83024dc507cc102f7c7862e0467024899dec /src/org
parent876026ef66bfc1d664300ee0478654ceae5675c7 (diff)
downloadtrackermap-server-e9d77d16a99874ef4c5eb44dc15994811d724b9d.tar.gz
trackermap-server-e9d77d16a99874ef4c5eb44dc15994811d724b9d.tar.bz2
trackermap-server-e9d77d16a99874ef4c5eb44dc15994811d724b9d.zip
Support for downgrading the FLEX protocol version
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java
index 0bebfe0d2..f6fa75c58 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -588,24 +588,26 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
flexProtocolVersion = (byte) buf.readUnsignedByte();
flexStructVersion = (byte) buf.readUnsignedByte();
- if (flexProtocolVersion != (byte) 0x0A && flexProtocolVersion != (byte) 0x14) {
- return null;
- }
- if (flexStructVersion != (byte) 0x0A && flexStructVersion != (byte) 0x14) {
- return null;
- }
+ if ((flexProtocolVersion == (byte) 0x0A || flexProtocolVersion == (byte) 0x14)
+ && (flexStructVersion == (byte) 0x0A || flexStructVersion == (byte) 0x14)) {
- flexBitfieldDataSize = buf.readUnsignedByte();
- if (flexBitfieldDataSize > 122) {
- return null;
- }
- buf.readBytes(flexBitfield, 0, (int) Math.ceil((double) flexBitfieldDataSize / 8));
+ flexBitfieldDataSize = buf.readUnsignedByte();
+ if (flexBitfieldDataSize > 122) {
+ return null;
+ }
- flexDataSize = 0;
- for (int i = 0; i < flexBitfieldDataSize; i++) {
- if (checkFlexBitfield(i)) {
- flexDataSize += FLEX_FIELDS_SIZES[i];
+ buf.readBytes(flexBitfield, 0, (int) Math.ceil((double) flexBitfieldDataSize / 8));
+
+ flexDataSize = 0;
+ for (int i = 0; i < flexBitfieldDataSize; i++) {
+ if (checkFlexBitfield(i)) {
+ flexDataSize += FLEX_FIELDS_SIZES[i];
+ }
}
+ } else {
+ // Prepare request for downgrade of protocol version to FLEX 2.0
+ flexProtocolVersion = 0x14;
+ flexStructVersion = 0x14;
}
ByteBuf response = Unpooled.buffer(9);