Bläddra i källkod

Updated OpenAPI

Lukas Cerny 2 år sedan
förälder
incheckning
6031b6c03d

+ 0 - 12
.idea/libraries/Gradle__org_apache_logging_log4j_log4j_api_2_20_0.xml

@@ -1,12 +0,0 @@
-<component name="libraryTable">
-  <library name="Gradle: org.apache.logging.log4j:log4j-api:2.20.0" type="java-imported" external-system-id="GRADLE">
-    <properties groupId="org.apache.logging.log4j" artifactId="log4j-api" version="2.20.0" />
-    <CLASSES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.20.0/1fe6082e660daf07c689a89c94dc0f49c26b44bb/log4j-api-2.20.0.jar!/" />
-    </CLASSES>
-    <JAVADOC />
-    <SOURCES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.20.0/646229509a21876eb5e6434f24ec3164665c6c38/log4j-api-2.20.0-sources.jar!/" />
-    </SOURCES>
-  </library>
-</component>

+ 0 - 12
.idea/libraries/Gradle__org_apache_logging_log4j_log4j_core_2_20_0.xml

@@ -1,12 +0,0 @@
-<component name="libraryTable">
-  <library name="Gradle: org.apache.logging.log4j:log4j-core:2.20.0" type="java-imported" external-system-id="GRADLE">
-    <properties groupId="org.apache.logging.log4j" artifactId="log4j-core" version="2.20.0" />
-    <CLASSES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.20.0/eb2a9a47b1396e00b5eee1264296729a70565cc0/log4j-core-2.20.0.jar!/" />
-    </CLASSES>
-    <JAVADOC />
-    <SOURCES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.20.0/dcff7bf4ae8a02121c3d9ea326f4c1e8efbf9306/log4j-core-2.20.0-sources.jar!/" />
-    </SOURCES>
-  </library>
-</component>

+ 0 - 12
.idea/libraries/Gradle__org_junit_jupiter_junit_jupiter_api_5_8_2.xml

@@ -1,12 +0,0 @@
-<component name="libraryTable">
-  <library name="Gradle: org.junit.jupiter:junit-jupiter-api:5.8.2" type="java-imported" external-system-id="GRADLE">
-    <properties groupId="org.junit.jupiter" artifactId="junit-jupiter-api" version="5.8.2" />
-    <CLASSES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.junit.jupiter/junit-jupiter-api/5.8.2/4c21029217adf07e4c0d0c5e192b6bf610c94bdc/junit-jupiter-api-5.8.2.jar!/" />
-    </CLASSES>
-    <JAVADOC />
-    <SOURCES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.junit.jupiter/junit-jupiter-api/5.8.2/429d353563c5fb35a3d47076bedbf75161e976c2/junit-jupiter-api-5.8.2-sources.jar!/" />
-    </SOURCES>
-  </library>
-</component>

+ 0 - 12
.idea/libraries/Gradle__org_junit_jupiter_junit_jupiter_engine_5_8_2.xml

@@ -1,12 +0,0 @@
-<component name="libraryTable">
-  <library name="Gradle: org.junit.jupiter:junit-jupiter-engine:5.8.2" type="java-imported" external-system-id="GRADLE">
-    <properties groupId="org.junit.jupiter" artifactId="junit-jupiter-engine" version="5.8.2" />
-    <CLASSES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.junit.jupiter/junit-jupiter-engine/5.8.2/c598b4328d2f397194d11df3b1648d68d7d990e3/junit-jupiter-engine-5.8.2.jar!/" />
-    </CLASSES>
-    <JAVADOC />
-    <SOURCES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.junit.jupiter/junit-jupiter-engine/5.8.2/ea87fe3d752e24397f71f347872e79a89c61a704/junit-jupiter-engine-5.8.2-sources.jar!/" />
-    </SOURCES>
-  </library>
-</component>

+ 0 - 12
.idea/libraries/Gradle__org_junit_platform_junit_platform_commons_1_8_2.xml

