diff options
Diffstat (limited to 'src/org/traccar/protocol/Xt2400ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Xt2400ProtocolDecoder.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/Xt2400ProtocolDecoder.java b/src/org/traccar/protocol/Xt2400ProtocolDecoder.java index 15e8558be..1be943e98 100644 --- a/src/org/traccar/protocol/Xt2400ProtocolDecoder.java +++ b/src/org/traccar/protocol/Xt2400ProtocolDecoder.java @@ -20,10 +20,10 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; +import org.traccar.helper.DataConverter; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; -import javax.xml.bind.DatatypeConverter; import java.net.SocketAddress; import java.nio.charset.StandardCharsets; import java.util.Date; @@ -95,7 +95,7 @@ public class Xt2400ProtocolDecoder extends BaseProtocolDecoder { Pattern pattern = Pattern.compile(":wycfg pcr\\[\\d+\\] ([0-9a-fA-F]{2})[0-9a-fA-F]{2}([0-9a-fA-F]+)"); Matcher matcher = pattern.matcher(configString); while (matcher.find()) { - formats.put(Short.parseShort(matcher.group(1), 16), DatatypeConverter.parseHexBinary(matcher.group(2))); + formats.put(Short.parseShort(matcher.group(1), 16), DataConverter.parseHex(matcher.group(2))); } } @@ -116,11 +116,10 @@ public class Xt2400ProtocolDecoder extends BaseProtocolDecoder { return null; } - Position position = new Position(); - position.setProtocol(getProtocolName()); + Position position = new Position(getProtocolName()); for (byte tag : format) { - switch ((int) tag) { + switch (tag) { case 0x03: DeviceSession deviceSession = getDeviceSession( channel, remoteAddress, String.valueOf(buf.readUnsignedInt())); |