aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/protocol/RamacProtocolDecoderTest.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-09-09 11:58:57 -0700
committerAnton Tananaev <anton@traccar.org>2023-09-09 11:58:57 -0700
commit2dcc3e0ee0ac637ca85e2457dc3d12c4edc01ec4 (patch)
tree088da22e55ec6a4530559f18b37988888c5f4c29 /src/test/java/org/traccar/protocol/RamacProtocolDecoderTest.java
parent1ae9886ad10edcbc876a5295021f86bb7e534fde (diff)
downloadtrackermap-server-2dcc3e0ee0ac637ca85e2457dc3d12c4edc01ec4.tar.gz
trackermap-server-2dcc3e0ee0ac637ca85e2457dc3d12c4edc01ec4.tar.bz2
trackermap-server-2dcc3e0ee0ac637ca85e2457dc3d12c4edc01ec4.zip
Add RAMAC Multievent Callback
Diffstat (limited to 'src/test/java/org/traccar/protocol/RamacProtocolDecoderTest.java')
-rw-r--r--src/test/java/org/traccar/protocol/RamacProtocolDecoderTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/java/org/traccar/protocol/RamacProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RamacProtocolDecoderTest.java
new file mode 100644
index 000000000..86734a259
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/RamacProtocolDecoderTest.java
@@ -0,0 +1,26 @@
+package org.traccar.protocol;
+
+import io.netty.handler.codec.http.HttpMethod;
+import org.junit.jupiter.api.Test;
+import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
+
+public class RamacProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = inject(new RamacProtocolDecoder(null));
+
+ verifyAttributes(decoder, request(HttpMethod.POST, "/",
+ buffer("{\"PacketType\": 0,\"SeqNumber\": 4,\"UpdateDate\": \"2022-05-06 12:25:35\",\"Alert\": 42,\"AlertMessage\": \"Low Battery\",\"Mode\": 1,\"ModeText\": \"Help Me\",\"SigfoxTXInterval\": 2,\"GpsFixInterval\": 3,\"SigfoxTXIntervalText\": \"2 Seconds\",\"GpsFixIntervalText\": \"3 Seconds\",\"BatteryPercentage\": 4,\"Battery\": 0.1,\"Temperature\": -22,\"HwVersion\": 7,\"FirmwareVersion\": 8,\"DeviceId\": \"A10001\",\"DeviceType\": \"12\",\"DeviceTypeText\": \"RAMAC P1\"}")));
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
+ buffer("{\"PacketType\": 1,\"SeqNumber\": 4,\"UpdateDate\": \"2022-05-06 12:25:35\",\"Alert\": 0,\"AlertMessage\": \"\",\"Latitude\": -25.87586735939189,\"Longitude\": 28.179579268668846,\"Speed\": 1,\"COG\": 3,\"EstimatedAccuracy\": 3,\"LastLocation\": 0,\"LastLocationText\": \"NEW LOCATION\",\"IsMoving\": 0,\"IsMovingText\": \"STATIONARY\",\"GpsEvent\": 5,\"GpsEventText\": \"Heartbeat\",\"DeviceId\": \"A10001\",\"DeviceType\": \"12\",\"DeviceTypeText\": \"RAMAC P1\"}")));
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
+ buffer("{\"PacketType\": 2,\"SeqNumber\": 4,\"UpdateDate\": \"2022-05-06 12:25:35\",\"Alert\": 19,\"AlertMessage\": \"P1 Panic\",\"Event\": 16,\"DeviceId\": \"A10001\",\"DeviceType\": \"12\",\"DeviceTypeText\": \"RAMAC P1\",\"Latitude\": -25.875867359392,\"Longitude\": 28.179579268669,\"LocationDateTime\": \"2022-05-05 08:48:11\"}")));
+
+ }
+
+}