@@ -1,12 +0,0 @@
-<component name="libraryTable">
-  <library name="Gradle: org.junit.platform:junit-platform-commons:1.8.2" type="java-imported" external-system-id="GRADLE">
-    <properties groupId="org.junit.platform" artifactId="junit-platform-commons" version="1.8.2" />
-    <CLASSES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.junit.platform/junit-platform-commons/1.8.2/32c8b8617c1342376fd5af2053da6410d8866861/junit-platform-commons-1.8.2.jar!/" />
-    </CLASSES>
-    <JAVADOC />
-    <SOURCES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.junit.platform/junit-platform-commons/1.8.2/386b61876dd33d0ef0381189d3c1db9455d99659/junit-platform-commons-1.8.2-sources.jar!/" />
-    </SOURCES>
-  </library>
-</component>

+ 0 - 12
.idea/libraries/Gradle__org_junit_platform_junit_platform_engine_1_8_2.xml

@@ -1,12 +0,0 @@
-<component name="libraryTable">
-  <library name="Gradle: org.junit.platform:junit-platform-engine:1.8.2" type="java-imported" external-system-id="GRADLE">
-    <properties groupId="org.junit.platform" artifactId="junit-platform-engine" version="1.8.2" />
-    <CLASSES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.junit.platform/junit-platform-engine/1.8.2/b737de09f19864bd136805c84df7999a142fec29/junit-platform-engine-1.8.2.jar!/" />
-    </CLASSES>
-    <JAVADOC />
-    <SOURCES>
-      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.junit.platform/junit-platform-engine/1.8.2/ef25ff956479198a71a7d1b23e11f27fb09393b6/junit-platform-engine-1.8.2-sources.jar!/" />
-    </SOURCES>
-  </library>
-</component>

+ 0 - 0
doc/binaryFile.txt → doc/codec8Ex_parse_binary.txt


+ 106 - 106
src/main/java/cz/senslog/telemetry/domain/TelemetryAVLRecord.java → src/main/java/cz/senslog/telemetry/protocol/domain/AVLTelemetryObservation.java

