diff options
Diffstat (limited to 'src/org/traccar/protocol')
9 files changed, 20 insertions, 20 deletions
diff --git a/src/org/traccar/protocol/At2000ProtocolDecoder.java b/src/org/traccar/protocol/At2000ProtocolDecoder.java index 06d80c497..e0f2b4278 100644 --- a/src/org/traccar/protocol/At2000ProtocolDecoder.java +++ b/src/org/traccar/protocol/At2000ProtocolDecoder.java @@ -20,13 +20,13 @@ import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; +import org.traccar.helper.DataConverter; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import javax.xml.bind.DatatypeConverter; import java.net.SocketAddress; import java.nio.ByteOrder; import java.nio.charset.StandardCharsets; @@ -84,7 +84,7 @@ public class At2000ProtocolDecoder extends BaseProtocolDecoder { IvParameterSpec ivSpec = new IvParameterSpec(iv); SecretKeySpec keySpec = new SecretKeySpec( - DatatypeConverter.parseHexBinary("000102030405060708090a0b0c0d0e0f"), "AES"); + DataConverter.parseHex("000102030405060708090a0b0c0d0e0f"), "AES"); cipher = Cipher.getInstance("AES/CBC/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); diff --git a/src/org/traccar/protocol/EelinkProtocolEncoder.java b/src/org/traccar/protocol/EelinkProtocolEncoder.java index 76865a039..4d2d86e68 100644 --- a/src/org/traccar/protocol/EelinkProtocolEncoder.java +++ b/src/org/traccar/protocol/EelinkProtocolEncoder.java @@ -18,10 +18,10 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.traccar.BaseProtocolEncoder; +import org.traccar.helper.DataConverter; import org.traccar.helper.Log; import org.traccar.model.Command; -import javax.xml.bind.DatatypeConverter; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; @@ -47,7 +47,7 @@ public class EelinkProtocolEncoder extends BaseProtocolEncoder { ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); if (connectionless) { - buf.writeBytes(ChannelBuffers.wrappedBuffer(DatatypeConverter.parseHexBinary('0' + uniqueId))); + buf.writeBytes(ChannelBuffers.wrappedBuffer(DataConverter.parseHex('0' + uniqueId))); } buf.writeByte(0x67); diff --git a/src/org/traccar/protocol/HuabaoProtocolEncoder.java b/src/org/traccar/protocol/HuabaoProtocolEncoder.java index 7d6f0510d..d1889bf5e 100644 --- a/src/org/traccar/protocol/HuabaoProtocolEncoder.java +++ b/src/org/traccar/protocol/HuabaoProtocolEncoder.java @@ -18,10 +18,10 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.traccar.BaseProtocolEncoder; +import org.traccar.helper.DataConverter; import org.traccar.helper.Log; import org.traccar.model.Command; -import javax.xml.bind.DatatypeConverter; import java.text.SimpleDateFormat; import java.util.Date; @@ -31,10 +31,10 @@ public class HuabaoProtocolEncoder extends BaseProtocolEncoder { protected Object encodeCommand(Command command) { ChannelBuffer id = ChannelBuffers.wrappedBuffer( - DatatypeConverter.parseHexBinary(getUniqueId(command.getDeviceId()))); + DataConverter.parseHex(getUniqueId(command.getDeviceId()))); ChannelBuffer data = ChannelBuffers.dynamicBuffer(); - byte[] time = DatatypeConverter.parseHexBinary(new SimpleDateFormat("yyMMddHHmmss").format(new Date())); + byte[] time = DataConverter.parseHex(new SimpleDateFormat("yyMMddHHmmss").format(new Date())); switch (command.getType()) { case Command.TYPE_ENGINE_STOP: diff --git a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java index 2e0a1e84c..340d947e3 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java @@ -19,10 +19,10 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.Checksum; +import org.traccar.helper.DataConverter; import org.traccar.helper.Log; import org.traccar.model.Command; -import javax.xml.bind.DatatypeConverter; import java.nio.charset.StandardCharsets; import java.util.TimeZone; @@ -44,7 +44,7 @@ public class MeiligaoProtocolEncoder extends BaseProtocolEncoder { buf.writeShort(2 + 2 + 7 + 2 + content.readableBytes() + 2 + 2); // message length - buf.writeBytes(DatatypeConverter.parseHexBinary((getUniqueId(deviceId) + "FFFFFFFFFFFFFF").substring(0, 14))); + buf.writeBytes(DataConverter.parseHex((getUniqueId(deviceId) + "FFFFFFFFFFFFFF").substring(0, 14))); buf.writeShort(type); diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java index 87ee8246a..7b11cc5c3 100644 --- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -20,10 +20,10 @@ import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; 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; @@ -196,7 +196,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { } if (channel != null) { - channel.write(ChannelBuffers.wrappedBuffer(DatatypeConverter.parseHexBinary("0002640113bc"))); + channel.write(ChannelBuffers.wrappedBuffer(DataConverter.parseHex("0002640113bc"))); } return positions; @@ -229,7 +229,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { } if (channel != null) { - channel.write(ChannelBuffers.wrappedBuffer(DatatypeConverter.parseHexBinary("00026d01c4a4"))); + channel.write(ChannelBuffers.wrappedBuffer(DataConverter.parseHex("00026d01c4a4"))); } return positions; diff --git a/src/org/traccar/protocol/SigfoxProtocolDecoder.java b/src/org/traccar/protocol/SigfoxProtocolDecoder.java index 65ab2cc55..b454e00fa 100644 --- a/src/org/traccar/protocol/SigfoxProtocolDecoder.java +++ b/src/org/traccar/protocol/SigfoxProtocolDecoder.java @@ -22,12 +22,12 @@ import org.jboss.netty.handler.codec.http.HttpRequest; import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.traccar.BaseHttpProtocolDecoder; import org.traccar.DeviceSession; +import org.traccar.helper.DataConverter; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; import javax.json.Json; import javax.json.JsonObject; -import javax.xml.bind.DatatypeConverter; import java.io.StringReader; import java.net.SocketAddress; import java.net.URLDecoder; @@ -61,7 +61,7 @@ public class SigfoxProtocolDecoder extends BaseHttpProtocolDecoder { position.setTime(new Date(json.getInt("time") * 1000L)); ChannelBuffer buf = ChannelBuffers.wrappedBuffer( - ByteOrder.LITTLE_ENDIAN, DatatypeConverter.parseHexBinary(json.getString("data"))); + ByteOrder.LITTLE_ENDIAN, DataConverter.parseHex(json.getString("data"))); int type = buf.readUnsignedByte() >> 4; if (type == 0) { diff --git a/src/org/traccar/protocol/T800xProtocolEncoder.java b/src/org/traccar/protocol/T800xProtocolEncoder.java index 6ed5dbccd..038a5e51a 100644 --- a/src/org/traccar/protocol/T800xProtocolEncoder.java +++ b/src/org/traccar/protocol/T800xProtocolEncoder.java @@ -18,10 +18,10 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.traccar.BaseProtocolEncoder; +import org.traccar.helper.DataConverter; import org.traccar.helper.Log; import org.traccar.model.Command; -import javax.xml.bind.DatatypeConverter; import java.nio.charset.StandardCharsets; public class T800xProtocolEncoder extends BaseProtocolEncoder { @@ -39,7 +39,7 @@ public class T800xProtocolEncoder extends BaseProtocolEncoder { buf.writeByte(T800xProtocolDecoder.MSG_COMMAND); buf.writeShort(7 + 8 + 1 + content.length()); buf.writeShort(1); // serial number - buf.writeBytes(DatatypeConverter.parseHexBinary("0" + getUniqueId(command.getDeviceId()))); + buf.writeBytes(DataConverter.parseHex("0" + getUniqueId(command.getDeviceId()))); buf.writeByte(MODE_SETTING); buf.writeBytes(content.getBytes(StandardCharsets.US_ASCII)); diff --git a/src/org/traccar/protocol/WatchProtocolEncoder.java b/src/org/traccar/protocol/WatchProtocolEncoder.java index d2d3b52d1..5206fbf10 100644 --- a/src/org/traccar/protocol/WatchProtocolEncoder.java +++ b/src/org/traccar/protocol/WatchProtocolEncoder.java @@ -16,10 +16,10 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; +import org.traccar.helper.DataConverter; import org.traccar.helper.Log; import org.traccar.model.Command; -import javax.xml.bind.DatatypeConverter; import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; @@ -68,7 +68,7 @@ public class WatchProtocolEncoder extends StringProtocolEncoder implements Strin } private String getBinaryData(Command command) { - byte[] data = DatatypeConverter.parseHexBinary(command.getString(Command.KEY_DATA)); + byte[] data = DataConverter.parseHex(command.getString(Command.KEY_DATA)); int encodedLength = data.length; for (byte b : data) { diff --git a/src/org/traccar/protocol/Xt2400ProtocolDecoder.java b/src/org/traccar/protocol/Xt2400ProtocolDecoder.java index 72be473c1..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))); } } |