diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-03-04 00:25:05 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-03-04 00:25:05 -0800 |
commit | 455f96fb074cb02825c8303d0aa8eff0a848e9fd (patch) | |
tree | 97b3121806f3529bb9d405a55adf1f105f9a38b4 /src | |
parent | 96d7a6c1f8b2563c3b3fb3d4a8737e8c2d606f6e (diff) | |
download | trackermap-server-455f96fb074cb02825c8303d0aa8eff0a848e9fd.tar.gz trackermap-server-455f96fb074cb02825c8303d0aa8eff0a848e9fd.tar.bz2 trackermap-server-455f96fb074cb02825c8303d0aa8eff0a848e9fd.zip |
Decode GSM signal
Diffstat (limited to 'src')
-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; |