aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/H02ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-04-27 11:21:27 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-04-27 11:21:27 +1200
commit44f026f881efa6207ab79fb5bada20ab67f018a0 (patch)
tree62cab9dc7d35c12bf75217eecf85b335ecebbe5a /src/org/traccar/protocol/H02ProtocolDecoder.java
parentaa0cbaa6e849d01a5bb02e2e999b80c178270014 (diff)
downloadtrackermap-server-44f026f881efa6207ab79fb5bada20ab67f018a0.tar.gz
trackermap-server-44f026f881efa6207ab79fb5bada20ab67f018a0.tar.bz2
trackermap-server-44f026f881efa6207ab79fb5bada20ab67f018a0.zip
Rename ChannelBufferTools to BcdUtil
Diffstat (limited to 'src/org/traccar/protocol/H02ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index c4ba6ffa3..b316d8016 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -22,8 +22,8 @@ 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.BcdUtil;
import org.traccar.helper.BitUtil;
-import org.traccar.helper.ChannelBufferTools;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -38,7 +38,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
private static double readCoordinate(ChannelBuffer buf, boolean lon) {
- int degrees = ChannelBufferTools.readHexInteger(buf, 2);
+ int degrees = BcdUtil.readInteger(buf, 2);
if (lon) {
degrees = degrees * 10 + (buf.getUnsignedByte(buf.readerIndex()) >> 4);
}
@@ -53,7 +53,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
length = 5;
}
- result = result * 10 + ChannelBufferTools.readHexInteger(buf, length) * 0.0001;
+ result = result * 10 + BcdUtil.readInteger(buf, length) * 0.0001;
result /= 60;
result += degrees;
@@ -83,12 +83,12 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(getDeviceId());
DateBuilder dateBuilder = new DateBuilder()
- .setHour(ChannelBufferTools.readHexInteger(buf, 2))
- .setMinute(ChannelBufferTools.readHexInteger(buf, 2))
- .setSecond(ChannelBufferTools.readHexInteger(buf, 2))
- .setDay(ChannelBufferTools.readHexInteger(buf, 2))
- .setMonth(ChannelBufferTools.readHexInteger(buf, 2))
- .setYear(ChannelBufferTools.readHexInteger(buf, 2));
+ .setHour(BcdUtil.readInteger(buf, 2))
+ .setMinute(BcdUtil.readInteger(buf, 2))
+ .setSecond(BcdUtil.readInteger(buf, 2))
+ .setDay(BcdUtil.readInteger(buf, 2))
+ .setMonth(BcdUtil.readInteger(buf, 2))
+ .setYear(BcdUtil.readInteger(buf, 2));
position.setTime(dateBuilder.getDate());
double latitude = readCoordinate(buf, false);
@@ -107,8 +107,8 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(latitude);
position.setLongitude(longitude);
- position.setSpeed(ChannelBufferTools.readHexInteger(buf, 3));
- position.setCourse((buf.readUnsignedByte() & 0x0f) * 100.0 + ChannelBufferTools.readHexInteger(buf, 2));
+ position.setSpeed(BcdUtil.readInteger(buf, 3));
+ position.setCourse((buf.readUnsignedByte() & 0x0f) * 100.0 + BcdUtil.readInteger(buf, 2));
processStatus(position, buf.readUnsignedInt());
return position;