aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Arnavi4ProtocolDecoder.java
diff options
context:
space:
mode:
authorIvan Muratov <binakot@gmail.com>2017-07-13 09:15:54 +0300
committerIvan Muratov <binakot@gmail.com>2017-07-13 09:15:54 +0300
commita2376cf6354a94c8bd8c8e13c4e78936d4f2ae97 (patch)
tree7516026071e88fd1fdc37fd7d00372f08f57710a /src/org/traccar/protocol/Arnavi4ProtocolDecoder.java
parent93227f9bffdfce2f1d60a61ea88f4eb152dfada5 (diff)
parentf643173b6b2c52a3896d6ee13578edd86f9eb3e7 (diff)
downloadtrackermap-server-a2376cf6354a94c8bd8c8e13c4e78936d4f2ae97.tar.gz
trackermap-server-a2376cf6354a94c8bd8c8e13c4e78936d4f2ae97.tar.bz2
trackermap-server-a2376cf6354a94c8bd8c8e13c4e78936d4f2ae97.zip
Merge branch 'anravi4_fix'
Diffstat (limited to 'src/org/traccar/protocol/Arnavi4ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Arnavi4ProtocolDecoder.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/Arnavi4ProtocolDecoder.java b/src/org/traccar/protocol/Arnavi4ProtocolDecoder.java
index 46caebb71..c5ec3f31f 100644
--- a/src/org/traccar/protocol/Arnavi4ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Arnavi4ProtocolDecoder.java
@@ -15,7 +15,11 @@ import java.util.Date;
import java.util.LinkedList;
import java.util.List;
-import static org.traccar.protocol.Arnavi4FrameDecoder.*;
+import static org.traccar.protocol.Arnavi4FrameDecoder.HEADER_START_SIGN;
+import static org.traccar.protocol.Arnavi4FrameDecoder.HEADER_VERSION_1;
+import static org.traccar.protocol.Arnavi4FrameDecoder.HEADER_VERSION_2;
+import static org.traccar.protocol.Arnavi4FrameDecoder.PACKAGE_START_SIGN;
+import static org.traccar.protocol.Arnavi4FrameDecoder.PACKAGE_END_SIGN;
/**
* Created by Ivan Muratov @binakot on 11.07.2017.
@@ -99,9 +103,9 @@ public class Arnavi4ProtocolDecoder extends BaseProtocolDecoder {
} else if (version == HEADER_VERSION_2) {
response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 9);
response.writeBytes(new byte[]{0x7B, 0x04, 0x00});
- byte[] timestampBytes = ByteBuffer.allocate(4).putInt((int) (System.currentTimeMillis() / 1000)).array();
- response.writeByte(Checksum.modulo256(timestampBytes));
- response.writeBytes(timestampBytes);
+ byte[] timeBytes = ByteBuffer.allocate(4).putInt((int) (System.currentTimeMillis() / 1000)).array();
+ response.writeByte(Checksum.modulo256(timeBytes));
+ response.writeBytes(timeBytes);
response.writeByte(0x7D);
} else {
@@ -132,7 +136,7 @@ public class Arnavi4ProtocolDecoder extends BaseProtocolDecoder {
case RECORD_DATA:
case RECORD_TEXT:
case RECORD_FILE:
- case RECORD_BINARY: {
+ case RECORD_BINARY:
int length = buf.readUnsignedShort();
long timestamp = buf.readUnsignedInt() * 1000;
ChannelBuffer recordBuf = buf.readBytes(length);
@@ -142,9 +146,7 @@ public class Arnavi4ProtocolDecoder extends BaseProtocolDecoder {
}
buf.readUnsignedByte(); // crc
-
break;
- }
default:
throw new IllegalArgumentException("unsupported record type");