aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/KhdProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/KhdProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/KhdProtocolDecoder.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java
index c1ebb1bf4..07db78c94 100644
--- a/src/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/org/traccar/protocol/KhdProtocolDecoder.java
@@ -20,7 +20,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.ChannelBufferTools;
+import org.traccar.helper.BcdUtil;
import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
@@ -79,18 +79,18 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
DateBuilder dateBuilder = new DateBuilder()
- .setYear(ChannelBufferTools.readHexInteger(buf, 2))
- .setMonth(ChannelBufferTools.readHexInteger(buf, 2))
- .setDay(ChannelBufferTools.readHexInteger(buf, 2))
- .setHour(ChannelBufferTools.readHexInteger(buf, 2))
- .setMinute(ChannelBufferTools.readHexInteger(buf, 2))
- .setSecond(ChannelBufferTools.readHexInteger(buf, 2));
+ .setYear(BcdUtil.readInteger(buf, 2))
+ .setMonth(BcdUtil.readInteger(buf, 2))
+ .setDay(BcdUtil.readInteger(buf, 2))
+ .setHour(BcdUtil.readInteger(buf, 2))
+ .setMinute(BcdUtil.readInteger(buf, 2))
+ .setSecond(BcdUtil.readInteger(buf, 2));
position.setTime(dateBuilder.getDate());
- position.setLatitude(ChannelBufferTools.readCoordinate(buf));
- position.setLongitude(ChannelBufferTools.readCoordinate(buf));
- position.setSpeed(UnitsConverter.knotsFromKph(ChannelBufferTools.readHexInteger(buf, 4)));
- position.setCourse(ChannelBufferTools.readHexInteger(buf, 4));
+ position.setLatitude(BcdUtil.readCoordinate(buf));
+ position.setLongitude(BcdUtil.readCoordinate(buf));
+ position.setSpeed(UnitsConverter.knotsFromKph(BcdUtil.readInteger(buf, 4)));
+ position.setCourse(BcdUtil.readInteger(buf, 4));
int flags = buf.readUnsignedByte();
position.setValid((flags & 0x80) != 0);