diff options
Diffstat (limited to 'src/org/traccar')
17 files changed, 123 insertions, 45 deletions
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java index f273385f6..c6e120bbc 100644 --- a/src/org/traccar/WebDataHandler.java +++ b/src/org/traccar/WebDataHandler.java @@ -19,7 +19,8 @@ import java.util.Calendar; import java.util.Formatter; import java.util.Locale; import java.util.TimeZone; -import org.traccar.helper.Crc; + +import org.traccar.helper.Checksum; import org.traccar.model.Device; import org.traccar.model.Event; import org.traccar.model.Position; @@ -52,7 +53,7 @@ public class WebDataHandler extends BaseDataHandler { f.format("%1$td%1$tm%1$ty,,", calendar); } - s.append(Crc.nmeaChecksum(s.toString())); + s.append(Checksum.nmeaChecksum(s.toString())); return s.toString(); } diff --git a/src/org/traccar/helper/Crc.java b/src/org/traccar/helper/Checksum.java index 3df6ffd71..99d7e2ddb 100644 --- a/src/org/traccar/helper/Crc.java +++ b/src/org/traccar/helper/Checksum.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2015 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,12 +19,9 @@ import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.zip.CRC32; -/** - * CRC functions - */ -public class Crc { +public class Checksum { - private static final int crc16CcittTableReverse[] = { + private static final int CRC16_CCITT_TABLE_REVERSE[] = { 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, @@ -59,7 +56,7 @@ public class Crc { 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 }; - private static final int crc16CcittTable[] = { + private static final int CRC16_CCITT_TABLE[] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, @@ -94,8 +91,8 @@ public class Crc { 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 }; - private static final int crc16CcittStart = 0xFFFF; - private static final int crc16CcittXorout = 0xFFFF; + private static final int CRC16_CCITT_START = 0xFFFF; + private static final int CRC16_CCITT_XOROUT = 0xFFFF; private static int crc16Unreflected(ByteBuffer buf, int crc_in, int[] table) { int crc16 = crc_in; @@ -114,15 +111,15 @@ public class Crc { } public static int crc16Ccitt(ByteBuffer buf) { - return crc16Reflected(buf, crc16CcittStart, crc16CcittTableReverse) ^ crc16CcittXorout; + return crc16Reflected(buf, CRC16_CCITT_START, CRC16_CCITT_TABLE_REVERSE) ^ CRC16_CCITT_XOROUT; } public static int crc16X25Ccitt(ByteBuffer buf) { - return crc16Unreflected(buf, crc16CcittStart, crc16CcittTable); + return crc16Unreflected(buf, CRC16_CCITT_START, CRC16_CCITT_TABLE); } - public static int crc16CcittSeed(ByteBuffer buf, int seed) { - return crc16Reflected(buf, seed, crc16CcittTableReverse) ^ crc16CcittXorout; + public static int crc16Ccitt(ByteBuffer buf, int seed, int xorout) { + return crc16Reflected(buf, seed, CRC16_CCITT_TABLE_REVERSE) ^ xorout; } public static int crc32(ByteBuffer buf) { diff --git a/src/org/traccar/model/Command.java b/src/org/traccar/model/Command.java index 13187808f..56e709150 100644 --- a/src/org/traccar/model/Command.java +++ b/src/org/traccar/model/Command.java @@ -35,9 +35,11 @@ public class Command implements Factory { public static final String TYPE_ENGINE_RESUME = "engineResume"; public static final String TYPE_ALARM_ARM = "alarmArm"; public static final String TYPE_ALARM_DISARM = "alarmDisarm"; + public static final String TYPE_SET_TIMEZONE = "setTimezone"; public static final String KEY_UNIQUE_ID = "uniqueId"; public static final String KEY_FREQUENCY = "frequency"; + public static final String KEY_TIMEZONE = "timezone"; public static final String KEY_DEVICE_PASSWORD = "devicePassword"; } diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java index c3e16a7dc..7b89d374e 100644 --- a/src/org/traccar/protocol/ApelProtocolDecoder.java +++ b/src/org/traccar/protocol/ApelProtocolDecoder.java @@ -26,7 +26,7 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.helper.Log; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; @@ -75,7 +75,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { ChannelBuffer request = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, 8); request.writeShort(type); request.writeShort(0); - request.writeInt(Crc.crc32(request.toByteBuffer(0, 4))); + request.writeInt(Checksum.crc32(request.toByteBuffer(0, 4))); channel.write(request); } @@ -88,7 +88,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { request.writeShort(6); request.writeInt((int) lastIndex); request.writeShort(512); - request.writeInt(Crc.crc32(request.toByteBuffer(0, 10))); + request.writeInt(Checksum.crc32(request.toByteBuffer(0, 10))); channel.write(request); } } diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index a4d177ed0..aa9dd57d1 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -24,7 +24,7 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.helper.ChannelBufferTools; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; import org.traccar.model.Position; @@ -40,7 +40,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { private static final long IMEI_BASE_TC65I_V11 = 0x14143B4000000L; private static boolean validateImei(long imei) { - return Crc.luhnChecksum(imei / 10) == imei % 10; + return Checksum.luhnChecksum(imei / 10) == imei % 10; } private static long imeiFromUnitId(long unitId) { diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index ceed8f5ef..f93b9762c 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -26,7 +26,7 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; import org.traccar.model.Position; @@ -95,7 +95,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { response.writeByte(version); response.writeBytes(id); response.writeShort(ChannelBuffers.swapShort(MSG_HEARTBEAT_RESPONSE)); - response.writeShort(Crc.crc16Ccitt(response.toByteBuffer(0, response.writerIndex()))); + response.writeShort(Checksum.crc16Ccitt(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(Crc.crc16Ccitt(response.toByteBuffer(0, response.writerIndex()))); + response.writeShort(Checksum.crc16Ccitt(response.toByteBuffer(0, response.writerIndex()))); response.writeByte(0x0D); response.writeByte(0x0A); channel.write(response, remoteAddress); } diff --git a/src/org/traccar/protocol/CityeasyProtocol.java b/src/org/traccar/protocol/CityeasyProtocol.java index 69f7ad5ac..1049e48eb 100644 --- a/src/org/traccar/protocol/CityeasyProtocol.java +++ b/src/org/traccar/protocol/CityeasyProtocol.java @@ -20,6 +20,7 @@ import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; +import org.traccar.model.Command; import java.util.List; @@ -27,6 +28,11 @@ public class CityeasyProtocol extends BaseProtocol { public CityeasyProtocol() { super("cityeasy"); + setSupportedCommands( + Command.TYPE_POSITION_SINGLE, + Command.TYPE_POSITION_PERIODIC, + Command.TYPE_POSITION_STOP, + Command.TYPE_SET_TIMEZONE); } @Override @@ -36,6 +42,7 @@ public class CityeasyProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0)); pipeline.addLast("objectDecoder", new CityeasyProtocolDecoder(CityeasyProtocol.this)); + pipeline.addLast("objectEncoder", new CityeasyProtocolEncoder()); } }); } diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java index 4cb0562a6..457ba9c5d 100644 --- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java +++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java @@ -25,7 +25,7 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.helper.ChannelBufferTools; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.model.Event; import org.traccar.model.Position; @@ -51,8 +51,14 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder { "(\\d+)" + // Cell ".*"); - private static final int MSG_LOCATION_REPORT = 0x0003; - private static final int MSG_LOCATION_INQUIRY_RESPONSE = 0x0004; + public static final int MSG_ADDRESS_REQUEST = 0x0001; + public static final int MSG_STATUS = 0x0002; + public static final int MSG_LOCATION_REPORT = 0x0003; + public static final int MSG_LOCATION_REQUEST = 0x0004; + public static final int MSG_LOCATION_INTERVAL = 0x0005; + public static final int MSG_PHONE_NUMBER = 0x0006; + public static final int MSG_MONITORING = 0x0007; + public static final int MSG_TIMEZONE = 0x0008; @Override protected Object decode( @@ -66,14 +72,14 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder { String imei = ChannelBufferTools.readHexString(buf, 14); if (!identify(imei, channel, null, false)) { - if (!identify(imei + Crc.luhnChecksum(Long.parseLong(imei)), channel)) { + if (!identify(imei + Checksum.luhnChecksum(Long.parseLong(imei)), channel)) { return null; } } int type = buf.readUnsignedShort(); - if (type == MSG_LOCATION_REPORT || type == MSG_LOCATION_INQUIRY_RESPONSE) { + if (type == MSG_LOCATION_REPORT || type == MSG_LOCATION_REQUEST) { String sentence = buf.toString(buf.readerIndex(), buf.readableBytes() - 8, Charset.defaultCharset()); Matcher parser = pattern.matcher(sentence); diff --git a/src/org/traccar/protocol/CityeasyProtocolEncoder.java b/src/org/traccar/protocol/CityeasyProtocolEncoder.java new file mode 100644 index 000000000..9d15e9d5d --- /dev/null +++ b/src/org/traccar/protocol/CityeasyProtocolEncoder.java @@ -0,0 +1,65 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.traccar.BaseProtocolEncoder; +import org.traccar.helper.Checksum; +import org.traccar.model.Command; + +public class CityeasyProtocolEncoder extends BaseProtocolEncoder { + + private ChannelBuffer encodeContent(int type, ChannelBuffer content) { + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + buf.writeByte('S'); + buf.writeByte('S'); + buf.writeShort(2 + 2 + 2 + content.readableBytes() + 4 + 2 + 2); + buf.writeShort(type); + buf.writeBytes(content); + buf.writeInt(0x0B); + buf.writeShort(Checksum.crc16Ccitt(buf.toByteBuffer(), 0, 0)); + buf.writeByte('\r'); + buf.writeByte('\n'); + + return buf; + } + + @Override + protected Object encodeCommand(Command command) { + + ChannelBuffer content = ChannelBuffers.dynamicBuffer(); + + switch (command.getType()) { + case Command.TYPE_POSITION_SINGLE: + return encodeContent(CityeasyProtocolDecoder.MSG_LOCATION_REQUEST, content); + case Command.TYPE_POSITION_PERIODIC: + case Command.TYPE_POSITION_STOP: + content.writeShort(((Number) command.getAttributes().getOrDefault(Command.KEY_FREQUENCY, 0)).intValue()); + return encodeContent(CityeasyProtocolDecoder.MSG_LOCATION_INTERVAL, content); + case Command.TYPE_SET_TIMEZONE: + int timezone = ((Number) command.getAttributes().getOrDefault(Command.KEY_TIMEZONE, 0)).intValue(); + content.writeByte(timezone < 0 ? 1 : 0); + content.writeShort(Math.abs(timezone) / 60); + return encodeContent(CityeasyProtocolDecoder.MSG_TIMEZONE, content); + } + + return null; + } + +} diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java index 9e583aebd..3994587bf 100644 --- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java +++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java @@ -24,7 +24,7 @@ import java.util.regex.Pattern; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.model.Position; public class GpsGateProtocolDecoder extends BaseProtocolDecoder { @@ -48,7 +48,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder { private void send(Channel channel, String message) { if (channel != null) { - channel.write(message + Crc.nmeaChecksum(message) + "\r\n"); + channel.write(message + Checksum.nmeaChecksum(message) + "\r\n"); } } diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index e6acc5e1b..ab5c80cf6 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -23,7 +23,7 @@ import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; import org.traccar.model.Position; @@ -81,7 +81,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { response.writeByte(0x05); // size response.writeByte(type); response.writeShort(index); - response.writeShort(Crc.crc16Ccitt(response.toByteBuffer(2, 4))); + response.writeShort(Checksum.crc16Ccitt(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 e842c3a69..9a1bb4571 100644 --- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java @@ -18,7 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.traccar.BaseProtocolEncoder; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.model.Command; public class Gt06ProtocolEncoder extends BaseProtocolEncoder { @@ -40,7 +40,7 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder { buf.writeShort(0); // message index - buf.writeShort(Crc.crc16Ccitt(buf.toByteBuffer(2, buf.writerIndex() - 2))); + buf.writeShort(Checksum.crc16Ccitt(buf.toByteBuffer(2, buf.writerIndex() - 2))); buf.writeByte('\r'); buf.writeByte('\n'); diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java index 6d634e744..3ad6761cd 100644 --- a/src/org/traccar/protocol/KhdProtocolDecoder.java +++ b/src/org/traccar/protocol/KhdProtocolDecoder.java @@ -25,7 +25,7 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.helper.ChannelBufferTools; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; import org.traccar.model.Position; @@ -136,7 +136,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder { response.writeByte(buf.readUnsignedByte()); response.writeByte(type); response.writeByte(0); // reserved - response.writeByte(Crc.xorChecksum(response.toByteBuffer())); + response.writeByte(Checksum.xorChecksum(response.toByteBuffer())); response.writeByte(0x0D); // ending channel.write(response); diff --git a/src/org/traccar/protocol/KhdProtocolEncoder.java b/src/org/traccar/protocol/KhdProtocolEncoder.java index 68196d65c..ca2407743 100644 --- a/src/org/traccar/protocol/KhdProtocolEncoder.java +++ b/src/org/traccar/protocol/KhdProtocolEncoder.java @@ -18,7 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.traccar.BaseProtocolEncoder; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.model.Command; public class KhdProtocolEncoder extends BaseProtocolEncoder { @@ -38,7 +38,7 @@ public class KhdProtocolEncoder extends BaseProtocolEncoder { buf.writeInt(0); // terminal id - buf.writeByte(Crc.xorChecksum(buf.toByteBuffer())); + buf.writeByte(Checksum.xorChecksum(buf.toByteBuffer())); buf.writeByte(0x0D); // ending return buf; diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java index f3884650d..57dd797eb 100644 --- a/src/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java @@ -24,7 +24,7 @@ import java.util.regex.Pattern; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.model.Position; public class LaipacProtocolDecoder extends BaseProtocolDecoder { @@ -121,7 +121,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { if (type.equals("0") && Character.isLowerCase(status.charAt(0))) { response = "$EAVACK,0," + checksum; - response += Crc.nmeaChecksum(response); + response += Checksum.nmeaChecksum(response); } else if (type.equals("S") || type.equals("T")) { response = "$AVCFG,00000000,t*21"; } else if (type.equals("3")) { diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index e50b4f60b..51587f3b5 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -27,7 +27,7 @@ import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.model.Event; import org.traccar.model.Position; @@ -100,7 +100,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { if (id.length() == 14) { // Try to recreate full IMEI number // Sometimes first digit is cut, so this won't work - if (identify(id + Crc.luhnChecksum(Long.valueOf(id)), channel, null, false)) { + if (identify(id + Checksum.luhnChecksum(Long.valueOf(id)), channel, null, false)) { return true; } } @@ -121,7 +121,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { buf.writeBytes(id); buf.writeShort(type); buf.writeBytes(msg); - buf.writeShort(Crc.crc16X25Ccitt(buf.toByteBuffer())); + buf.writeShort(Checksum.crc16X25Ccitt(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 686c8a691..24c6618bb 100644 --- a/src/org/traccar/protocol/NavigilProtocolDecoder.java +++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java @@ -22,7 +22,7 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; import org.traccar.model.Position; @@ -68,7 +68,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { header.writeShort(MESSAGE_ACKNOWLEDGEMENT); header.writeShort(header.capacity() + data.capacity()); header.writeShort(0); - header.writeShort(Crc.crc16X25Ccitt(data.toByteBuffer())); + header.writeShort(Checksum.crc16X25Ccitt(data.toByteBuffer())); header.writeInt(0); header.writeInt((int) (System.currentTimeMillis() / 1000) + LEAP_SECONDS_DELTA); |