diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-11-13 10:09:37 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-11-13 10:09:37 -0800 |
commit | f0f22ee3e7f038a570800df10f1f29bb49a1a379 (patch) | |
tree | 5fad4b150c07ae060dc5cb10cb11ef33dd96bd5a /src | |
parent | 220a9fa8d05cd0e0d1459e6da852c82e0412d163 (diff) | |
download | trackermap-server-f0f22ee3e7f038a570800df10f1f29bb49a1a379.tar.gz trackermap-server-f0f22ee3e7f038a570800df10f1f29bb49a1a379.tar.bz2 trackermap-server-f0f22ee3e7f038a570800df10f1f29bb49a1a379.zip |
Support vibration alarm
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/TopinProtocolDecoder.java | 14 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java index 87db95946..7fd939caa 100644 --- a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java @@ -51,6 +51,9 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_WIFI_OFFLINE = 0x17; public static final int MSG_TIME_UPDATE = 0x30; public static final int MSG_WIFI = 0x69; + public static final int MSG_VIBRATION_ON = 0x92; + public static final int MSG_VIBRATION_OFF = 0x93; + public static final int MSG_VIBRATION = 0x94; private void sendResponse(Channel channel, int length, int type, ByteBuf content) { if (channel != null) { @@ -250,6 +253,17 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder { return position; + } else if (type == MSG_VIBRATION) { + + Position position = new Position(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + getLastLocation(position, null); + + position.set(Position.KEY_ALARM, Position.ALARM_VIBRATION); + + return position; + } return null; diff --git a/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java index 8f5b5ebbb..331be974c 100644 --- a/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java @@ -2,6 +2,7 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; +import org.traccar.model.Position; public class TopinProtocolDecoderTest extends ProtocolTest { @@ -16,6 +17,10 @@ public class TopinProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780d0103593390754169634d0d0a")); + verifyAttribute(decoder, binary( + "787801940D0A"), + Position.KEY_ALARM, Position.ALARM_VIBRATION); + verifyAttributes(decoder, binary( "78780A13424008196400041F000D0A")); |