aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-01 06:30:22 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-12-01 06:30:22 +1300
commit6f6d17da2c8de35b7f31d29a6d902536497550a4 (patch)
treed367e36cf38ac81099f43f121536f2b82e9d8aa5
parent477cd54b15fe35c45d006639eeeb485d6c29d79d (diff)
downloadtraccar-server-6f6d17da2c8de35b7f31d29a6d902536497550a4.tar.gz
traccar-server-6f6d17da2c8de35b7f31d29a6d902536497550a4.tar.bz2
traccar-server-6f6d17da2c8de35b7f31d29a6d902536497550a4.zip
Simplify CalAmp id decoding
-rw-r--r--src/org/traccar/protocol/CalAmpProtocolDecoder.java15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/org/traccar/protocol/CalAmpProtocolDecoder.java b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
index 510684411..ee4cc65b4 100644
--- a/src/org/traccar/protocol/CalAmpProtocolDecoder.java
+++ b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
@@ -149,19 +149,8 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
int content = buf.readUnsignedByte();
if (BitUtil.check(content, 0)) {
-
- int length = buf.readUnsignedByte();
- long id = 0;
- for (int i = 0; i < length; i++) {
- int b = buf.readUnsignedByte();
- id = id * 10 + (b >> 4);
- if ((b & 0xf) != 0xf) {
- id = id * 10 + (b & 0xf);
- }
- }
-
- getDeviceSession(channel, remoteAddress, String.valueOf(id));
-
+ String id = ChannelBuffers.hexDump(buf.readBytes(buf.readUnsignedByte()));
+ getDeviceSession(channel, remoteAddress, id);
}
if (BitUtil.check(content, 1)) {