diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-06 16:14:11 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-06 16:14:11 +1300 |
commit | 6652e4c3e23da63d4277caaca7f91e651793f503 (patch) | |
tree | ef8d12b439e5cd0f0b826aa1d465f5e4db7d0f51 /src/org/traccar/helper | |
parent | 814794126d232b11a67c06691ed5d5da6c32dd75 (diff) | |
download | traccar-server-6652e4c3e23da63d4277caaca7f91e651793f503.tar.gz traccar-server-6652e4c3e23da63d4277caaca7f91e651793f503.tar.bz2 traccar-server-6652e4c3e23da63d4277caaca7f91e651793f503.zip |
Rename some of checksum methods
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r-- | src/org/traccar/helper/Checksum.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/helper/Checksum.java b/src/org/traccar/helper/Checksum.java index 99d7e2ddb..cdf1bbf50 100644 --- a/src/org/traccar/helper/Checksum.java +++ b/src/org/traccar/helper/Checksum.java @@ -91,8 +91,8 @@ public class Checksum { 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 }; - private static final int CRC16_CCITT_START = 0xFFFF; - private static final int CRC16_CCITT_XOROUT = 0xFFFF; + public static final int CRC16_CCITT = 0xFFFF; + public static final int CRC16_CCITT_XOROUT = 0xFFFF; private static int crc16Unreflected(ByteBuffer buf, int crc_in, int[] table) { int crc16 = crc_in; @@ -111,11 +111,11 @@ public class Checksum { } public static int crc16Ccitt(ByteBuffer buf) { - return crc16Reflected(buf, CRC16_CCITT_START, CRC16_CCITT_TABLE_REVERSE) ^ CRC16_CCITT_XOROUT; + return crc16Reflected(buf, 0xFFFF, CRC16_CCITT_TABLE_REVERSE) ^ 0xFFFF; } public static int crc16X25Ccitt(ByteBuffer buf) { - return crc16Unreflected(buf, CRC16_CCITT_START, CRC16_CCITT_TABLE); + return crc16Unreflected(buf, 0xFFFF, CRC16_CCITT_TABLE); } public static int crc16Ccitt(ByteBuffer buf, int seed, int xorout) { @@ -130,7 +130,7 @@ public class Checksum { return (int) checksum.getValue(); } - public static int xorChecksum(ByteBuffer buf) { + public static int xor(ByteBuffer buf) { int checksum = 0; while (buf.hasRemaining()) { checksum ^= buf.get(); @@ -138,7 +138,7 @@ public class Checksum { return checksum; } - public static String nmeaChecksum(String msg) { + public static String nmea(String msg) { int checksum = 0; byte bytes[] = msg.getBytes(Charset.defaultCharset()); for (int i = 1; i < msg.length(); i++) { @@ -147,7 +147,7 @@ public class Checksum { return String.format("*%02x", checksum).toUpperCase(); } - public static long luhnChecksum(long imei) { + public static long luhn(long imei) { long checksum = 0; long remain = imei; |