diff options
Diffstat (limited to 'src/org/traccar/protocol/Gps103ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 9fa71ad58..aa693f42e 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -69,8 +69,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { @Override protected Object decode( - Channel channel, SocketAddress remoteAddress, Object msg) - throws Exception { + Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { String sentence = (String) msg; @@ -102,7 +101,6 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(); position.setProtocol(getProtocolName()); - // Get device by IMEI String imei = parser.next(); if (!identify(imei, channel, remoteAddress)) { return null; @@ -121,15 +119,15 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { int localHours = parser.nextInt(); int localMinutes = parser.nextInt(); - int utcHours = parser.nextInt(); - int utcMinutes = parser.nextInt(); + String utcHours = parser.next(); + String utcMinutes = parser.next(); dateBuilder.setTime(localHours, localMinutes, parser.nextInt(), parser.nextInt()); // Timezone calculation - if (utcHours != 0 && utcMinutes != 0) { - int deltaMinutes = (localHours - utcHours) * 60; - deltaMinutes += localMinutes - utcMinutes; + if (utcHours != null && utcMinutes != null) { + int deltaMinutes = (localHours - Integer.parseInt(utcHours)) * 60; + deltaMinutes += localMinutes - Integer.parseInt(utcMinutes); if (deltaMinutes <= -12 * 60) { deltaMinutes += 24 * 60; } else if (deltaMinutes > 12 * 60) { |