diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-24 22:52:48 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-24 22:52:48 +1300 |
commit | 31f12e5bcf409111b86e8fff571ee95c3186e241 (patch) | |
tree | 1ade205a49ea38afea6f8c4fb7c69c33385568cc | |
parent | 205d8c9cbb9b5676b8dc6eaacfd189d50172051b (diff) | |
download | trackermap-server-31f12e5bcf409111b86e8fff571ee95c3186e241.tar.gz trackermap-server-31f12e5bcf409111b86e8fff571ee95c3186e241.tar.bz2 trackermap-server-31f12e5bcf409111b86e8fff571ee95c3186e241.zip |
Fix device id decoding (fix #610)
-rw-r--r-- | src/org/traccar/protocol/NoranProtocolDecoder.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java index fc4654016..dc400ff66 100644 --- a/src/org/traccar/protocol/NoranProtocolDecoder.java +++ b/src/org/traccar/protocol/NoranProtocolDecoder.java @@ -107,7 +107,12 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder { position.setTime(time.getTime()); // Identification - String id = buf.readBytes(11).toString(Charset.defaultCharset()); + ChannelBuffer rawId = buf.readBytes(11); + int index = 0; + while (rawId.readable() && rawId.readByte() != 0) { + index += 1; + } + String id = rawId.toString(0, index, Charset.defaultCharset()); try { position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); } catch(Exception error) { |