From 1680d3d0234d9d1e2152e644882a9c1fb39a8a47 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 7 Jun 2015 11:28:37 +1200 Subject: Fix Castel frame decoder --- src/org/traccar/ServerManager.java | 2 +- src/org/traccar/protocol/CastelProtocolDecoder.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index ae0f4a57e..44adfadbc 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -1435,7 +1435,7 @@ public class ServerManager { TrackerServer server = new TrackerServer(new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { - pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -2, 0)); + pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0)); pipeline.addLast("objectDecoder", new CastelProtocolDecoder(protocol)); } }; diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index fbba960a5..c919ec936 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -126,7 +126,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { double lat = buf.readUnsignedInt() / 3600000.0; double lon = buf.readUnsignedInt() / 3600000.0; position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort())); - position.setCourse(buf.readUnsignedShort()); + position.setCourse(buf.readUnsignedShort() % 360); int flags = buf.readUnsignedByte(); position.setLatitude((flags & 0x01) == 0 ? -lat : lat); -- cgit v1.2.3