aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-07-17 20:28:52 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-07-17 20:28:52 -0700
commite8741d7ddc28b9c2db3865129368f0a8eaa6b032 (patch)
tree30cd1c4254e8af96e84fe47752784928a2c6c99f /src
parentb6cdfb459241f0a71f5ff9ce35814656465597dc (diff)
downloadtrackermap-server-e8741d7ddc28b9c2db3865129368f0a8eaa6b032.tar.gz
trackermap-server-e8741d7ddc28b9c2db3865129368f0a8eaa6b032.tar.bz2
trackermap-server-e8741d7ddc28b9c2db3865129368f0a8eaa6b032.zip
Fix battery decoding
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/EskyProtocolDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java4
2 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/EskyProtocolDecoder.java b/src/main/java/org/traccar/protocol/EskyProtocolDecoder.java
index 1a4f9b906..14b4376d5 100644
--- a/src/main/java/org/traccar/protocol/EskyProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/EskyProtocolDecoder.java
@@ -53,6 +53,7 @@ public class EskyProtocolDecoder extends BaseProtocolDecoder {
.number("(d+)[+;]") // message type
.number("(d+)[+;]") // odometer
.groupEnd("?")
+ .number("(d+)[+;]") // adc 1
.number("(d+)") // voltage
.any()
.compile();
@@ -93,7 +94,8 @@ public class EskyProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ODOMETER, parser.nextInt());
}
- position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);
+ position.set(Position.PREFIX_ADC + 1, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextInt() * 0.01);
int index = sentence.lastIndexOf('+');
if (index > 0 && channel instanceof DatagramChannel) {
diff --git a/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java
index 4db80c7ce..8ce9eca78 100644
--- a/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java
@@ -12,6 +12,10 @@ public class EskyProtocolDecoderTest extends ProtocolTest {
EskyProtocolDecoder decoder = new EskyProtocolDecoder(null);
verifyAttribute(decoder, text(
+ "ET;0;860337031066546;R;9+200717114059+41.32053+19.80761+0.30+0+0x2+8+40381744+0+1409+11"),
+ Position.KEY_BATTERY, 14.09);
+
+ verifyAttribute(decoder, text(
"ET;0;860337031078319;R;6+190317162511+41.32536+19.83144+0.14+0+0x0+0+18460312+0+1233+192"),
Position.KEY_IGNITION, true);