aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-06 16:55:31 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-06 16:55:31 +1300
commit2b9187ac736feeb661e2814af8fa534a335998d4 (patch)
tree18e89d33116194bc5f2fa90ea48b169608b81a76 /src/org/traccar/protocol
parent6652e4c3e23da63d4277caaca7f91e651793f503 (diff)
downloadtrackermap-server-2b9187ac736feeb661e2814af8fa534a335998d4.tar.gz
trackermap-server-2b9187ac736feeb661e2814af8fa534a335998d4.tar.bz2
trackermap-server-2b9187ac736feeb661e2814af8fa534a335998d4.zip
Clean up CRC-16 implementations
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/CastelProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolEncoder.java2
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolEncoder.java2
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/NavigilProtocolDecoder.java2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java
index f93b9762c..d7c6bbf46 100644
--- a/src/org/traccar/protocol/CastelProtocolDecoder.java
+++ b/src/org/traccar/protocol/CastelProtocolDecoder.java
@@ -95,7 +95,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
response.writeByte(version);
response.writeBytes(id);
response.writeShort(ChannelBuffers.swapShort(MSG_HEARTBEAT_RESPONSE));
- response.writeShort(Checksum.crc16Ccitt(response.toByteBuffer(0, response.writerIndex())));
+ response.writeShort(Checksum.crc16(Checksum.CRC16_X25, response.toByteBuffer(0, response.writerIndex())));
response.writeByte(0x0D); response.writeByte(0x0A);
channel.write(response, remoteAddress);
}
@@ -123,7 +123,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
response.writeInt(0xFFFFFFFF);
response.writeShort(0);
response.writeInt((int) (System.currentTimeMillis() / 1000));
- response.writeShort(Checksum.crc16Ccitt(response.toByteBuffer(0, response.writerIndex())));
+ response.writeShort(Checksum.crc16(Checksum.CRC16_X25, response.toByteBuffer(0, response.writerIndex())));
response.writeByte(0x0D); response.writeByte(0x0A);
channel.write(response, remoteAddress);
}
diff --git a/src/org/traccar/protocol/CityeasyProtocolEncoder.java b/src/org/traccar/protocol/CityeasyProtocolEncoder.java
index cfe69a462..76c4199e1 100644
--- a/src/org/traccar/protocol/CityeasyProtocolEncoder.java
+++ b/src/org/traccar/protocol/CityeasyProtocolEncoder.java
@@ -33,7 +33,7 @@ public class CityeasyProtocolEncoder extends BaseProtocolEncoder {
buf.writeShort(type);
buf.writeBytes(content);
buf.writeInt(0x0B);
- buf.writeShort(Checksum.crc16Ccitt(buf.toByteBuffer(), 0, 0));
+ buf.writeShort(Checksum.crc16(Checksum.CRC16_KERMIT, buf.toByteBuffer()));
buf.writeByte('\r');
buf.writeByte('\n');
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index ab5c80cf6..4c744dd9f 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -81,7 +81,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
response.writeByte(0x05); // size
response.writeByte(type);
response.writeShort(index);
- response.writeShort(Checksum.crc16Ccitt(response.toByteBuffer(2, 4)));
+ response.writeShort(Checksum.crc16(Checksum.CRC16_X25, response.toByteBuffer(2, 4)));
response.writeByte(0x0D); response.writeByte(0x0A); // ending
channel.write(response);
}
diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
index 9a1bb4571..f5b914b1c 100644
--- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
@@ -40,7 +40,7 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
buf.writeShort(0); // message index
- buf.writeShort(Checksum.crc16Ccitt(buf.toByteBuffer(2, buf.writerIndex() - 2)));
+ buf.writeShort(Checksum.crc16(Checksum.CRC16_X25, buf.toByteBuffer(2, buf.writerIndex() - 2)));
buf.writeByte('\r');
buf.writeByte('\n');
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index bde28492f..a7d8a884e 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -121,7 +121,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
buf.writeBytes(id);
buf.writeShort(type);
buf.writeBytes(msg);
- buf.writeShort(Checksum.crc16X25Ccitt(buf.toByteBuffer()));
+ buf.writeShort(Checksum.crc16(Checksum.CRC16_CCITT_FALSE, buf.toByteBuffer()));
buf.writeByte('\r');
buf.writeByte('\n');
diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java
index 24c6618bb..142d19fc6 100644
--- a/src/org/traccar/protocol/NavigilProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java
@@ -68,7 +68,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
header.writeShort(MESSAGE_ACKNOWLEDGEMENT);
header.writeShort(header.capacity() + data.capacity());
header.writeShort(0);
- header.writeShort(Checksum.crc16X25Ccitt(data.toByteBuffer()));
+ header.writeShort(Checksum.crc16(Checksum.CRC16_CCITT_FALSE, data.toByteBuffer()));
header.writeInt(0);
header.writeInt((int) (System.currentTimeMillis() / 1000) + LEAP_SECONDS_DELTA);