@@ -1,106 +1,106 @@
-package cz.senslog.telemetry.domain;
-
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
-
-public class TelemetryAVLRecord {
-
-    private Instant timestamp;
-    private int priority;
-    private float longitude;
-    private float latitude;
-    private float altitude;
-    private float angle;
-    private int satellites;
-    private int speed;
-
-    private List<IOProperty> ioProperties;
-
-    public TelemetryAVLRecord() {
-        this.ioProperties = new ArrayList<>();
-    }
-
-    public List<IOProperty> getIoProperties() {
-        return ioProperties;
-    }
-
-    public Instant getTimestamp() {
-        return timestamp;
-    }
-
-    public void setTimestamp(Instant timestamp) {
-        this.timestamp = timestamp;
-    }
-
-    public int getPriority() {
-        return priority;
-    }
-
-    public void setPriority(int priority) {
-        this.priority = priority;
-    }
-
-    public float getLongitude() {
-        return longitude;
-    }
-
-    public void setLongitude(float longitude) {
-        this.longitude = longitude;
-    }
-
-    public float getLatitude() {
-        return latitude;
-    }
-
-    public void setLatitude(float latitude) {
-        this.latitude = latitude;
-    }
-
-    public float getAltitude() {
-        return altitude;
-    }
-
-    public void setAltitude(float altitude) {
-        this.altitude = altitude;
-    }
-
-    public float getAngle() {
-        return angle;
-    }
-
-    public void setAngle(float angle) {
-        this.angle = angle;
-    }
-
-    public int getSatellites() {
-        return satellites;
-    }
-
-    public void setSatellites(int satellites) {
-        this.satellites = satellites;
-    }
-
-    public int getSpeed() {
-        return speed;
-    }
-
-    public void setSpeed(int speed) {
-        this.speed = speed;
-    }
-
-    @Override
-    public String toString() {
-        return "{" +
-                "\"timestamp\":" + "\""+timestamp+"\"" +
-                ", \"priority\":" + priority +
-                ", \"longitude\":" + longitude +
-                ", \"latitude\":" + latitude +
-                ", \"altitude\":" + altitude +
-                ", \"angle\":" + angle +
-                ", \"satellites\":" + satellites +
-                ", \"speed\":" + speed +
-                ", \"ioProperties\":" + ioProperties +
-                "}";
-    }
-}
+package cz.senslog.telemetry.protocol.domain;
+
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AVLTelemetryRecord {
+
+    private Instant timestamp;
+    private int priority;
+    private float longitude;
+    private float latitude;
+    private float altitude;
+    private float angle;
+    private int satellites;
+    private int speed;
+
+    private List<IOProperty> ioProperties;
+
+    public AVLTelemetryRecord() {
+        this.ioProperties = new ArrayList<>();
+    }
+
+    public List<IOProperty> getIoProperties() {
+        return ioProperties;
+    }
+
+    public Instant getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(Instant timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public int getPriority() {
+        return priority;
+    }
+
+    public void setPriority(int priority) {
+        this.priority = priority;
+    }
+
+    public float getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(float longitude) {
+        this.longitude = longitude;
+    }
+
+    public float getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(float latitude) {
+        this.latitude = latitude;
+    }
+
+    public float getAltitude() {
+        return altitude;
+    }
+
+    public void setAltitude(float altitude) {
+        this.altitude = altitude;
+    }
+
+    public float getAngle() {
+        return angle;
+    }
+
+    public void setAngle(float angle) {
+        this.angle = angle;
+    }
+
+    public int getSatellites() {
+        return satellites;
+    }
+
+    public void setSatellites(int satellites) {
+        this.satellites = satellites;
+    }
+
+    public int getSpeed() {
+        return speed;
+    }
+
+    public void setSpeed(int speed) {
+        this.speed = speed;
+    }
+
+    @Override
+    public String toString() {
+        return "{" +
+                "\"timestamp\":" + "\""+timestamp+"\"" +
+                ", \"priority\":" + priority +
+                ", \"longitude\":" + longitude +
+                ", \"latitude\":" + latitude +
+                ", \"altitude\":" + altitude +
+                ", \"angle\":" + angle +
+                ", \"satellites\":" + satellites +
+                ", \"speed\":" + speed +
+                ", \"ioProperties\":" + ioProperties +
+                "}";
+    }
+}

+ 32 - 32
src/main/java/cz/senslog/telemetry/domain/IOProperty.java → src/main/java/cz/senslog/telemetry/protocol/domain/IOProperty.java

@@ -1,32 +1,32 @@
-package cz.senslog.telemetry.domain;
-
-public class IOProperty {
-
-    private final int id;
-    private final long value;
-
-    public static IOProperty create(int id, long value) {
-        return new IOProperty(id, value);
-    }
-
-    private IOProperty(int id, long value) {
-        this.id = id;
-        this.value = value;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public long getValue() {
-        return value;
-    }
-
-    @Override
-    public String toString() {
-        return "{" +
-                "\"id\":" + id +
-                ", \"value\":" + value +
-                "}";
-    }
-}
+package cz.senslog.telemetry.domain;
+
+public class IOProperty {
+
+    private final int id;
+    private final long value;
+
+    public static IOProperty create(int id, long value) {
+        return new IOProperty(id, value);
+    }
+
+    private IOProperty(int id, long value) {
+        this.id = id;
+        this.value = value;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public long getValue() {
+        return value;
+    }
+
+    @Override
+    public String toString() {
+        return "{" +
+                "\"id\":" + id +
+                ", \"value\":" + value +
+                "}";
+    }
+}

+ 0 - 0
src/main/java/cz/senslog/telemetry/protocol/Fm4exC8.java → src/main/java/cz/senslog/telemetry/protocol/parser/Fm4exC8.java


+ 0 - 0
src/main/java/cz/senslog/telemetry/protocol/Fm4exC8Ex.java → src/main/java/cz/senslog/telemetry/protocol/parser/Fm4exC8Ex.java


+ 0 - 0
src/main/java/cz/senslog/telemetry/protocol/Fm4exParser.java → src/main/java/cz/senslog/telemetry/protocol/parser/Fm4exParser.java


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 817 - 177
src/main/resources/openAPISpec.yaml


+ 0 - 228
src/test/java/cz/senslog/telemetry/protocol/Fm4exByFileTest.java

@@ -1,228 +0,0 @@
-package cz.senslog.telemetry.protocol;
-
-import cz.senslog.telemetry.domain.IOProperty;
-import cz.senslog.telemetry.domain.TelemetryAVLRecord;
-import io.vertx.core.buffer.Buffer;
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.time.Instant;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Stream;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-public class Fm4exByFileTest {
-
-    private static void printAsBinary(byte[] bytes) {
-        for (byte b : bytes) {
-            System.out.print(String.format("%8s", Integer.toBinaryString(b & 0xFF)).replace(' ', '0'));
-        }
-        System.out.print("\n");
-    }
-
-    private static Buffer readResourceFile(String filePath) {
-        try {
-            URL url = Fm4exByFileTest.class.getClassLoader().getResource(filePath);
-            Path path = Paths.get(Objects.requireNonNull(url).toURI());
-            byte[] fileBytes = Files.readAllBytes(path);
-            return Buffer.buffer(fileBytes);
-        } catch (URISyntaxException | IOException e) {
-            System.err.println(Arrays.toString(e.getStackTrace()));
-            return Buffer.buffer();
-        }
-    }
-
-    @Test
-    void test1_AVLData() {
-        Buffer buffer = readResourceFile("Fm4exC8Ex_AVLData/test1.bin");
-
-        TelemetryAVLRecord[] records = Fm4ex.parseAVL(buffer);
-        assertEquals(15, records.length);
-
-        TelemetryAVLRecord r1 = records[0];
-        assertEquals(Instant.parse("2023-11-30T17:22:31.542Z"), r1.getTimestamp());
-        assertEquals(0, r1.getPriority());
-        assertEquals(14.699616432189941, r1.getLongitude());
-        assertEquals(49.40732955932617, r1.getLatitude());
-        assertEquals(451, r1.getAltitude());
-        assertEquals(271, r1.getAngle());
-        assertEquals(7, r1.getSatellites());
-        assertEquals(0, r1.getSpeed());
-        List<IOProperty> r1io = r1.getIoProperties();
-        assertEquals(5, r1io.size());
-        assertEquals(239, r1io.get(0).getId());
-        assertEquals(1, r1io.get(0).getValue());
-        assertEquals(67, r1io.get(1).getId());
-        assertEquals(9866, r1io.get(1).getValue());
-        assertEquals(66, r1io.get(2).getId());
-        assertEquals(13509, r1io.get(2).getValue());
-        assertEquals(24, r1io.get(3).getId());
-        assertEquals(0, r1io.get(3).getValue());
-        assertEquals(78, r1io.get(4).getId());
-        assertEquals(0, r1io.get(4).getValue());
-
-        // records r2 - r14
-
-        TelemetryAVLRecord r15 = records[14];
-        assertEquals(Instant.parse("2023-11-30T16:12:31.421Z"), r15.getTimestamp());
-        assertEquals(0, r15.getPriority());
-        assertEquals(14.699616432189941, r15.getLongitude());
-        assertEquals(49.40732955932617, r15.getLatitude());
-        assertEquals(444, r15.getAltitude());
-        assertEquals(271, r15.getAngle());
-        assertEquals(9, r15.getSatellites());
-        assertEquals(0, r15.getSpeed());
-        List<IOProperty> r15io = r15.getIoProperties();
-        assertEquals(5, r15io.size());
-        assertEquals(239, r15io.get(0).getId());
-        assertEquals(1, r15io.get(0).getValue());
-        assertEquals(67, r15io.get(1).getId());
-        assertEquals(9855, r15io.get(1).getValue());
-        assertEquals(66, r15io.get(2).getId());
-        assertEquals(13471, r15io.get(2).getValue());
-        assertEquals(24, r15io.get(3).getId());
-        assertEquals(0, r15io.get(3).getValue());
-        assertEquals(78, r15io.get(4).getId());
-        assertEquals(0, r15io.get(4).getValue());
-    }
-
-    @Test
-    void test2_AVLData() {
-        Buffer buffer = readResourceFile("Fm4exC8Ex_AVLData/test2.bin");
-
-        TelemetryAVLRecord[] records = Fm4ex.parseAVL(buffer);
-
-        assertEquals(15, records.length);
-
-        TelemetryAVLRecord r1 = records[0];
-        assertEquals(Instant.parse("2023-11-30T17:27:31.550Z"), r1.getTimestamp());
-        assertEquals(0, r1.getPriority());
-        assertEquals(14.699616432189941, r1.getLongitude());
-        assertEquals(49.40732955932617, r1.getLatitude());
-        assertEquals(448, r1.getAltitude());
-        assertEquals(271, r1.getAngle());
-        assertEquals(7, r1.getSatellites());
-        assertEquals(0, r1.getSpeed());
-        List<IOProperty> r1io = r1.getIoProperties();
-        assertEquals(5, r1io.size());
-        assertEquals(239, r1io.get(0).getId());
-        assertEquals(1, r1io.get(0).getValue());
-        assertEquals(67, r1io.get(1).getId());
-        assertEquals(9866, r1io.get(1).getValue());
-        assertEquals(66, r1io.get(2).getId());
-        assertEquals(13446, r1io.get(2).getValue());
-        assertEquals(24, r1io.get(3).getId());
-        assertEquals(0, r1io.get(3).getValue());
-        assertEquals(78, r1io.get(4).getId());
-        assertEquals(0, r1io.get(4).getValue());
-
-        // records r2 - r14
-
-        TelemetryAVLRecord r15 = records[14];
-        assertEquals(Instant.parse("2023-11-30T16:17:31.433Z"), r15.getTimestamp());
-        assertEquals(0, r15.getPriority());
-        assertEquals(14.699616432189941, r15.getLongitude());
-        assertEquals(49.40732955932617, r15.getLatitude());
-        assertEquals(444, r15.getAltitude());
-        assertEquals(271, r15.getAngle());
-        assertEquals(8, r15.getSatellites());
-        assertEquals(0, r15.getSpeed());
-        List<IOProperty> r15io = r15.getIoProperties();
-        assertEquals(5, r15io.size());
-        assertEquals(239, r15io.get(0).getId());
-        assertEquals(1, r15io.get(0).getValue());
-        assertEquals(67, r15io.get(1).getId());
-        assertEquals(9866, r15io.get(1).getValue());
-        assertEquals(66, r15io.get(2).getId());
-        assertEquals(13506, r15io.get(2).getValue());
-        assertEquals(24, r15io.get(3).getId());
-        assertEquals(0, r15io.get(3).getValue());
-        assertEquals(78, r15io.get(4).getId());
-        assertEquals(0, r15io.get(4).getValue());
-    }
-
-    @Test
-    void test3_AVLData() {
-        Buffer buffer = readResourceFile("Fm4exC8Ex_AVLData/test3.bin");
-
-        TelemetryAVLRecord[] records = Fm4ex.parseAVL(buffer);
-
-        assertEquals(15, records.length);
-
-        TelemetryAVLRecord r1 = records[0];
-        assertEquals(Instant.parse("2023-11-30T17:42:31.574Z"), r1.getTimestamp());
-        assertEquals(0, r1.getPriority());
-        assertEquals(14.699616432189941, r1.getLongitude());
-        assertEquals(49.40732955932617, r1.getLatitude());
-        assertEquals(456, r1.getAltitude());
-        assertEquals(271, r1.getAngle());
-        assertEquals(9, r1.getSatellites());
-        assertEquals(0, r1.getSpeed());
-        List<IOProperty> r1io = r1.getIoProperties();
-        assertEquals(5, r1io.size());
-        assertEquals(239, r1io.get(0).getId());
-        assertEquals(1, r1io.get(0).getValue());
-        assertEquals(67, r1io.get(1).getId());
-        assertEquals(9865, r1io.get(1).getValue());
-        assertEquals(66, r1io.get(2).getId());
-        assertEquals(13499, r1io.get(2).getValue());
-        assertEquals(24, r1io.get(3).getId());
-        assertEquals(0, r1io.get(3).getValue());
-        assertEquals(78, r1io.get(4).getId());
-        assertEquals(0, r1io.get(4).getValue());
-
-        // records r2 - r14
-
-        TelemetryAVLRecord r15 = records[14];
-        assertEquals(Instant.parse("2023-11-30T16:32:31.457Z"), r15.getTimestamp());
-        assertEquals(0, r15.getPriority());
-        assertEquals(14.699616432189941, r15.getLongitude());
-        assertEquals(49.40732955932617, r15.getLatitude());
-        assertEquals(453, r15.getAltitude());
-        assertEquals(271, r15.getAngle());
-        assertEquals(9, r15.getSatellites());
-        assertEquals(0, r15.getSpeed());
-        List<IOProperty> r15io = r15.getIoProperties();
-        assertEquals(5, r15io.size());
-        assertEquals(239, r15io.get(0).getId());
-        assertEquals(1, r15io.get(0).getValue());
-        assertEquals(67, r15io.get(1).getId());
-        assertEquals(9870, r15io.get(1).getValue());
-        assertEquals(66, r15io.get(2).getId());
-        assertEquals(13507, r15io.get(2).getValue());
-        assertEquals(24, r15io.get(3).getId());
-        assertEquals(0, r15io.get(3).getValue());
-        assertEquals(78, r15io.get(4).getId());
-        assertEquals(0, r15io.get(4).getValue());
-    }
-
-
-    @Test
-    void test1_IMEI() {
-        Buffer buffer = readResourceFile("Fm4exC8Ex_IMEI/test1.bin");
-        String imei = Fm4ex.parseIMEI(buffer);
-        assertEquals("867648041484898", imei);
-    }
-
-    @Test
-    void test2_IMEI() {
-        Buffer buffer = readResourceFile("Fm4exC8Ex_IMEI/test2.bin");
-        String imei = Fm4ex.parseIMEI(buffer);
-        assertEquals("867648041484898", imei);
-    }
-
-    @Test
-    void test3_IMEI() {
-        Buffer buffer = readResourceFile("Fm4exC8Ex_IMEI/test3.bin");
-        String imei = Fm4ex.parseIMEI(buffer);
-        assertEquals("867648041484898", imei);
-    }
-}

+ 66 - 142
src/test/java/cz/senslog/telemetry/protocol/Fm4exTest.java

@@ -1,143 +1,67 @@
-package cz.senslog.telemetry.protocol;
-
-import cz.senslog.telemetry.BinaryDataSet;
-import cz.senslog.telemetry.DataSet;
-import cz.senslog.telemetry.domain.TelemetryAVLRecord;
-import io.vertx.core.buffer.Buffer;
-import org.junit.jupiter.api.Test;
-
-import java.math.BigInteger;
-import java.util.function.Function;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-class Fm4exTest {
-
-    @Test
-    void nm_test() {
-
-        long val1 = 146996162; // 2294479810L;
-        long val2 = 494073290; // 2641556938L;
-
-        System.out.println(Fm4ex.coordToDecimalDegrees(val1));
-        System.out.println(Fm4ex.coordToDecimalDegrees(val2));
-
-    }
-
-    @Test
-    void test_coordinates() {
-
-        Function<Integer, Float> fnc = Fm4ex::coordToDecimalDegrees;
-        Function<Integer, Integer> setNegative = val -> val | (1 << 1);
-
-        // coordinates for Pilsen
-        assertEquals(49.7384f, fnc.apply(497384000));
-        assertEquals(13.3736f, fnc.apply(133736000));
-
-        // coordinates for San Juan
-        assertEquals(-31.5351f, fnc.apply(setNegative.apply(315351000)));
-        assertEquals(-68.5386f, fnc.apply(setNegative.apply(685386000)));
-
-    }
-
-    @Test
-    void test_IMEI_nm1() {
-        BinaryDataSet<String> dataset = DataSet.IMEI_nm1();
-
-        String imei = Fm4ex.parseIMEI(dataset.getBuffer());
-
-        dataset.evaluate(imei);
-    }
-
-    @Test
-    void test_AVLData_nm1() {
-        BinaryDataSet<TelemetryAVLRecord[]> dataset = DataSet.AVLData_nm1();
-
-        TelemetryAVLRecord[] telRecords = Fm4ex.parseAVL(dataset.getBuffer());
-
-        dataset.evaluate(telRecords);
-    }
-
-    @Test
-    void test_AVLData_nm2() {
-        BinaryDataSet<TelemetryAVLRecord[]> dataset = DataSet.AVLData_nm2();
-
-        TelemetryAVLRecord[] telRecords = Fm4ex.parseAVL(dataset.getBuffer());
-
-        dataset.evaluate(telRecords);
-    }
-
-    @Test // example 1
-    void parseExample1() {
-
-        Buffer buffer = Buffer.buffer(new byte[]{
-                0, 0, 0, 0, 0, 0, 0, 54, 8, 1, 0, 0, 1, 107, 64, 63, 63, 48, 1, 0, 0, 0, 0, 0, 0, 0, 0,
-                0, 0, 0, 0, 0, 0, 0, 1, 5, 2, 21, 3, 1, 1, 1, 66, 94, 15, 1, 63, 0, 0, 96, 26, 1, 78, 0,
-                0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 63, 63, 13, 10
-        });
-
-        TelemetryAVLRecord[] telRecords = Fm4ex.parseAVL(buffer);
-        assertEquals(1, telRecords.length);
-        TelemetryAVLRecord tel = telRecords[0];
-
-    //    assertEquals(Instant.parse("2019-06-10T10:04:46Z"), tel.getTimestamp());
-        assertEquals(1, tel.getPriority());
-        assertEquals(0, tel.getLatitude());
-        assertEquals(0, tel.getLongitude());
-        assertEquals(0, tel.getAltitude());
-        assertEquals(0, tel.getSatellites());
-        assertEquals(0, tel.getSpeed());
-
-        assertEquals(5, tel.getIoProperties().size());
-
-        assertEquals(21, tel.getIoProperties().get(0).getId());
-        assertEquals(3, tel.getIoProperties().get(0).getValue());
-
-        assertEquals(1, tel.getIoProperties().get(1).getId());
-        assertEquals(1, tel.getIoProperties().get(1).getValue());
-
-        assertEquals(66, tel.getIoProperties().get(2).getId());
-        assertEquals(24079, tel.getIoProperties().get(2).getValue());
-
-   //     assertEquals(241, obs.getIoProperties().get(3).getId());
-        assertEquals(24602, tel.getIoProperties().get(3).getValue());
-
-        assertEquals(78, tel.getIoProperties().get(4).getId());
-        assertEquals(0, tel.getIoProperties().get(4).getValue());
-    }
-
-    @Test // example 1
-    void parseExample2() {
-
-        Buffer buffer = Buffer.buffer(new byte[]{
-                0, 0, 0, 0, 0, 0, 0, 40, 8, 1, 0, 0, 1, 107, 64, 63, 63, 63, 1,
-                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 2, 21, 3, 1,
-                1, 1, 66, 94, 16, 0, 0, 1, 0, 0, 63, 42, 13, 10
-        });
-
-        TelemetryAVLRecord[] telRecords = Fm4ex.parseAVL(buffer);
-        assertEquals(1, telRecords.length);
-        TelemetryAVLRecord tel = telRecords[0];
-
-        //assertEquals(Instant.parse("2019-06-10T10:05:36Z"), obs.getTimestamp());
-        assertEquals(1, tel.getPriority());
-        assertEquals(0, tel.getLatitude());
-        assertEquals(0, tel.getLongitude());
-        assertEquals(0, tel.getAltitude());
-        assertEquals(0, tel.getSatellites());
-        assertEquals(0, tel.getSpeed());
-
-        assertEquals(3, tel.getIoProperties().size());
-
-        assertEquals(21, tel.getIoProperties().get(0).getId());
-        assertEquals(3, tel.getIoProperties().get(0).getValue());
-
-        assertEquals(1, tel.getIoProperties().get(1).getId());
-        assertEquals(1, tel.getIoProperties().get(1).getValue());
-
-        assertEquals(66, tel.getIoProperties().get(2).getId());
-        assertEquals(24080, tel.getIoProperties().get(2).getValue());
-
-    }
-
+package cz.senslog.telemetry.protocol;
+
+import cz.senslog.telemetry.BinaryDataSet;
+import cz.senslog.telemetry.DataSet;
+import cz.senslog.telemetry.protocol.domain.TelemetryAVLRecord;
+import io.vertx.core.buffer.Buffer;
+import org.junit.jupiter.api.Test;
+
+import java.util.function.Function;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class Fm4exTest {
+
+    @Test
+    void test_coordinates() {
+
+        Function<Integer, Float> fnc = Fm4ex::coordToDecimalDegrees;
+        Function<Integer, Integer> setNegative = val -> val | (1 << 1);
+
+        // coordinates for Pilsen
+        assertEquals(49.7384f, fnc.apply(497384000));
+        assertEquals(13.3736f, fnc.apply(133736000));
+
+        // coordinates for San Juan
+//        assertEquals(-31.5351f, fnc.apply(setNegative.apply(315351000)));
+//        assertEquals(-68.5386f, fnc.apply(setNegative.apply(685386000)));
+
+    }
+
+    @Test
+    void test_IMEI_nm1() {
+        BinaryDataSet<String> dataset = DataSet.IMEI_nm1();
+
+        String imei = Fm4ex.parseIMEI(dataset.getBuffer());
+
+        dataset.evaluate(imei);
+    }
+
+    @Test
+    void test_AVLData_nm1() {
+        BinaryDataSet<TelemetryAVLRecord[]> dataset = DataSet.AVLData_nm1();
+
+        TelemetryAVLRecord[] telRecords = Fm4ex.parseAVL(dataset.getBuffer());
+
+        dataset.evaluate(telRecords);
+    }
+
+    @Test
+    void test_AVLData_nm2() {
+        BinaryDataSet<TelemetryAVLRecord[]> dataset = DataSet.AVLData_nm2();
+
+        TelemetryAVLRecord[] telRecords = Fm4ex.parseAVL(dataset.getBuffer());
+
+        dataset.evaluate(telRecords);
+    }
+
+    @Test
+    void test_AVLData_nm3() {
+        BinaryDataSet<TelemetryAVLRecord[]> dataset = DataSet.AVLData_nm3();
+
+        TelemetryAVLRecord[] telRecords = Fm4ex.parseAVL(dataset.getBuffer());
+
+        dataset.evaluate(telRecords);
+    }
+
 }

BIN
src/test/resources/Fm4exC8Ex_IMEI/test2.bin


BIN
src/test/resources/Fm4exC8Ex_IMEI/test3.bin


Vissa filer visades inte eftersom för många filer har ändrats