diff options
Diffstat (limited to 'src/org/traccar/protocol/GatorProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/GatorProtocolDecoder.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java index 22b3ebc3a..e28da82ba 100644 --- a/src/org/traccar/protocol/GatorProtocolDecoder.java +++ b/src/org/traccar/protocol/GatorProtocolDecoder.java @@ -19,7 +19,7 @@ import java.net.SocketAddress; 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.BcdUtil; import org.traccar.helper.DateBuilder; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; @@ -80,18 +80,18 @@ public class GatorProtocolDecoder 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); |