aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/EasyTrackProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
index 7c91b843c..f44c91c4a 100644
--- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -19,6 +19,7 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.helper.BitUtil;
+import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
@@ -74,30 +75,33 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
position.setValid(parser.next().equals("A"));
- position.setTime(parser.nextDateTime(16));
+ DateBuilder dateBuilder = new DateBuilder()
+ .setDate(parser.nextHexInt(0), parser.nextHexInt(0), parser.nextHexInt(0))
+ .setTime(parser.nextHexInt(0), parser.nextHexInt(0), parser.nextHexInt(0));
+ position.setTime(dateBuilder.getDate());
- if (BitUtil.check(parser.nextInt(16), 3)) {
- position.setLatitude(-parser.nextInt(16) / 600000.0);
+ if (BitUtil.check(parser.nextHexInt(0), 3)) {
+ position.setLatitude(-parser.nextHexInt(0) / 600000.0);
} else {
- position.setLatitude(parser.nextInt(16) / 600000.0);
+ position.setLatitude(parser.nextHexInt(0) / 600000.0);
}
- if (BitUtil.check(parser.nextInt(16), 3)) {
- position.setLongitude(-parser.nextInt(16) / 600000.0);
+ if (BitUtil.check(parser.nextHexInt(0), 3)) {
+ position.setLongitude(-parser.nextHexInt(0) / 600000.0);
} else {
- position.setLongitude(parser.nextInt(16) / 600000.0);
+ position.setLongitude(parser.nextHexInt(0) / 600000.0);
}
- position.setSpeed(parser.nextInt(16) / 100.0);
- position.setCourse(parser.nextInt(16) / 100.0);
+ position.setSpeed(parser.nextHexInt(0) / 100.0);
+ position.setCourse(parser.nextHexInt(0) / 100.0);
position.set(Position.KEY_STATUS, parser.next());
position.set("signal", parser.next());
- position.set(Position.KEY_POWER, parser.nextDouble());
- position.set("oil", parser.nextInt(16));
- position.set(Position.KEY_ODOMETER, parser.nextInt(16) * 100);
+ position.set(Position.KEY_POWER, parser.nextDouble(0));
+ position.set("oil", parser.nextHexInt(0));
+ position.set(Position.KEY_ODOMETER, parser.nextHexInt(0) * 100);
- position.setAltitude(parser.nextDouble());
+ position.setAltitude(parser.nextDouble(0));
return position;
}