diff options
-rw-r--r-- | src/main/java/org/traccar/protocol/EskyProtocolDecoder.java | 4 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java | 4 |
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); |