aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorEvgeny S Maksimov <admin@vragam.net>2019-01-21 19:27:15 +0300
committerEvgeny S Maksimov <admin@vragam.net>2019-01-21 19:27:15 +0300
commit3a0bcff44aba8b15d97a669dc8c959830644a8bd (patch)
tree1080169764fd2e13780163e6fbe5dbb6b25f8ec6 /src/org
parent39b3237120f9c5637928e1f444785b02db888ae3 (diff)
downloadtraccar-server-3a0bcff44aba8b15d97a669dc8c959830644a8bd.tar.gz
traccar-server-3a0bcff44aba8b15d97a669dc8c959830644a8bd.tar.bz2
traccar-server-3a0bcff44aba8b15d97a669dc8c959830644a8bd.zip
Fixed two-field parameters
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java
index e4664444e..ec1a1324b 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -329,6 +329,9 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(deviceSession.getDeviceId());
long index = 0;
+ int status = 0;
+ short input = 0;
+ short output = 0;
for (int i = 0; i < flexBitfieldDataSize; i++) {
if ((flexBitfield[(int) (i / 8)] & (0x80 >> i % 8)) == 0) {
@@ -336,10 +339,6 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
continue;
}
- int status = 0;
- short input = 0;
- short output = 0;
-
switch (i) {
case 0:
index = buf.readUnsignedIntLE();
@@ -361,7 +360,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
break;
case 5:
int status2 = buf.readUnsignedByte();
- position.set(Position.KEY_STATUS, (short) ((status & 0xFF) | (status2 << 1)));
+ position.set(Position.KEY_STATUS, (short) ((status & 0xFF) | (status2 << 8)));
break;
case 6:
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
@@ -420,7 +419,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
break;
case 29:
short input2 = buf.readUnsignedByte();
- position.set(Position.KEY_INPUT, (short) ((input & 0xFF) | (input2 << 1)));
+ position.set(Position.KEY_INPUT, (short) ((input & 0xFF) | (input2 << 8)));
for (int k = 0; k < 8; k++) {
position.set(Position.PREFIX_IN + (k + 9), BitUtil.check(input2, k));
}
@@ -434,7 +433,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
break;
case 31:
short output2 = buf.readUnsignedByte();
- position.set(Position.KEY_OUTPUT, (short) ((output & 0xFF) | (output2 << 1)));
+ position.set(Position.KEY_OUTPUT, (short) ((output & 0xFF) | (output2 << 8)));
for (int k = 0; k < 8; k++) {
position.set(Position.PREFIX_OUT + (k + 9), BitUtil.check(output2, k));
}