From 6575ff8587bb1507cab8847dd3f6e545a88ae225 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 5 Jan 2014 13:17:44 +1300 Subject: Fix H02 binary decoder --- src/org/traccar/protocol/H02ProtocolDecoder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index cc59eea9d..f9a1decd6 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 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. @@ -40,7 +40,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { int degrees = ChannelBufferTools.readHexInteger(buf, 2); if (lon) { - degrees = degrees * 10 + (buf.getByte(buf.readerIndex()) >> 4); + degrees = degrees * 10 + (buf.getUnsignedByte(buf.readerIndex()) >> 4); } double result = 0; @@ -154,7 +154,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Latitude Double latitude = Double.valueOf(parser.group(index++)); -- cgit v1.2.3