diff options
-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) { |