diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-01 06:30:22 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-01 06:30:22 +1300 |
commit | 6f6d17da2c8de35b7f31d29a6d902536497550a4 (patch) | |
tree | d367e36cf38ac81099f43f121536f2b82e9d8aa5 /src/org/traccar/protocol/CalAmpProtocolDecoder.java | |
parent | 477cd54b15fe35c45d006639eeeb485d6c29d79d (diff) | |
download | trackermap-server-6f6d17da2c8de35b7f31d29a6d902536497550a4.tar.gz trackermap-server-6f6d17da2c8de35b7f31d29a6d902536497550a4.tar.bz2 trackermap-server-6f6d17da2c8de35b7f31d29a6d902536497550a4.zip |
Simplify CalAmp id decoding
Diffstat (limited to 'src/org/traccar/protocol/CalAmpProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/CalAmpProtocolDecoder.java | 15 |
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)) { |