From 3ccb5c95e3b4483b9eeb7039119afbf9bd0617b8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 2 Dec 2014 21:17:50 +1300 Subject: Fix Gator id decoding --- src/org/traccar/protocol/GatorProtocolDecoder.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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 || -- cgit v1.2.3