aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAuroraRAS <chplee@gmail.com>2021-05-02 01:36:22 +0800
committerAuroraRAS <chplee@gmail.com>2021-05-02 01:36:22 +0800
commit0d8f2af5ea9bafeec92a54d10b190165fa0b5d91 (patch)
tree3bec83b2112d12f93ce5ce992c433b7e0cf794fd /src/test/java/org/traccar/protocol
parent7a4f3f22239cc9b3405387a29819654265e9b345 (diff)
downloadtrackermap-server-0d8f2af5ea9bafeec92a54d10b190165fa0b5d91.tar.gz
trackermap-server-0d8f2af5ea9bafeec92a54d10b190165fa0b5d91.tar.bz2
trackermap-server-0d8f2af5ea9bafeec92a54d10b190165fa0b5d91.zip
Add mavlink2 protocol support
Mavlink2 is a common protocol for unmanned vehicles and flight controllers like Pixhawk devices.
Diffstat (limited to 'src/test/java/org/traccar/protocol')
-rw-r--r--src/test/java/org/traccar/protocol/Mavlink2ProtocolDecoderTest.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/test/java/org/traccar/protocol/Mavlink2ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Mavlink2ProtocolDecoderTest.java
new file mode 100644
index 000000000..2f824b603
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/Mavlink2ProtocolDecoderTest.java
@@ -0,0 +1,56 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class Mavlink2ProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = new Mavlink2ProtocolDecoder(null);
+
+ byte[] pkt = {
+ // Packet start marker
+ (byte) 0xfd,
+ // Payload length
+ (byte) 0x1c,
+ // Incompatibility Flags
+ (byte) 0x00,
+ // Compatibility Flags
+ (byte) 0x00,
+ // Packet sequence
+ (byte) 0x74,
+ // System ID (sender)
+ (byte) 0x01,
+ // Component ID (sender)
+ (byte) 0x01,
+ // Message ID (low, middle, high bytes)
+ (byte) 0x21, (byte) 0x00, (byte) 0x00,
+ // Payload Message data
+ // Timestamp (time since system boot).
+ (byte) 0xcc, (byte) 0xae, (byte) 0x08, (byte) 0x00,
+ // degE7 Latitude
+ (byte) 0x40, (byte) 0x05, (byte) 0xd3, (byte) 0x23,
+ // degE7 Longitude
+ (byte) 0xb8, (byte) 0x9a, (byte) 0xa3, (byte) 0x0e,
+ // mm Altitude (MSL)
+ (byte) 0x2e, (byte) 0xd0, (byte) 0x06, (byte) 0x00,
+ // mm Altitude above ground
+ (byte) 0x67, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ // cm/s Ground X Speed
+ (byte) 0x8b, (byte) 0xff,
+ // cm/s Ground Y Speed
+ (byte) 0x05, (byte) 0x00,
+ // cm/s Ground Z Speed
+ (byte) 0x03, (byte) 0x00,
+ // cdeg Vehicle heading (yaw angle)
+ (byte) 0x4f, (byte) 0x2d,
+ // Checksum (low byte, high byte)
+ (byte) 0x00, (byte) 0x00
+ };
+ verifyPosition(decoder, pkt);
+
+ }
+
+}