From 6f6d17da2c8de35b7f31d29a6d902536497550a4 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 1 Dec 2016 06:30:22 +1300 Subject: Simplify CalAmp id decoding --- src/org/traccar/protocol/CalAmpProtocolDecoder.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/org/traccar/protocol') 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)) { -- cgit v1.2.3