diff options
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r-- | src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java b/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java index eae37386a..6fe54b0b0 100644 --- a/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 Anton Tananaev (anton@traccar.org) + * Copyright 2019 - 2020 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,10 +77,24 @@ public class SolarPoweredProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(-position.getLongitude()); } position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte())); - position.set(Position.KEY_DEVICE_TEMP, (int) buf.readByte()); + int temperature = buf.readUnsignedByte(); + if (BitUtil.check(temperature, 7)) { + position.set(Position.KEY_DEVICE_TEMP, -BitUtil.to(temperature, 7)); + } else { + position.set(Position.KEY_DEVICE_TEMP, BitUtil.to(temperature, 7)); + } position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.02); position.setCourse(buf.readUnsignedByte()); break; + case 0x83: + buf.readUnsignedInt(); // uptime + buf.readUnsignedInt(); // gps count + buf.readUnsignedInt(); // gsm count + buf.readUnsignedByte(); // positioning time + buf.readUnsignedByte(); // registration time + buf.readUnsignedByte(); // connection time + position.set(Position.KEY_RSSI, buf.readUnsignedByte()); + break; default: buf.skipBytes(length); break; |