diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-08-21 23:03:43 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-08-21 23:03:43 -0700 |
commit | 4ebb2d0c5c03846999b083c7ee52720730279b90 (patch) | |
tree | 7d5653edf97e6540410b76d987170af3a9963f91 /src | |
parent | 4d6d59733ea1f3470e2fa5267e369abfa3ec0d25 (diff) | |
download | traccar-server-4ebb2d0c5c03846999b083c7ee52720730279b90.tar.gz traccar-server-4ebb2d0c5c03846999b083c7ee52720730279b90.tar.bz2 traccar-server-4ebb2d0c5c03846999b083c7ee52720730279b90.zip |
Fix battery level decoding
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/UproProtocolDecoder.java | 4 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/UproProtocolDecoder.java b/src/main/java/org/traccar/protocol/UproProtocolDecoder.java index 0e328c920..873b22006 100644 --- a/src/main/java/org/traccar/protocol/UproProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/UproProtocolDecoder.java @@ -211,10 +211,6 @@ public class UproProtocolDecoder extends BaseProtocolDecoder { case 'S': position.set("obdTraffic", ByteBufUtil.hexDump(data)); break; - case 'T': - position.set(Position.KEY_BATTERY_LEVEL, - Integer.parseInt(data.readSlice(2).toString(StandardCharsets.US_ASCII))); - break; case 'V': position.set(Position.KEY_POWER, Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII)) * 0.1); diff --git a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java index 856e527c4..e43ff322e 100644 --- a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java @@ -2,6 +2,7 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; +import org.traccar.model.Position; public class UproProtocolDecoderTest extends ProtocolTest { @@ -10,6 +11,10 @@ public class UproProtocolDecoderTest extends ProtocolTest { UproProtocolDecoder decoder = new UproProtocolDecoder(null); + verifyAttribute(decoder, buffer( + "*VK200867282036729446,BA&A1759265051877702037465660022210819&B0000000000&W00&G000030&M830&N26&O1706&o11&T0783#"), + Position.KEY_BATTERY_LEVEL, 83.0); + verifyAttributes(decoder, buffer( "*VK201867282035754650,AH&B0000000000&W00&M990&N31&Z02&b2&T0458#")); |