aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-02-25 21:40:33 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-02-25 21:40:33 -0800
commit886a1ac0550c5aecb13222668f4ca35758ec92d1 (patch)
tree84e8c4f040b2a013869fe1c8d33216a09b99f66d /src
parent9662f1d3b813bbdead7613f6919e23b6fe76c6db (diff)
downloadtraccar-server-886a1ac0550c5aecb13222668f4ca35758ec92d1.tar.gz
traccar-server-886a1ac0550c5aecb13222668f4ca35758ec92d1.tar.bz2
traccar-server-886a1ac0550c5aecb13222668f4ca35758ec92d1.zip
Decode ignition value
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/EskyProtocolDecoder.java6
-rw-r--r--src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/EskyProtocolDecoder.java b/src/main/java/org/traccar/protocol/EskyProtocolDecoder.java
index d9de110f4..f0ae0bc91 100644
--- a/src/main/java/org/traccar/protocol/EskyProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/EskyProtocolDecoder.java
@@ -21,6 +21,7 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
@@ -88,7 +89,10 @@ public class EskyProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
if (parser.hasNext(3)) {
- position.set(Position.KEY_INPUT, parser.nextHexInt());
+ int input = parser.nextHexInt();
+ position.set(Position.KEY_IGNITION, !BitUtil.check(input, 0));
+ position.set(Position.PREFIX_IN + 1, !BitUtil.check(input, 1));
+ position.set(Position.PREFIX_IN + 2, !BitUtil.check(input, 2));
position.set(Position.KEY_EVENT, parser.nextInt());
position.set(Position.KEY_ODOMETER, parser.nextInt());
}
diff --git a/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java
index da7df0ab2..4db80c7ce 100644
--- a/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class EskyProtocolDecoderTest extends ProtocolTest {
@@ -10,6 +11,10 @@ public class EskyProtocolDecoderTest extends ProtocolTest {
EskyProtocolDecoder decoder = new EskyProtocolDecoder(null);
+ 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);
+
verifyPosition(decoder, text(
"EO;0;861311006461908;R;6;180420104751;2.97896;101.65091;0.75;320;3398;1;|"));