diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-12-02 21:17:50 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-12-02 21:17:50 +1300 |
commit | 3ccb5c95e3b4483b9eeb7039119afbf9bd0617b8 (patch) | |
tree | adf36e7e9f9247b276f0423754a4a120af1be260 /src/org | |
parent | 146508be837b4c89eac752ef54c6902d017c3bd8 (diff) | |
download | traccar-server-3ccb5c95e3b4483b9eeb7039119afbf9bd0617b8.tar.gz traccar-server-3ccb5c95e3b4483b9eeb7039119afbf9bd0617b8.tar.bz2 traccar-server-3ccb5c95e3b4483b9eeb7039119afbf9bd0617b8.zip |
Fix Gator id decoding
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/protocol/GatorProtocolDecoder.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java index 9fb74dacc..5bc205214 100644 --- a/src/org/traccar/protocol/GatorProtocolDecoder.java +++ b/src/org/traccar/protocol/GatorProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2013 - 2014 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,10 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(); // length // Pseudo IP address - String id = String.valueOf(buf.readUnsignedInt()); + String id = String.format("%02d%02d%02d%02d", + buf.readUnsignedByte(), buf.readUnsignedByte(), + buf.readUnsignedByte(), buf.readUnsignedByte()); + id = id.replaceFirst("^0+(?!$)", ""); if (type == PACKET_POSITION_DATA || type == PACKET_ROLLCALL_RESPONSE || |