aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/Arnavi4FrameDecoder.java2
-rw-r--r--src/org/traccar/protocol/Arnavi4ProtocolDecoder.java16
2 files changed, 10 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/Arnavi4FrameDecoder.java b/src/org/traccar/protocol/Arnavi4FrameDecoder.java
index eaf829cc3..97bf75a20 100644
--- a/src/org/traccar/protocol/Arnavi4FrameDecoder.java
+++ b/src/org/traccar/protocol/Arnavi4FrameDecoder.java
@@ -10,7 +10,7 @@ import org.jboss.netty.handler.codec.frame.FrameDecoder;
*/
public class Arnavi4FrameDecoder extends FrameDecoder {
- static final byte HEADER_START_SIGN = (byte)0xFF;
+ static final byte HEADER_START_SIGN = (byte) 0xFF;
static final byte HEADER_VERSION_1 = 0x22;
static final byte HEADER_VERSION_2 = 0x23;
static final int HEADER_LENGTH = 10;
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");