aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 13:29:37 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 13:29:37 +1300
commit09b4183fd7ba546209d422d53ea07e273bec26f3 (patch)
tree529c916e244d634870b0d2f01c51efce0e032889 /src/org
parent3e56ea6a99e7da5d61c5956876c2d977268e4756 (diff)
downloadtraccar-server-09b4183fd7ba546209d422d53ea07e273bec26f3.tar.gz
traccar-server-09b4183fd7ba546209d422d53ea07e273bec26f3.tar.bz2
traccar-server-09b4183fd7ba546209d422d53ea07e273bec26f3.zip
Use hexDump instead of readHexString
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/AutoFon45ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/TzoneProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java2
10 files changed, 17 insertions, 13 deletions
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index 4f081b2eb..90490cc64 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -138,14 +138,14 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
position.set("supply-air-temp-dep1", ChannelBuffers.swapShort(value.readShort()) * 0.1);
break;
case 0x30D:
- position.set("active-alarm", ChannelBufferTools.readHexString(value, 16));
+ position.set("active-alarm", ChannelBuffers.hexDump(value));
break;
case 0x40C:
position.set("air-temp-dep1", ChannelBuffers.swapShort(value.readShort()) * 0.1);
position.set("air-temp-dep2", ChannelBuffers.swapShort(value.readShort()) * 0.1);
break;
case 0x40D:
- position.set("cold-unit-state", ChannelBufferTools.readHexString(value, 16));
+ position.set("cold-unit-state", ChannelBuffers.hexDump(value));
break;
case 0x50C:
position.set("defrost-temp-dep1", ChannelBuffers.swapShort(value.readShort()) * 0.1);
diff --git a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java
index c09aecf95..fbc680858 100644
--- a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java
@@ -63,7 +63,7 @@ public class AutoFon45ProtocolDecoder extends BaseProtocolDecoder {
byte[] bytes = new byte[19];
buf.readBytes(bytes);
- String imei = ChannelBufferTools.readHexString(ChannelBuffers.wrappedBuffer(bytes, 1, 16), 16).substring(1);
+ String imei = ChannelBuffers.hexDump(ChannelBuffers.wrappedBuffer(bytes, 1, 16)).substring(1);
if (!identify(imei, channel)) {
return null;
}
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index 29748f489..a17f7ff2d 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -122,7 +122,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // hardware version
buf.readUnsignedByte(); // software version
- String imei = ChannelBufferTools.readHexString(buf, 16).substring(1);
+ String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1);
if (!identify(imei, channel)) {
return null;
}
diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
index d4235c191..93ef9a842 100644
--- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java
+++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
@@ -22,6 +22,7 @@ import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
@@ -70,7 +71,7 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes(2); // header
buf.readUnsignedShort(); // length
- String imei = ChannelBufferTools.readHexString(buf, 14);
+ String imei = ChannelBuffers.hexDump(buf.readBytes(7));
if (!identify(imei, channel, null, false) && !identify(imei + Checksum.luhn(Long.parseLong(imei)), channel)) {
return null;
}
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 9183dadbd..e016d542d 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -71,7 +71,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_LOGIN) {
- identify(ChannelBufferTools.readHexString(buf, 16).substring(1), channel);
+ identify(ChannelBuffers.hexDump(buf.readBytes(8)).substring(1), channel);
} else if (hasDeviceId()
&& (type == MSG_GPS || type == MSG_ALARM || type == MSG_STATE || type == MSG_SMS)) {
@@ -91,7 +91,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedShort());
// Cell
- position.set(Event.KEY_CELL, ChannelBufferTools.readHexString(buf, 18));
+ position.set(Event.KEY_CELL, ChannelBuffers.hexDump(buf.readBytes(9)));
// Validity
position.setValid((buf.readUnsignedByte() & 0x01) != 0);
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index 29b4eadb7..4cb197c3d 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -19,6 +19,7 @@ import java.net.SocketAddress;
import java.nio.charset.Charset;
import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
@@ -76,7 +77,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
buf.readByte(); // marker
- if (!identify(ChannelBufferTools.readHexString(buf, 10), channel)) {
+ if (!identify(ChannelBuffers.hexDump(buf.readBytes(5)), channel)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 184c96c97..ae74a1e83 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -22,6 +22,7 @@ import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
@@ -48,7 +49,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
buf.readByte(); // header
// Get device by identifier
- String id = String.valueOf(Long.parseLong(ChannelBufferTools.readHexString(buf, 10)));
+ String id = String.valueOf(Long.parseLong(ChannelBuffers.hexDump(buf.readBytes(5))));
if (!identify(id, channel)) {
return null;
}
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index ec5fb167d..4f5f0027e 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -83,10 +83,10 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
position.set("antihijack", buf.readUnsignedByte());
break;
case 9:
- position.set("authorized", ChannelBufferTools.readHexString(buf, 16));
+ position.set("authorized", ChannelBuffers.hexDump(buf.readBytes(8)));
break;
case 10:
- position.set("unauthorized", ChannelBufferTools.readHexString(buf, 16));
+ position.set("unauthorized", ChannelBuffers.hexDump(buf.readBytes(8)));
break;
case 24:
Set<Integer> temps = new LinkedHashSet<>();
diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java
index c76766fb7..6805708b9 100644
--- a/src/org/traccar/protocol/TzoneProtocolDecoder.java
+++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java
@@ -17,6 +17,7 @@ package org.traccar.protocol;
import java.net.SocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
@@ -45,7 +46,7 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // model
buf.readUnsignedInt(); // firmware
- String imei = ChannelBufferTools.readHexString(buf, 16).substring(1);
+ String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1);
if (!identify(imei, channel)) {
return null;
}
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index dc4741340..f53ec2cd0 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -111,7 +111,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
// Get device id
- String imei = ChannelBufferTools.readHexString(buf, 16).substring(1);
+ String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1);
if (!identify(imei, channel)) {
return null;
}