From 2dcc3e0ee0ac637ca85e2457dc3d12c4edc01ec4 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 9 Sep 2023 11:58:57 -0700 Subject: Add RAMAC Multievent Callback --- .../traccar/protocol/RamacProtocolDecoderTest.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/java/org/traccar/protocol/RamacProtocolDecoderTest.java (limited to 'src/test/java/org') 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\"}"))); + + } + +} -- cgit v1.2.3