diff options
Diffstat (limited to 'src/org/traccar/protocol/H02ProtocolEncoder.java')
-rw-r--r-- | src/org/traccar/protocol/H02ProtocolEncoder.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolEncoder.java b/src/org/traccar/protocol/H02ProtocolEncoder.java index 87fad6016..6d5cfb298 100644 --- a/src/org/traccar/protocol/H02ProtocolEncoder.java +++ b/src/org/traccar/protocol/H02ProtocolEncoder.java @@ -16,19 +16,19 @@ */ package org.traccar.protocol; -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; import org.traccar.StringProtocolEncoder; import org.traccar.model.Command; +import java.util.Date; + public class H02ProtocolEncoder extends StringProtocolEncoder { private static final String MARKER = "HQ"; - private Object formatCommand(DateTime time, String uniqueId, String type, String... params) { + private Object formatCommand(Date time, String uniqueId, String type, String... params) { - StringBuilder result = new StringBuilder(String.format("*%s,%s,%s,%02d%02d%02d", - MARKER, uniqueId, type, time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute())); + StringBuilder result = new StringBuilder( + String.format("*%s,%s,%s,%4$tH%4$tM%4$tS", MARKER, uniqueId, type, time)); for (String param : params) { result.append(",").append(param); @@ -39,7 +39,7 @@ public class H02ProtocolEncoder extends StringProtocolEncoder { return result.toString(); } - protected Object encodeCommand(Command command, DateTime time) { + protected Object encodeCommand(Command command, Date time) { String uniqueId = getUniqueId(command.getDeviceId()); switch (command.getType()) { @@ -62,7 +62,7 @@ public class H02ProtocolEncoder extends StringProtocolEncoder { @Override protected Object encodeCommand(Command command) { - return encodeCommand(command, new DateTime(DateTimeZone.UTC)); + return encodeCommand(command, new Date()); } } |