From e3942e20a3594f8c574afb79b0c1434b13f0368b Mon Sep 17 00:00:00 2001 From: xtophe Date: Sun, 29 Mar 2020 12:08:50 +0200 Subject: [PATCH 1/5] Add Amicalsat module and application (command line) --- AplicationAmicalsat/pom.xml | 112 ++ .../amicalsat/cli/AmicalsatCli.java | 82 ++ .../org/josast/amicalsat/A1FlagTypeFrame.java | 35 + .../org/josast/amicalsat/A1GyroTypeFrame.java | 31 + .../org/josast/amicalsat/A1MagTypeFrame.java | 30 + .../josast/amicalsat/A1PositionTypeFrame.java | 28 + .../org/josast/amicalsat/CuLogTypeFrame.java | 34 + .../org/josast/amicalsat/EmLogTypeFrame.java | 46 + .../org/josast/amicalsat/EmmnTypeFrame.java | 44 + .../org/josast/amicalsat/FlagsTypeFrame.java | 25 + .../main/java/org/josast/amicalsat/Frame.java | 18 + .../org/josast/amicalsat/FrameFactory.java | 155 +++ .../josast/amicalsat/FrameTlmAmicalsat.java | 1089 +++++++++++++++++ .../org/josast/amicalsat/M1TypeFrame.java | 41 + .../org/josast/amicalsat/U2MsTypeFrame.java | 36 + .../org/josast/amicalsat/U2RlTypeFrame.java | 40 + .../org/josast/amicalsat/V1MsTypeFrame.java | 36 + .../org/josast/amicalsat/V1RlTypeFrame.java | 45 + .../josast/amicalsat/FrameFactoryTest.java | 118 ++ .../src/test/resources/kissfiles/Frame_0.bin | Bin 0 -> 68 bytes .../src/test/resources/kissfiles/Frame_10.bin | Bin 0 -> 74 bytes .../src/test/resources/kissfiles/Frame_12.bin | Bin 0 -> 71 bytes .../src/test/resources/kissfiles/Frame_14.bin | Bin 0 -> 62 bytes .../src/test/resources/kissfiles/Frame_16.bin | Bin 0 -> 71 bytes .../src/test/resources/kissfiles/Frame_18.bin | Bin 0 -> 61 bytes .../src/test/resources/kissfiles/Frame_2.bin | Bin 0 -> 70 bytes .../src/test/resources/kissfiles/Frame_20.bin | Bin 0 -> 69 bytes .../src/test/resources/kissfiles/Frame_22.bin | Bin 0 -> 69 bytes .../src/test/resources/kissfiles/Frame_24.bin | Bin 0 -> 59 bytes .../src/test/resources/kissfiles/Frame_26.bin | Bin 0 -> 70 bytes .../src/test/resources/kissfiles/Frame_28.bin | Bin 0 -> 62 bytes .../src/test/resources/kissfiles/Frame_4.bin | Bin 0 -> 81 bytes .../src/test/resources/kissfiles/Frame_6.bin | Bin 0 -> 81 bytes .../src/test/resources/kissfiles/Frame_8.bin | Bin 0 -> 74 bytes .../ModuleSoundModem/KissException.java | 60 + .../org/josast/ModuleSoundModem/kiss.java | 65 + 36 files changed, 2170 insertions(+) create mode 100644 AplicationAmicalsat/pom.xml create mode 100644 AplicationAmicalsat/src/main/java/org/josast/application/amicalsat/cli/AmicalsatCli.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1FlagTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1GyroTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1MagTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1PositionTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/CuLogTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/EmLogTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/EmmnTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/FlagsTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/Frame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/FrameFactory.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/FrameTlmAmicalsat.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/M1TypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/U2MsTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/U2RlTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/V1MsTypeFrame.java create mode 100644 ModuleAmicalsat/src/main/java/org/josast/amicalsat/V1RlTypeFrame.java create mode 100644 ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_0.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_10.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_12.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_14.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_16.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_18.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_2.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_20.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_22.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_24.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_26.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_28.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_4.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_6.bin create mode 100644 ModuleAmicalsat/src/test/resources/kissfiles/Frame_8.bin create mode 100644 ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/KissException.java create mode 100644 ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/kiss.java diff --git a/AplicationAmicalsat/pom.xml b/AplicationAmicalsat/pom.xml new file mode 100644 index 0000000..9058b34 --- /dev/null +++ b/AplicationAmicalsat/pom.xml @@ -0,0 +1,112 @@ + + + 4.0.0 + + JOSAST-parent + org.josast + 0.0.2-SNAPSHOT + + + AplicationAmicalsat + 1.0-SNAPSHOT + + AplicationAmicalsat + + http://www.example.com + + + UTF-8 + 1.7 + 1.7 + ${env.JAVA_HOME} + 0.1.5 + + + + + + + + name.valery1707.kaitai + kaitai-maven-plugin + ${kaitai-maven-plugin-version} + + + + + + io.kaitai + kaitai-struct-runtime + 0.8 + + + org.influxdb + influxdb-java + 2.16 + + + org.josast + ModuleSoundModem + 0.0.2-SNAPSHOT + + + + org.josast + ModuleConfig + 0.2 + + + org.josast + ModuleAmicalsat + 1.0-SNAPSHOT + + + + junit + junit + 4.11 + test + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + + make-assembly + package + + single + + + + + + + + + org.josast.application.amicalsat.cli.AmicalsatCli + + + + + jar-with-dependencies + + + + + + + + + + + + + + diff --git a/AplicationAmicalsat/src/main/java/org/josast/application/amicalsat/cli/AmicalsatCli.java b/AplicationAmicalsat/src/main/java/org/josast/application/amicalsat/cli/AmicalsatCli.java new file mode 100644 index 0000000..ce64f95 --- /dev/null +++ b/AplicationAmicalsat/src/main/java/org/josast/application/amicalsat/cli/AmicalsatCli.java @@ -0,0 +1,82 @@ +package org.josast.application.amicalsat.cli; + +import org.josast.AX25.AX25Frame; +import org.josast.AX25.KissData; +import org.josast.AX25.KissFrame; +import org.josast.ModuleSoundModem.SoundModemClient; +import org.josast.ModuleSoundModem.SoundModemConfiguration; +import org.josast.amicalsat.Frame; +import org.josast.amicalsat.FrameFactory; +import org.josast.amicalsat.FrameTlmAmicalsat; +import org.josast.amicalsat.KissException; +import org.josast.amicalsat.kiss; + +import io.kaitai.struct.ByteBufferKaitaiStream; + +public class AmicalsatCli { + + private String version = "0.1"; + + byte[] cbuf = new byte[1000]; + + public String getVersion() { + return version; + } + + + public AmicalsatCli() { + // TODO Auto-generated constructor stub + } + + + public void execute() + { + FrameFactory ff = new FrameFactory(); + SoundModemConfiguration smconf = new SoundModemConfiguration("config"); + SoundModemClient sm = new SoundModemClient(smconf); + + + while (true) { + int nb = sm.receiveData(cbuf); + KissFrame kf = new KissFrame(); + KissData kissData = kf.extactMessage(cbuf, nb); + kiss k = new kiss(kissData.getData()); + System.out.println(kissData); + + FrameTlmAmicalsat cube=null; + try { + cube = new FrameTlmAmicalsat(new ByteBufferKaitaiStream(k.toRaw())); + } catch (KissException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.print( + "Source : " + cube.frameTlmEntrySat().ax25Header().srcCallsignRaw().srcCallsignRor().srcCallsign()); + System.out.print("destination : " + + cube.frameTlmEntrySat().ax25Header().destCallsignRaw().destCallsignRor().destCallsign()); + System.out.print("PID : " + cube.frameTlmEntrySat().payload().pid()); + System.out.println(" SSID : " + cube.frameTlmEntrySat().ax25Header().srcSsidRaw()); + String tlmArea = cube.frameTlmEntrySat().payload().tlmArea(); + String typeFrame = cube.frameTlmEntrySat().payload().tlmType(); + System.out.println(tlmArea +" "+ typeFrame); + Frame fm = ff.creerFrame(tlmArea, typeFrame); + fm.setUp(cube); + + System.out.println(fm.toString()); + + + } + + + } + + public static void main(String[] args) { + + AmicalsatCli cli = new AmicalsatCli(); + + System.out.println(cli.getVersion()); + cli.execute(); + + } + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1FlagTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1FlagTypeFrame.java new file mode 100644 index 0000000..7d66d74 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1FlagTypeFrame.java @@ -0,0 +1,35 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.A1FlagType; +import org.josast.amicalsat.FrameTlmAmicalsat.A1Type; + + + +// #A1;FLAGS;[mode];[flags];[faults] +public class A1FlagTypeFrame extends Frame { + + private String mode; + private String a1Flags; + private String faults; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + A1Type a1type = (A1Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + A1FlagType log = (A1FlagType) a1type.tlmSw(); + // System.out.println("Time Stamp : "log.); + + mode= log.mode(); + hash.put("Mode", mode); + a1Flags= log.a1Flags(); + hash.put("Flags", a1Flags); + faults= log.faults(); + hash.put("Faults", faults); + + + + } + + } + + + diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1GyroTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1GyroTypeFrame.java new file mode 100644 index 0000000..0999735 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1GyroTypeFrame.java @@ -0,0 +1,31 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.A1GyroType; +import org.josast.amicalsat.FrameTlmAmicalsat.A1Type; + +// #A1;GYRO;[Current timestamp];[GyroX];[GyroY];[GyroZ] +public class A1GyroTypeFrame extends Frame { + + private String timeStamps; + private String giroX; + private String giroZ; + private String giroY; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + A1Type a1type = (A1Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + A1GyroType log = (A1GyroType) a1type.tlmSw(); + timeStamps = log.timeStamps(); + hash.put("TimeStamp", timeStamps); + + giroX = log.giroX(); + hash.put("giroX", giroX); + giroY = log.giroY(); + hash.put("giroY", giroY); + giroZ = log.giroZ(); + hash.put("giroZ", giroZ); + + } + + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1MagTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1MagTypeFrame.java new file mode 100644 index 0000000..3734352 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1MagTypeFrame.java @@ -0,0 +1,30 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.A1MagType; +import org.josast.amicalsat.FrameTlmAmicalsat.A1Type; + +//#A1;MAG;[Current timestamp];[MagX];[MagY];[MagZ] +public class A1MagTypeFrame extends Frame { + + private String timeStamps; + private String magX; + private String magY; + private String magZ; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + A1Type a1type = (A1Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + A1MagType log = (A1MagType) a1type.tlmSw(); + + timeStamps = log.timeStamps(); + hash.put("TimeStamp", timeStamps); + magX=log.magX(); + magY=log.magY(); + magZ=log.magZ(); + hash.put("magX", magX); + hash.put("magY", magY); + hash.put("magZ", magZ); + + } + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1PositionTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1PositionTypeFrame.java new file mode 100644 index 0000000..704d505 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/A1PositionTypeFrame.java @@ -0,0 +1,28 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.A1PositionType; +import org.josast.amicalsat.FrameTlmAmicalsat.A1Type; + +//# #A1;POSITION;[Current timestamp];[Latitude];[Longitude] +public class A1PositionTypeFrame extends Frame { + + private String timeStamps; + private String latitude; + private String longitude; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + A1Type a1type = (A1Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + A1PositionType log = (A1PositionType) a1type.tlmSw(); + + timeStamps = log.timeStamps(); + hash.put("TimeStamp", timeStamps); + latitude = log.latitude(); + hash.put("latitude", latitude); + longitude = log.longitude(); + hash.put("longitude", longitude); + + } + + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/CuLogTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/CuLogTypeFrame.java new file mode 100644 index 0000000..36c07b2 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/CuLogTypeFrame.java @@ -0,0 +1,34 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.CuLogType; +import org.josast.amicalsat.FrameTlmAmicalsat.CuType; + +//#[CU_R/CU_L];LOG;[Timestamp];[CPU voltage];[CPU temperature];[flags ] +public class CuLogTypeFrame extends Frame { + + private String timeStamps; + private String cpuVoltage; + private String cpuTemperature; + private String cuFlags; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + + CuType cutype = (CuType) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + CuLogType log = (CuLogType) cutype.tlmsw(); + + timeStamps = cutype.timesTamps(); + hash.put("TimeStamp", timeStamps); + cpuVoltage = log.cpuVoltage(); + hash.put("cpuVoltage", cpuVoltage); + cpuTemperature = log.cpuTemperature(); + hash.put("cpuTemperature", cpuTemperature); + cuFlags = log.cuFlags(); + hash.put("cuFlags", cuFlags); + + + } + + + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/EmLogTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/EmLogTypeFrame.java new file mode 100644 index 0000000..d924829 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/EmLogTypeFrame.java @@ -0,0 +1,46 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.EmLogType; +import org.josast.amicalsat.FrameTlmAmicalsat.EmerType; + +// #EM;LOG;[Timestamp];[Boot number];[Input voltage];[Input current];[Input +// power];[Peak Power];[Solar panel voltage] +public class EmLogTypeFrame extends Frame { + + private String timeStamps; + private String bootNumber; + private String inputVoltage; + private String inputCurrent; + private String inputPower; + private String peakPower; + private String solarPanelVoltage; + + + @Override + public void setUp(FrameTlmAmicalsat cube) { + + EmerType emtype = (EmerType) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + EmLogType log = (EmLogType) emtype.tlmsw(); + + timeStamps = emtype.timeStamp(); + hash.put("TimeStamp", timeStamps); + + bootNumber = log.bootNumber(); + hash.put("bootNumber", bootNumber); + inputVoltage = log.inputVoltage(); + hash.put("inputVoltage", inputVoltage); + inputCurrent = log.inputCurrent(); + hash.put("inputCurrent", inputCurrent); + inputPower = log.inputPower(); + hash.put("inputPower", inputPower); + peakPower = log.peakPower(); + hash.put("peakPower", peakPower); + solarPanelVoltage = log.solarPanelVoltage(); + hash.put("solarPanelVoltage", solarPanelVoltage); + + + } + + + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/EmmnTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/EmmnTypeFrame.java new file mode 100644 index 0000000..703a988 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/EmmnTypeFrame.java @@ -0,0 +1,44 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.EmerType; +import org.josast.amicalsat.FrameTlmAmicalsat.EmmnType; + +//#[EM/ER];MN;[Timestamp];[V in];[V solar];[I in];[P in];[P peak];[T cpu];[V +// cpu] + +public class EmmnTypeFrame extends Frame { + + private String timeStamps; + private String vIn; + private String vSolar; + private String iIn; + private String pIn; + private String pPeak; + private String tCpu; + private String vCpu; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + EmerType emtype = (EmerType) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + EmmnType log = (EmmnType) emtype.tlmsw(); + + timeStamps = emtype.timeStamp(); + hash.put("TimeStamp", timeStamps); + vIn = log.vIn(); + hash.put("vIn", vIn); + vSolar = log.vSolar(); + hash.put("vSolar", vSolar); + iIn = log.iIn(); + hash.put("iIn", iIn); + pIn = log.pIn(); + hash.put("pIn", pIn); + pPeak = log.pPeak(); + hash.put("pPeak", pPeak); + tCpu = log.tCpu(); + hash.put("tCpu", tCpu); + vCpu = log.vCpu(); + hash.put("vCpu", vCpu); + + } + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/FlagsTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/FlagsTypeFrame.java new file mode 100644 index 0000000..9ea3a40 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/FlagsTypeFrame.java @@ -0,0 +1,25 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.FlagsType; +import org.josast.amicalsat.FrameTlmAmicalsat.M1Type; + +//#M1;FLAGS;[Timestamp];[Hex flags] +public class FlagsTypeFrame extends Frame { + + private String timeStamps; + private String hexFlags; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + M1Type m1type = (M1Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + FlagsType log = (FlagsType) m1type.tlmSw(); + + timeStamps = m1type.timeStamps(); + hash.put("TimeStamp", timeStamps); + hexFlags = log.hexFlags(); + hash.put("hexFlags", hexFlags); + } + + + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/Frame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/Frame.java new file mode 100644 index 0000000..dc011e1 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/Frame.java @@ -0,0 +1,18 @@ +package org.josast.amicalsat; + +import java.util.Hashtable; + +public abstract class Frame { + + protected Hashtable hash = new Hashtable(); + + public abstract void setUp(FrameTlmAmicalsat data); + @Override + + + public String toString() { + return hash.toString(); + + } + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/FrameFactory.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/FrameFactory.java new file mode 100644 index 0000000..4227d61 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/FrameFactory.java @@ -0,0 +1,155 @@ +package org.josast.amicalsat; + + + +public class FrameFactory { + + + public Frame creerFrame(String tlmArea, String typeFrame) { + + Frame frame=null; + + if (tlmArea.compareTo("M1") == 0) { + + if (typeFrame.compareTo("LOG") == 0) { + + + + frame = new M1TypeFrame(); + + } + + + + if (typeFrame.compareTo("FLAGS") == 0) { + + frame = new FlagsTypeFrame(); + + } + } + + if (tlmArea.compareTo("A1") == 0) { + + + + if (typeFrame.compareTo("FLAGS") == 0) { + frame = new A1FlagTypeFrame(); + } + + if (typeFrame.compareTo("MAG") == 0) { + frame = new A1MagTypeFrame(); + + } + + if (typeFrame.compareTo("GYRO") == 0) { + + frame = new A1GyroTypeFrame(); + + + + } + //# #A1;POSITION;[Current timestamp];[Latitude];[Longitude] + if (typeFrame.compareTo("POSITION") == 0) { + + frame = new A1PositionTypeFrame(); + } + } + if (tlmArea.compareTo("EM") == 0) { + + + if (typeFrame.compareTo("MN") == 0) { + frame = new EmmnTypeFrame(); + + + } + + if (typeFrame.compareTo("LOG") == 0) { + frame = new EmLogTypeFrame(); + + + + } + + } + + if (tlmArea.compareTo("CU_R") == 0) { + + + if (typeFrame.compareTo("LOG") == 0) { + frame = new CuLogTypeFrame(); + + + + } + } + + if (tlmArea.compareTo("CU_L") == 0) { + + if (typeFrame.compareTo("LOG") == 0) { + + frame = new CuLogTypeFrame(); + + } + } + + if (tlmArea.compareTo("V1") == 0) { + + //#[V1/U2];MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset ] + + if (typeFrame.compareTo("MS") == 0) { + + frame = new V1MsTypeFrame(); + + } + + if (typeFrame.compareTo("RL") == 0) { + frame = new V1RlTypeFrame(); + + + } + } + + + if (tlmArea.compareTo("U2") == 0) { + + //#[V1/U2];MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset ] + if (typeFrame.compareTo("MS") == 0) { + frame = new U2MsTypeFrame(); + + + + } + //#[U2];RL;[Timestamp],[CPU voltage];[Battery voltage];[CPU temperature];[Amplifier temperature];[Flags] + if (typeFrame.compareTo("RL") == 0) { + + frame = new U2RlTypeFrame(); + + + } + + } + + if (tlmArea.compareTo("ER") == 0) { + + //#[V1/U2];MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset ] + if (typeFrame.compareTo("LOG") == 0) { + frame = new EmLogTypeFrame(); + + + + } + if (typeFrame.compareTo("MN") == 0) { + + + frame = new EmmnTypeFrame(); + } + } + + return frame; + } + + + + + } + diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/FrameTlmAmicalsat.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/FrameTlmAmicalsat.java new file mode 100644 index 0000000..ec6a7d8 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/FrameTlmAmicalsat.java @@ -0,0 +1,1089 @@ +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +package org.josast.amicalsat; + +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStruct; +import io.kaitai.struct.KaitaiStream; +import java.io.IOException; +import java.nio.charset.Charset; + +public class FrameTlmAmicalsat extends KaitaiStruct { + public static FrameTlmAmicalsat fromFile(String fileName) throws IOException { + return new FrameTlmAmicalsat(new ByteBufferKaitaiStream(fileName)); + } + + public FrameTlmAmicalsat(KaitaiStream _io) { + this(_io, null, null); + } + + public FrameTlmAmicalsat(KaitaiStream _io, KaitaiStruct _parent) { + this(_io, _parent, null); + } + + public FrameTlmAmicalsat(KaitaiStream _io, KaitaiStruct _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root == null ? this : _root; + _read(); + } + private void _read() { + this.frameTlmEntrySat = new Ax25Frame(this._io, this, _root); + } + public static class EmmnType extends KaitaiStruct { + public static EmmnType fromFile(String fileName) throws IOException { + return new EmmnType(new ByteBufferKaitaiStream(fileName)); + } + + public EmmnType(KaitaiStream _io) { + this(_io, null, null); + } + + public EmmnType(KaitaiStream _io, FrameTlmAmicalsat.EmerType _parent) { + this(_io, _parent, null); + } + + public EmmnType(KaitaiStream _io, FrameTlmAmicalsat.EmerType _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.vIn = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.vSolar = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.iIn = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.pIn = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.pPeak = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.tCpu = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.vCpu = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String vIn; + private String vSolar; + private String iIn; + private String pIn; + private String pPeak; + private String tCpu; + private String vCpu; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.EmerType _parent; + public String vIn() { return vIn; } + public String vSolar() { return vSolar; } + public String iIn() { return iIn; } + public String pIn() { return pIn; } + public String pPeak() { return pPeak; } + public String tCpu() { return tCpu; } + public String vCpu() { return vCpu; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.EmerType _parent() { return _parent; } + } + public static class Ax25Frame extends KaitaiStruct { + public static Ax25Frame fromFile(String fileName) throws IOException { + return new Ax25Frame(new ByteBufferKaitaiStream(fileName)); + } + + public Ax25Frame(KaitaiStream _io) { + this(_io, null, null); + } + + public Ax25Frame(KaitaiStream _io, FrameTlmAmicalsat _parent) { + this(_io, _parent, null); + } + + public Ax25Frame(KaitaiStream _io, FrameTlmAmicalsat _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.ax25Header = new Ax25Header(this._io, this, _root); + this.payload = new IFrame(this._io, this, _root); + } + private Ax25Header ax25Header; + private IFrame payload; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat _parent; + public Ax25Header ax25Header() { return ax25Header; } + public IFrame payload() { return payload; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat _parent() { return _parent; } + } + public static class DestCallsign extends KaitaiStruct { + public static DestCallsign fromFile(String fileName) throws IOException { + return new DestCallsign(new ByteBufferKaitaiStream(fileName)); + } + + public DestCallsign(KaitaiStream _io) { + this(_io, null, null); + } + + public DestCallsign(KaitaiStream _io, FrameTlmAmicalsat.DestCallsignRaw _parent) { + this(_io, _parent, null); + } + + public DestCallsign(KaitaiStream _io, FrameTlmAmicalsat.DestCallsignRaw _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.destCallsign = new String(this._io.readBytes(6), Charset.forName("ASCII")); + } + private String destCallsign; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.DestCallsignRaw _parent; + public String destCallsign() { return destCallsign; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.DestCallsignRaw _parent() { return _parent; } + } + public static class Ax25Header extends KaitaiStruct { + public static Ax25Header fromFile(String fileName) throws IOException { + return new Ax25Header(new ByteBufferKaitaiStream(fileName)); + } + + public Ax25Header(KaitaiStream _io) { + this(_io, null, null); + } + + public Ax25Header(KaitaiStream _io, FrameTlmAmicalsat.Ax25Frame _parent) { + this(_io, _parent, null); + } + + public Ax25Header(KaitaiStream _io, FrameTlmAmicalsat.Ax25Frame _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.destCallsignRaw = new DestCallsignRaw(this._io, this, _root); + this.destSsidRaw = this._io.readU1(); + this.srcCallsignRaw = new SrcCallsignRaw(this._io, this, _root); + this.srcSsidRaw = this._io.readU1(); + this.ctl = this._io.readU1(); + } + private Integer srcSsid; + public Integer srcSsid() { + if (this.srcSsid != null) + return this.srcSsid; + int _tmp = (int) (((srcSsidRaw() & 15) >> 1)); + this.srcSsid = _tmp; + return this.srcSsid; + } + private Integer destSsid; + public Integer destSsid() { + if (this.destSsid != null) + return this.destSsid; + int _tmp = (int) (((destSsidRaw() & 15) >> 1)); + this.destSsid = _tmp; + return this.destSsid; + } + private DestCallsignRaw destCallsignRaw; + private int destSsidRaw; + private SrcCallsignRaw srcCallsignRaw; + private int srcSsidRaw; + private int ctl; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.Ax25Frame _parent; + public DestCallsignRaw destCallsignRaw() { return destCallsignRaw; } + public int destSsidRaw() { return destSsidRaw; } + public SrcCallsignRaw srcCallsignRaw() { return srcCallsignRaw; } + public int srcSsidRaw() { return srcSsidRaw; } + public int ctl() { return ctl; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.Ax25Frame _parent() { return _parent; } + } + public static class A1PositionType extends KaitaiStruct { + public static A1PositionType fromFile(String fileName) throws IOException { + return new A1PositionType(new ByteBufferKaitaiStream(fileName)); + } + + public A1PositionType(KaitaiStream _io) { + this(_io, null, null); + } + + public A1PositionType(KaitaiStream _io, FrameTlmAmicalsat.A1Type _parent) { + this(_io, _parent, null); + } + + public A1PositionType(KaitaiStream _io, FrameTlmAmicalsat.A1Type _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timeStamps = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.latitude = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.longitude = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String timeStamps; + private String latitude; + private String longitude; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.A1Type _parent; + public String timeStamps() { return timeStamps; } + public String latitude() { return latitude; } + public String longitude() { return longitude; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.A1Type _parent() { return _parent; } + } + public static class M1Type extends KaitaiStruct { + public static M1Type fromFile(String fileName) throws IOException { + return new M1Type(new ByteBufferKaitaiStream(fileName)); + } + + public M1Type(KaitaiStream _io) { + this(_io, null, null); + } + + public M1Type(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent) { + this(_io, _parent, null); + } + + public M1Type(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timeStamps = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + switch (_parent().tlmType()) { + case "LOG": { + this.tlmSw = new LogType(this._io, this, _root); + break; + } + case "FLAGS": { + this.tlmSw = new FlagsType(this._io, this, _root); + break; + } + } + this.ax25Info = this._io.readBytesFull(); + } + private String timeStamps; + private KaitaiStruct tlmSw; + private byte[] ax25Info; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.IFrame _parent; + public String timeStamps() { return timeStamps; } + public KaitaiStruct tlmSw() { return tlmSw; } + public byte[] ax25Info() { return ax25Info; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.IFrame _parent() { return _parent; } + } + public static class EmLogType extends KaitaiStruct { + public static EmLogType fromFile(String fileName) throws IOException { + return new EmLogType(new ByteBufferKaitaiStream(fileName)); + } + + public EmLogType(KaitaiStream _io) { + this(_io, null, null); + } + + public EmLogType(KaitaiStream _io, FrameTlmAmicalsat.EmerType _parent) { + this(_io, _parent, null); + } + + public EmLogType(KaitaiStream _io, FrameTlmAmicalsat.EmerType _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.bootNumber = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.inputVoltage = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.inputCurrent = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.inputPower = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.peakPower = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.solarPanelVoltage = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String bootNumber; + private String inputVoltage; + private String inputCurrent; + private String inputPower; + private String peakPower; + private String solarPanelVoltage; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.EmerType _parent; + public String bootNumber() { return bootNumber; } + public String inputVoltage() { return inputVoltage; } + public String inputCurrent() { return inputCurrent; } + public String inputPower() { return inputPower; } + public String peakPower() { return peakPower; } + public String solarPanelVoltage() { return solarPanelVoltage; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.EmerType _parent() { return _parent; } + } + public static class A1FlagType extends KaitaiStruct { + public static A1FlagType fromFile(String fileName) throws IOException { + return new A1FlagType(new ByteBufferKaitaiStream(fileName)); + } + + public A1FlagType(KaitaiStream _io) { + this(_io, null, null); + } + + public A1FlagType(KaitaiStream _io, FrameTlmAmicalsat.A1Type _parent) { + this(_io, _parent, null); + } + + public A1FlagType(KaitaiStream _io, FrameTlmAmicalsat.A1Type _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.mode = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.a1Flags = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.faults = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String mode; + private String a1Flags; + private String faults; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.A1Type _parent; + public String mode() { return mode; } + public String a1Flags() { return a1Flags; } + public String faults() { return faults; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.A1Type _parent() { return _parent; } + } + public static class SrcCallsignRaw extends KaitaiStruct { + public static SrcCallsignRaw fromFile(String fileName) throws IOException { + return new SrcCallsignRaw(new ByteBufferKaitaiStream(fileName)); + } + + public SrcCallsignRaw(KaitaiStream _io) { + this(_io, null, null); + } + + public SrcCallsignRaw(KaitaiStream _io, FrameTlmAmicalsat.Ax25Header _parent) { + this(_io, _parent, null); + } + + public SrcCallsignRaw(KaitaiStream _io, FrameTlmAmicalsat.Ax25Header _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this._raw__raw_srcCallsignRor = this._io.readBytes(6); + this._raw_srcCallsignRor = KaitaiStream.processRotateLeft(this._raw__raw_srcCallsignRor, 8 - (1), 1); + KaitaiStream _io__raw_srcCallsignRor = new ByteBufferKaitaiStream(_raw_srcCallsignRor); + this.srcCallsignRor = new SrcCallsign(_io__raw_srcCallsignRor, this, _root); + } + private SrcCallsign srcCallsignRor; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.Ax25Header _parent; + private byte[] _raw__raw_srcCallsignRor; + private byte[] _raw_srcCallsignRor; + public SrcCallsign srcCallsignRor() { return srcCallsignRor; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.Ax25Header _parent() { return _parent; } + public byte[] _raw__raw_srcCallsignRor() { return _raw__raw_srcCallsignRor; } + public byte[] _raw_srcCallsignRor() { return _raw_srcCallsignRor; } + } + public static class FlagsType extends KaitaiStruct { + public static FlagsType fromFile(String fileName) throws IOException { + return new FlagsType(new ByteBufferKaitaiStream(fileName)); + } + + public FlagsType(KaitaiStream _io) { + this(_io, null, null); + } + + public FlagsType(KaitaiStream _io, FrameTlmAmicalsat.M1Type _parent) { + this(_io, _parent, null); + } + + public FlagsType(KaitaiStream _io, FrameTlmAmicalsat.M1Type _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.hexFlags = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + } + private String hexFlags; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.M1Type _parent; + public String hexFlags() { return hexFlags; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.M1Type _parent() { return _parent; } + } + public static class IFrame extends KaitaiStruct { + public static IFrame fromFile(String fileName) throws IOException { + return new IFrame(new ByteBufferKaitaiStream(fileName)); + } + + public IFrame(KaitaiStream _io) { + this(_io, null, null); + } + + public IFrame(KaitaiStream _io, FrameTlmAmicalsat.Ax25Frame _parent) { + this(_io, _parent, null); + } + + public IFrame(KaitaiStream _io, FrameTlmAmicalsat.Ax25Frame _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.pid = this._io.readU1(); + this.field = new String(this._io.readBytesTerm(61, false, true, true), Charset.forName("ASCII")); + this.tlmArea = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.tlmType = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + switch (tlmArea()) { + case "EM": { + this.tlmAreaSwitch = new EmerType(this._io, this, _root); + break; + } + case "M1": { + this.tlmAreaSwitch = new M1Type(this._io, this, _root); + break; + } + case "V1": { + this.tlmAreaSwitch = new V1Type(this._io, this, _root); + break; + } + case "U2": { + this.tlmAreaSwitch = new U2Type(this._io, this, _root); + break; + } + case "A1": { + this.tlmAreaSwitch = new A1Type(this._io, this, _root); + break; + } + case "CU_L": { + this.tlmAreaSwitch = new CuType(this._io, this, _root); + break; + } + case "CU_R": { + this.tlmAreaSwitch = new CuType(this._io, this, _root); + break; + } + case "ER": { + this.tlmAreaSwitch = new EmerType(this._io, this, _root); + break; + } + } + } + private int pid; + private String field; + private String tlmArea; + private String tlmType; + private KaitaiStruct tlmAreaSwitch; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.Ax25Frame _parent; + public int pid() { return pid; } + public String field() { return field; } + public String tlmArea() { return tlmArea; } + public String tlmType() { return tlmType; } + public KaitaiStruct tlmAreaSwitch() { return tlmAreaSwitch; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.Ax25Frame _parent() { return _parent; } + } + public static class U2RlType extends KaitaiStruct { + public static U2RlType fromFile(String fileName) throws IOException { + return new U2RlType(new ByteBufferKaitaiStream(fileName)); + } + + public U2RlType(KaitaiStream _io) { + this(_io, null, null); + } + + public U2RlType(KaitaiStream _io, FrameTlmAmicalsat.U2Type _parent) { + this(_io, _parent, null); + } + + public U2RlType(KaitaiStream _io, FrameTlmAmicalsat.U2Type _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timeStamp = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.cpuVoltage = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.batteryVoltage = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.cpuTemperature = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.amplifierTemperature = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.flags = this._io.readU1(); + } + private String timeStamp; + private String cpuVoltage; + private String batteryVoltage; + private String cpuTemperature; + private String amplifierTemperature; + private int flags; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.U2Type _parent; + public String timeStamp() { return timeStamp; } + public String cpuVoltage() { return cpuVoltage; } + public String batteryVoltage() { return batteryVoltage; } + public String cpuTemperature() { return cpuTemperature; } + public String amplifierTemperature() { return amplifierTemperature; } + public int flags() { return flags; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.U2Type _parent() { return _parent; } + } + public static class CuLogType extends KaitaiStruct { + public static CuLogType fromFile(String fileName) throws IOException { + return new CuLogType(new ByteBufferKaitaiStream(fileName)); + } + + public CuLogType(KaitaiStream _io) { + this(_io, null, null); + } + + public CuLogType(KaitaiStream _io, FrameTlmAmicalsat.CuType _parent) { + this(_io, _parent, null); + } + + public CuLogType(KaitaiStream _io, FrameTlmAmicalsat.CuType _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.cpuVoltage = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.cpuTemperature = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.cuFlags = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String cpuVoltage; + private String cpuTemperature; + private String cuFlags; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.CuType _parent; + public String cpuVoltage() { return cpuVoltage; } + public String cpuTemperature() { return cpuTemperature; } + public String cuFlags() { return cuFlags; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.CuType _parent() { return _parent; } + } + public static class V1RlType extends KaitaiStruct { + public static V1RlType fromFile(String fileName) throws IOException { + return new V1RlType(new ByteBufferKaitaiStream(fileName)); + } + + public V1RlType(KaitaiStream _io) { + this(_io, null, null); + } + + public V1RlType(KaitaiStream _io, FrameTlmAmicalsat.V1Type _parent) { + this(_io, _parent, null); + } + + public V1RlType(KaitaiStream _io, FrameTlmAmicalsat.V1Type _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timeStamp = new String(this._io.readBytesTerm(44, false, true, true), Charset.forName("ASCII")); + this.cpuVoltage = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.batteryVoltage = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.cpuTemperature = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.amplifierTemperature = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.flags = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String timeStamp; + private String cpuVoltage; + private String batteryVoltage; + private String cpuTemperature; + private String amplifierTemperature; + private String flags; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.V1Type _parent; + public String timeStamp() { return timeStamp; } + public String cpuVoltage() { return cpuVoltage; } + public String batteryVoltage() { return batteryVoltage; } + public String cpuTemperature() { return cpuTemperature; } + public String amplifierTemperature() { return amplifierTemperature; } + public String flags() { return flags; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.V1Type _parent() { return _parent; } + } + public static class OnyxType extends KaitaiStruct { + public static OnyxType fromFile(String fileName) throws IOException { + return new OnyxType(new ByteBufferKaitaiStream(fileName)); + } + + public OnyxType(KaitaiStream _io) { + this(_io, null, null); + } + + public OnyxType(KaitaiStream _io, FrameTlmAmicalsat.CuType _parent) { + this(_io, _parent, null); + } + + public OnyxType(KaitaiStream _io, FrameTlmAmicalsat.CuType _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timeStamp = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.returnValue = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String timeStamp; + private String returnValue; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.CuType _parent; + public String timeStamp() { return timeStamp; } + public String returnValue() { return returnValue; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.CuType _parent() { return _parent; } + } + public static class EmerType extends KaitaiStruct { + public static EmerType fromFile(String fileName) throws IOException { + return new EmerType(new ByteBufferKaitaiStream(fileName)); + } + + public EmerType(KaitaiStream _io) { + this(_io, null, null); + } + + public EmerType(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent) { + this(_io, _parent, null); + } + + public EmerType(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timeStamp = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + switch (_parent().tlmType()) { + case "LOG": { + this.tlmsw = new EmLogType(this._io, this, _root); + break; + } + case "MN": { + this.tlmsw = new EmmnType(this._io, this, _root); + break; + } + } + } + private String timeStamp; + private KaitaiStruct tlmsw; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.IFrame _parent; + public String timeStamp() { return timeStamp; } + public KaitaiStruct tlmsw() { return tlmsw; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.IFrame _parent() { return _parent; } + } + public static class CuType extends KaitaiStruct { + public static CuType fromFile(String fileName) throws IOException { + return new CuType(new ByteBufferKaitaiStream(fileName)); + } + + public CuType(KaitaiStream _io) { + this(_io, null, null); + } + + public CuType(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent) { + this(_io, _parent, null); + } + + public CuType(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timesTamps = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + switch (_parent().tlmType()) { + case "ONYX SENSOR T": { + this.tlmsw = new OnyxType(this._io, this, _root); + break; + } + case "LOG": { + this.tlmsw = new CuLogType(this._io, this, _root); + break; + } + } + } + private String timesTamps; + private KaitaiStruct tlmsw; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.IFrame _parent; + public String timesTamps() { return timesTamps; } + public KaitaiStruct tlmsw() { return tlmsw; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.IFrame _parent() { return _parent; } + } + public static class A1GyroType extends KaitaiStruct { + public static A1GyroType fromFile(String fileName) throws IOException { + return new A1GyroType(new ByteBufferKaitaiStream(fileName)); + } + + public A1GyroType(KaitaiStream _io) { + this(_io, null, null); + } + + public A1GyroType(KaitaiStream _io, FrameTlmAmicalsat.A1Type _parent) { + this(_io, _parent, null); + } + + public A1GyroType(KaitaiStream _io, FrameTlmAmicalsat.A1Type _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timeStamps = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.giroX = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.giroY = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.giroZ = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String timeStamps; + private String giroX; + private String giroY; + private String giroZ; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.A1Type _parent; + public String timeStamps() { return timeStamps; } + public String giroX() { return giroX; } + public String giroY() { return giroY; } + public String giroZ() { return giroZ; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.A1Type _parent() { return _parent; } + } + public static class A1MagType extends KaitaiStruct { + public static A1MagType fromFile(String fileName) throws IOException { + return new A1MagType(new ByteBufferKaitaiStream(fileName)); + } + + public A1MagType(KaitaiStream _io) { + this(_io, null, null); + } + + public A1MagType(KaitaiStream _io, FrameTlmAmicalsat.A1Type _parent) { + this(_io, _parent, null); + } + + public A1MagType(KaitaiStream _io, FrameTlmAmicalsat.A1Type _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timeStamps = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.magX = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.magY = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.magZ = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String timeStamps; + private String magX; + private String magY; + private String magZ; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.A1Type _parent; + public String timeStamps() { return timeStamps; } + public String magX() { return magX; } + public String magY() { return magY; } + public String magZ() { return magZ; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.A1Type _parent() { return _parent; } + } + public static class A1Type extends KaitaiStruct { + public static A1Type fromFile(String fileName) throws IOException { + return new A1Type(new ByteBufferKaitaiStream(fileName)); + } + + public A1Type(KaitaiStream _io) { + this(_io, null, null); + } + + public A1Type(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent) { + this(_io, _parent, null); + } + + public A1Type(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + switch (_parent().tlmType()) { + case "FLAGS": { + this.tlmSw = new A1FlagType(this._io, this, _root); + break; + } + case "MAG": { + this.tlmSw = new A1MagType(this._io, this, _root); + break; + } + case "GYRO": { + this.tlmSw = new A1GyroType(this._io, this, _root); + break; + } + case "POSITION": { + this.tlmSw = new A1PositionType(this._io, this, _root); + break; + } + } + } + private KaitaiStruct tlmSw; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.IFrame _parent; + public KaitaiStruct tlmSw() { return tlmSw; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.IFrame _parent() { return _parent; } + } + public static class MsType extends KaitaiStruct { + public static MsType fromFile(String fileName) throws IOException { + return new MsType(new ByteBufferKaitaiStream(fileName)); + } + + public MsType(KaitaiStream _io) { + this(_io, null, null); + } + + public MsType(KaitaiStream _io, KaitaiStruct _parent) { + this(_io, _parent, null); + } + + public MsType(KaitaiStream _io, KaitaiStruct _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.timeStamps = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.currentRssi = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.latchRssi = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.aFCOffset = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private String timeStamps; + private String currentRssi; + private String latchRssi; + private String aFCOffset; + private FrameTlmAmicalsat _root; + private KaitaiStruct _parent; + public String timeStamps() { return timeStamps; } + public String currentRssi() { return currentRssi; } + public String latchRssi() { return latchRssi; } + public String aFCOffset() { return aFCOffset; } + public FrameTlmAmicalsat _root() { return _root; } + public KaitaiStruct _parent() { return _parent; } + } + public static class LogType extends KaitaiStruct { + public static LogType fromFile(String fileName) throws IOException { + return new LogType(new ByteBufferKaitaiStream(fileName)); + } + + public LogType(KaitaiStream _io) { + this(_io, null, null); + } + + public LogType(KaitaiStream _io, FrameTlmAmicalsat.M1Type _parent) { + this(_io, _parent, null); + } + + public LogType(KaitaiStream _io, FrameTlmAmicalsat.M1Type _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.bootNumber = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.upTime = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.cpuVoltage = new String(this._io.readBytesTerm(59, false, true, true), Charset.forName("ASCII")); + this.cpuTemperature = new String(this._io.readBytesFull(), Charset.forName("ASCII")); + } + private Double cpuVoltageVolt; + public Double cpuVoltageVolt() { + if (this.cpuVoltageVolt != null) + return this.cpuVoltageVolt; + double _tmp = (double) ((Long.parseLong(cpuVoltage(), 10) / 1000.0)); + this.cpuVoltageVolt = _tmp; + return this.cpuVoltageVolt; + } + private String bootNumber; + private String upTime; + private String cpuVoltage; + private String cpuTemperature; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.M1Type _parent; + public String bootNumber() { return bootNumber; } + public String upTime() { return upTime; } + public String cpuVoltage() { return cpuVoltage; } + public String cpuTemperature() { return cpuTemperature; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.M1Type _parent() { return _parent; } + } + public static class DestCallsignRaw extends KaitaiStruct { + public static DestCallsignRaw fromFile(String fileName) throws IOException { + return new DestCallsignRaw(new ByteBufferKaitaiStream(fileName)); + } + + public DestCallsignRaw(KaitaiStream _io) { + this(_io, null, null); + } + + public DestCallsignRaw(KaitaiStream _io, FrameTlmAmicalsat.Ax25Header _parent) { + this(_io, _parent, null); + } + + public DestCallsignRaw(KaitaiStream _io, FrameTlmAmicalsat.Ax25Header _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this._raw__raw_destCallsignRor = this._io.readBytes(6); + this._raw_destCallsignRor = KaitaiStream.processRotateLeft(this._raw__raw_destCallsignRor, 8 - (1), 1); + KaitaiStream _io__raw_destCallsignRor = new ByteBufferKaitaiStream(_raw_destCallsignRor); + this.destCallsignRor = new DestCallsign(_io__raw_destCallsignRor, this, _root); + } + private DestCallsign destCallsignRor; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.Ax25Header _parent; + private byte[] _raw__raw_destCallsignRor; + private byte[] _raw_destCallsignRor; + public DestCallsign destCallsignRor() { return destCallsignRor; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.Ax25Header _parent() { return _parent; } + public byte[] _raw__raw_destCallsignRor() { return _raw__raw_destCallsignRor; } + public byte[] _raw_destCallsignRor() { return _raw_destCallsignRor; } + } + public static class V1Type extends KaitaiStruct { + public static V1Type fromFile(String fileName) throws IOException { + return new V1Type(new ByteBufferKaitaiStream(fileName)); + } + + public V1Type(KaitaiStream _io) { + this(_io, null, null); + } + + public V1Type(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent) { + this(_io, _parent, null); + } + + public V1Type(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + switch (_parent().tlmType()) { + case "RL": { + this.tlmsw = new V1RlType(this._io, this, _root); + break; + } + case "MS": { + this.tlmsw = new MsType(this._io, this, _root); + break; + } + } + } + private KaitaiStruct tlmsw; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.IFrame _parent; + public KaitaiStruct tlmsw() { return tlmsw; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.IFrame _parent() { return _parent; } + } + public static class SrcCallsign extends KaitaiStruct { + public static SrcCallsign fromFile(String fileName) throws IOException { + return new SrcCallsign(new ByteBufferKaitaiStream(fileName)); + } + + public SrcCallsign(KaitaiStream _io) { + this(_io, null, null); + } + + public SrcCallsign(KaitaiStream _io, FrameTlmAmicalsat.SrcCallsignRaw _parent) { + this(_io, _parent, null); + } + + public SrcCallsign(KaitaiStream _io, FrameTlmAmicalsat.SrcCallsignRaw _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + this.srcCallsign = new String(this._io.readBytes(6), Charset.forName("ASCII")); + } + private String srcCallsign; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.SrcCallsignRaw _parent; + public String srcCallsign() { return srcCallsign; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.SrcCallsignRaw _parent() { return _parent; } + } + public static class U2Type extends KaitaiStruct { + public static U2Type fromFile(String fileName) throws IOException { + return new U2Type(new ByteBufferKaitaiStream(fileName)); + } + + public U2Type(KaitaiStream _io) { + this(_io, null, null); + } + + public U2Type(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent) { + this(_io, _parent, null); + } + + public U2Type(KaitaiStream _io, FrameTlmAmicalsat.IFrame _parent, FrameTlmAmicalsat _root) { + super(_io); + this._parent = _parent; + this._root = _root; + _read(); + } + private void _read() { + switch (_parent().tlmType()) { + case "RL": { + this.tlmsw = new U2RlType(this._io, this, _root); + break; + } + case "MS": { + this.tlmsw = new MsType(this._io, this, _root); + break; + } + } + } + private KaitaiStruct tlmsw; + private FrameTlmAmicalsat _root; + private FrameTlmAmicalsat.IFrame _parent; + public KaitaiStruct tlmsw() { return tlmsw; } + public FrameTlmAmicalsat _root() { return _root; } + public FrameTlmAmicalsat.IFrame _parent() { return _parent; } + } + private Ax25Frame frameTlmEntrySat; + private FrameTlmAmicalsat _root; + private KaitaiStruct _parent; + + /** + * @see Source + */ + public Ax25Frame frameTlmEntrySat() { return frameTlmEntrySat; } + public FrameTlmAmicalsat _root() { return _root; } + public KaitaiStruct _parent() { return _parent; } +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/M1TypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/M1TypeFrame.java new file mode 100644 index 0000000..dc081b1 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/M1TypeFrame.java @@ -0,0 +1,41 @@ +package org.josast.amicalsat; + +import java.util.Hashtable; + +import org.josast.amicalsat.FrameTlmAmicalsat.LogType; +import org.josast.amicalsat.FrameTlmAmicalsat.M1Type; + +//#M1;LOG;[Timestamp];[Boot number];[Up time];[CPU voltage];[CPU temperature] + + +public class M1TypeFrame extends Frame { + + + private String timeStamps; + private String bootNumber; + private String upTime; + private String cpuVoltage; + private Double cpuVoltageVolt; + private String cpuTemperature; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + M1Type m1type = (M1Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + LogType log = (LogType) m1type.tlmSw(); + timeStamps= m1type.timeStamps(); + hash.put("TimeStamp", timeStamps); + bootNumber= log.bootNumber(); + hash.put("BootNumber", bootNumber); + upTime=log.upTime(); + hash.put("UpTime", upTime); + cpuVoltage=log.cpuVoltage(); + hash.put("CpuVoltage", cpuVoltage); + cpuTemperature = log.cpuTemperature(); + hash.put("CpuTemperature", cpuTemperature); + cpuVoltageVolt=log.cpuVoltageVolt(); + + } + + + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/U2MsTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/U2MsTypeFrame.java new file mode 100644 index 0000000..d146193 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/U2MsTypeFrame.java @@ -0,0 +1,36 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.MsType; +import org.josast.amicalsat.FrameTlmAmicalsat.U2Type; + + +//#[V1/U2];MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset ] +public class U2MsTypeFrame extends Frame { + + private String timeStamps; + private String currentRssi; + private String latchRssi; + private String aFCOffset; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + U2Type u2type = (U2Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + MsType mstype = (MsType) u2type.tlmsw(); + + timeStamps = mstype.timeStamps(); + hash.put("timeStamps", timeStamps); + currentRssi = mstype.currentRssi(); + hash.put("currentRssi", currentRssi); + latchRssi = mstype.latchRssi(); + hash.put("latchRssi", latchRssi); + aFCOffset = mstype.aFCOffset(); + hash.put("aFCOffset", aFCOffset); + + + + + } + + + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/U2RlTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/U2RlTypeFrame.java new file mode 100644 index 0000000..6997a8f --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/U2RlTypeFrame.java @@ -0,0 +1,40 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.U2RlType; +import org.josast.amicalsat.FrameTlmAmicalsat.U2Type; + +//#[U2];RL;[Timestamp],[CPU voltage];[Battery voltage];[CPU temperature];[Amplifier temperature];[Flags] + +public class U2RlTypeFrame extends Frame { + + private String timeStamps; + private String batteryVoltage; + private String amplifierTemperature; + private int flags; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + + U2Type u2type = (U2Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + U2RlType mstype = (U2RlType) u2type.tlmsw(); + + timeStamps = mstype.timeStamp(); + hash.put("timeStamps", timeStamps); + + String cpuVoltage = mstype.cpuVoltage(); + hash.put("cpuVoltage", cpuVoltage); + batteryVoltage = mstype.batteryVoltage(); + hash.put("batteryVoltage", batteryVoltage); + amplifierTemperature = mstype.amplifierTemperature(); + hash.put("amplifierTemperature", amplifierTemperature); + + flags = mstype.flags(); + hash.put("flags", ""+flags ); + + + + + } + + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/V1MsTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/V1MsTypeFrame.java new file mode 100644 index 0000000..1d36107 --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/V1MsTypeFrame.java @@ -0,0 +1,36 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.MsType; +import org.josast.amicalsat.FrameTlmAmicalsat.V1Type; + + +//#[V1/U2];MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset ] +public class V1MsTypeFrame extends Frame { + + private String timeStamps; + private String currentRssi; + private String latchRssi; + private String aFCOffset; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + V1Type u2type = (V1Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + MsType mstype = (MsType) u2type.tlmsw(); + + timeStamps = mstype.timeStamps(); + hash.put("timeStamps", timeStamps); + currentRssi = mstype.currentRssi(); + hash.put("currentRssi", currentRssi); + latchRssi = mstype.latchRssi(); + hash.put("latchRssi", latchRssi); + aFCOffset = mstype.aFCOffset(); + hash.put("aFCOffset", aFCOffset); + + + + + } + + + +} diff --git a/ModuleAmicalsat/src/main/java/org/josast/amicalsat/V1RlTypeFrame.java b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/V1RlTypeFrame.java new file mode 100644 index 0000000..7222fff --- /dev/null +++ b/ModuleAmicalsat/src/main/java/org/josast/amicalsat/V1RlTypeFrame.java @@ -0,0 +1,45 @@ +package org.josast.amicalsat; + +import org.josast.amicalsat.FrameTlmAmicalsat.V1RlType; +import org.josast.amicalsat.FrameTlmAmicalsat.V1Type; + +public class V1RlTypeFrame extends Frame { + + private String timeStamps; + private String cpuVoltage; + private String batteryVoltage; + private String amplifierTemperature; + private String flags; + + @Override + public void setUp(FrameTlmAmicalsat cube) { + + V1Type v1u2type = (V1Type) cube.frameTlmEntrySat().payload().tlmAreaSwitch(); + V1RlType mstype = (V1RlType) v1u2type.tlmsw(); + + timeStamps = mstype.timeStamp(); + hash.put("timeStamps", timeStamps); + + cpuVoltage = mstype.cpuVoltage(); + hash.put("cpuVoltage", cpuVoltage); + batteryVoltage = mstype.batteryVoltage(); + hash.put("batteryVoltage", batteryVoltage); + amplifierTemperature = mstype.amplifierTemperature(); + hash.put("amplifierTemperature", amplifierTemperature); + + flags = mstype.flags(); + hash.put("flags", flags) ; + + + + + + + + + + } + + + +} diff --git a/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java b/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java new file mode 100644 index 0000000..817bc88 --- /dev/null +++ b/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java @@ -0,0 +1,118 @@ +/** + * + */ +package org.josast.amicalsat; + +import java.io.IOException; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Iterator; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import io.kaitai.struct.ByteBufferKaitaiStream; + +/** + * @author christophe + * + */ +class FrameFactoryTest { + + int cpt=0; + String generateRepository="src/test/resources/kissfiles"; + byte[] buff = null; + FrameTlmAmicalsat cube=null; + + /** + * @throws java.lang.Exception + */ + @BeforeAll + static void setUpBeforeClass() throws Exception { + } + + /** + * @throws java.lang.Exception + */ + @AfterAll + static void tearDownAfterClass() throws Exception { + } + + /** + * @throws java.lang.Exception + */ + @BeforeEach + void setUp() throws Exception { + + + + } + + /** + * @throws java.lang.Exception + */ + @AfterEach + void tearDown() throws Exception { + } + + /** + * Test method for {@link org.josast.amicalsat.FrameFactory#creerFrame(java.lang.String, java.lang.String)}. + */ + @Test + void testCreerFrame() { + + FrameFactory ff = new FrameFactory(); + + Path path = Paths.get(generateRepository); + + DirectoryStream stream; + try { + stream = Files.newDirectoryStream(path); + + try { + Iterator iterator = stream.iterator(); + while(iterator.hasNext()) { + Path p = iterator.next(); + System.out.println(p); + byte [] kissbuff = Files.readAllBytes(p); + kiss k = new kiss(kissbuff); + buff =k.toRaw(); + cube = new FrameTlmAmicalsat(new ByteBufferKaitaiStream(buff)); + System.out.print( + "Source : " + cube.frameTlmEntrySat().ax25Header().srcCallsignRaw().srcCallsignRor().srcCallsign()); + System.out.print("destination : " + + cube.frameTlmEntrySat().ax25Header().destCallsignRaw().destCallsignRor().destCallsign()); + System.out.print("PID : " + cube.frameTlmEntrySat().payload().pid()); + System.out.println(" SSID : " + cube.frameTlmEntrySat().ax25Header().srcSsidRaw()); + String tlmArea = cube.frameTlmEntrySat().payload().tlmArea(); + String typeFrame = cube.frameTlmEntrySat().payload().tlmType(); + System.out.println(tlmArea +" "+ typeFrame); + Frame fm = ff.creerFrame(tlmArea, typeFrame); + fm.setUp(cube); + + System.out.println(fm.toString()); + + } + } catch (KissException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + stream.close(); + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + + + + // fail("Not yet implemented"); + } + +} diff --git a/ModuleAmicalsat/src/test/resources/kissfiles/Frame_0.bin b/ModuleAmicalsat/src/test/resources/kissfiles/Frame_0.bin new file mode 100644 index 0000000000000000000000000000000000000000..3e9c45d6bdd8ab8d04d37f039876fb996233c53b GIT binary patch literal 68 zcmX@W(6pdq*@}#uCCifXmNDe4o7B;j7?=P6 literal 0 HcmV?d00001 diff --git a/ModuleAmicalsat/src/test/resources/kissfiles/Frame_14.bin b/ModuleAmicalsat/src/test/resources/kissfiles/Frame_14.bin new file mode 100644 index 0000000000000000000000000000000000000000..b66e6138d58d58b5d2ef1fe50f476e4d7c9c2c0e GIT binary patch literal 62 zcmX@W(6pdq*@}#uCCifXmNDe4o7B;jlzyw8Jive06ZWTb^rhX literal 0 HcmV?d00001 diff --git a/ModuleAmicalsat/src/test/resources/kissfiles/Frame_16.bin b/ModuleAmicalsat/src/test/resources/kissfiles/Frame_16.bin new file mode 100644 index 0000000000000000000000000000000000000000..1887848192d3b40c29ec384d5ef7705ebb953659 GIT binary patch literal 71 zcmX@W(6pdq*@}#uCCifXmNDe4o7B;j0=m* literal 0 HcmV?d00001 diff --git a/ModuleAmicalsat/src/test/resources/kissfiles/Frame_24.bin b/ModuleAmicalsat/src/test/resources/kissfiles/Frame_24.bin new file mode 100644 index 0000000000000000000000000000000000000000..8a9df54ba2d4798f77d7427aa59a1c43ed630831 GIT binary patch literal 59 zcmX@W(6pdq*@}#uCCifXmNDe4o7B;jTN|2M7#Ld`o0=L~ YTbdagTI(8Fm>XH^ni!j!TN@kz0Pp%34FCWD literal 0 HcmV?d00001 diff --git a/ModuleAmicalsat/src/test/resources/kissfiles/Frame_28.bin b/ModuleAmicalsat/src/test/resources/kissfiles/Frame_28.bin new file mode 100644 index 0000000000000000000000000000000000000000..dcb116d4724f39b10b6c39ea0d4dc8f3904645e8 GIT binary patch literal 62 zcmX@W(6pdq*@}#uCCifXmNDe4o7B;j literal 0 HcmV?d00001 diff --git a/ModuleAmicalsat/src/test/resources/kissfiles/Frame_6.bin b/ModuleAmicalsat/src/test/resources/kissfiles/Frame_6.bin new file mode 100644 index 0000000000000000000000000000000000000000..fa9b67c22e2cfea21a884c350ad387ebad1787be GIT binary patch literal 81 zcmX@W(6pdq*@}#uCCifXmNDe4o7B;j&QD2jCiv literal 0 HcmV?d00001 diff --git a/ModuleAmicalsat/src/test/resources/kissfiles/Frame_8.bin b/ModuleAmicalsat/src/test/resources/kissfiles/Frame_8.bin new file mode 100644 index 0000000000000000000000000000000000000000..dfe6d1f75df126db5b921145636123f5a5911a7f GIT binary patch literal 74 zcmX@W(6pdq*@}#uCCifXmNDe4o7B;j3)Y09XeZ8UO$Q literal 0 HcmV?d00001 diff --git a/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/KissException.java b/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/KissException.java new file mode 100644 index 0000000..73d4d72 --- /dev/null +++ b/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/KissException.java @@ -0,0 +1,60 @@ +/** + * + */ +package org.josast.ModuleSoundModem; + +/** + * @author christophe + * + */ +public class KissException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 7103474292775784017L; + + /** + * + */ + public KissException() { + // TODO Auto-generated constructor stub + } + + /** + * @param message + */ + public KissException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + /** + * @param cause + */ + public KissException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + /** + * @param message + * @param cause + */ + public KissException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + /** + * @param message + * @param cause + * @param enableSuppression + * @param writableStackTrace + */ + public KissException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + +} diff --git a/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/kiss.java b/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/kiss.java new file mode 100644 index 0000000..eba3658 --- /dev/null +++ b/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/kiss.java @@ -0,0 +1,65 @@ +package org.josast.ModuleSoundModem; + +import java.util.Arrays; + +/** + * + * + * @author christophe + * + */ +public class kiss { + + public static byte FEND = (byte) 0xC0; + + // TFEND ($DB, $DC) + + public static byte FESC = (byte) 0xDB; + public static byte TFEND = (byte) 0xDC; + + // FESC, TFESC ($DB, $DD). + public static byte TFESC = (byte) 0xDD; + + byte[] kissdata = null; + + public kiss(byte[] data) { + kissdata = data; + } + + public byte[] toRaw() throws KissException { + byte[] rawData = null; + rawData = new byte[kissdata.length]; + + if (kissdata[0] != FEND) { + throw new KissException("FEND (0xC0) value not find at the beginning of the frame "); + } + if (kissdata[kissdata.length - 1] != FEND) { + throw new KissException("FEND (0xC0) value not find at the end of the frame "); + } + int cptraw = 0; + int i = 1; + while (kissdata[i] != FEND) { + if (kissdata[i] != FESC) { + rawData[cptraw++] = kissdata[i++]; + } else { + if (kissdata[i + 1] == TFEND) { + System.out.println("TFEND"); + rawData[cptraw++] = FEND; + i = i + 1; + } else if (kissdata[i + 1] == TFESC) { + System.out.println("TFESC"); + rawData[cptraw++] = FESC; + i = i + 1; + } else { + rawData[cptraw++] = kissdata[i++]; + } + + } + + } + + return Arrays.copyOf(rawData, cptraw); + + } + +} -- GitLab From 8223435b8955cd5fee115b5bd269ecb6afe99087 Mon Sep 17 00:00:00 2001 From: xtophe Date: Sun, 29 Mar 2020 15:31:35 +0200 Subject: [PATCH 2/5] add pom --- ModuleAmicalsat/pom.xml | 111 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 ModuleAmicalsat/pom.xml diff --git a/ModuleAmicalsat/pom.xml b/ModuleAmicalsat/pom.xml new file mode 100644 index 0000000..e5e3135 --- /dev/null +++ b/ModuleAmicalsat/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + + JOSAST-parent + org.josast + 0.0.2-SNAPSHOT + + + + ModuleAmicalsat + 1.0-SNAPSHOT + + ModuleAmicalsat + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + ${env.JAVA_HOME} + 0.1.5 + + + + + + name.valery1707.kaitai + kaitai-maven-plugin + ${kaitai-maven-plugin-version} + + + + + io.kaitai + kaitai-struct-runtime + 0.8 + + + + org.josast + ModuleSoundModem + 0.0.2-SNAPSHOT + + + + org.josast + ModuleConfig + 0.2 + + + commons-cli + commons-cli + 1.4 + + + +org.junit.jupiter + junit-jupiter-engine + 5.5.2 + test + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + -- GitLab From 08be0e7f799ebe8df82839ef397b3adda07c6a0d Mon Sep 17 00:00:00 2001 From: xtof Date: Sun, 29 Mar 2020 18:15:04 +0200 Subject: [PATCH 3/5] Add parameter management --- .../amicalsat/cli/AmicalsatCli.java | 186 +++++++++++++++--- 1 file changed, 159 insertions(+), 27 deletions(-) diff --git a/AplicationAmicalsat/src/main/java/org/josast/application/amicalsat/cli/AmicalsatCli.java b/AplicationAmicalsat/src/main/java/org/josast/application/amicalsat/cli/AmicalsatCli.java index ce64f95..d376f39 100644 --- a/AplicationAmicalsat/src/main/java/org/josast/application/amicalsat/cli/AmicalsatCli.java +++ b/AplicationAmicalsat/src/main/java/org/josast/application/amicalsat/cli/AmicalsatCli.java @@ -1,21 +1,35 @@ package org.josast.application.amicalsat.cli; -import org.josast.AX25.AX25Frame; -import org.josast.AX25.KissData; -import org.josast.AX25.KissFrame; +import java.util.Arrays; +import java.util.logging.Logger; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Option; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; +import org.josast.ModuleSoundModem.KissException; +import org.josast.ModuleSoundModem.SoundModemCli; import org.josast.ModuleSoundModem.SoundModemClient; import org.josast.ModuleSoundModem.SoundModemConfiguration; +import org.josast.ModuleSoundModem.kiss; import org.josast.amicalsat.Frame; import org.josast.amicalsat.FrameFactory; import org.josast.amicalsat.FrameTlmAmicalsat; -import org.josast.amicalsat.KissException; -import org.josast.amicalsat.kiss; import io.kaitai.struct.ByteBufferKaitaiStream; public class AmicalsatCli { - - private String version = "0.1"; + private Logger log = Logger.getLogger(getClass().getName()); + private String version = "0.2"; + private String configurationfile = "defaultConfigFile.ini"; + /* + * Utilisation d'un répertoire par défaut + */ + private String generateRepository = "DataReceived"; + byte[] cbuf = new byte[1000]; @@ -23,32 +37,107 @@ public class AmicalsatCli { return version; } + public String getConfigurationfile() { + return configurationfile; + } + + public void setConfigurationfile(String configurationfile) { + this.configurationfile = configurationfile; + } + + public String getGenerateRepository() { + return generateRepository; + } + + public void setGenerateRepository(String generateRepository) { + this.generateRepository = generateRepository; + } public AmicalsatCli() { // TODO Auto-generated constructor stub } - - public void execute() - { + private static Options configParameters() { + + final Option versionOption = Option.builder("V") + + .longOpt("Version") // + + .desc("Return application version") + + .hasArg(false) + + .required(false) + + .build(); + + final Option configFileOption = Option.builder("C") + + .longOpt("Config") // + + .desc("Return application version") + + .hasArg(true) + + .argName("configFile") + + .required(false) + + .build(); + + final Option generateFileOption = Option.builder("G") + + .longOpt("Generate") // + + .desc("generate file frame received - not implemented") + + .hasArg(true) + + .argName("GenerateRepository") + + .required(false) + + .build(); + + final Option helpFileOption = Option.builder("h") + + .longOpt("help") + + .desc("display help message") + + .build(); + + final Options options = new Options(); + + options.addOption(versionOption); + + options.addOption(configFileOption); + + options.addOption(generateFileOption); + + options.addOption(helpFileOption); + + return options; + + } + + + public void execute() { FrameFactory ff = new FrameFactory(); - SoundModemConfiguration smconf = new SoundModemConfiguration("config"); + SoundModemConfiguration smconf = new SoundModemConfiguration(configurationfile); SoundModemClient sm = new SoundModemClient(smconf); - - + while (true) { int nb = sm.receiveData(cbuf); - KissFrame kf = new KissFrame(); - KissData kissData = kf.extactMessage(cbuf, nb); - kiss k = new kiss(kissData.getData()); - System.out.println(kissData); + sm.decode(cbuf, nb); + kiss k = new kiss(Arrays.copyOf(cbuf, nb)); - FrameTlmAmicalsat cube=null; + FrameTlmAmicalsat cube = null; try { cube = new FrameTlmAmicalsat(new ByteBufferKaitaiStream(k.toRaw())); } catch (KissException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.severe(e.toString()); + } System.out.print( "Source : " + cube.frameTlmEntrySat().ax25Header().srcCallsignRaw().srcCallsignRor().srcCallsign()); @@ -58,22 +147,65 @@ public class AmicalsatCli { System.out.println(" SSID : " + cube.frameTlmEntrySat().ax25Header().srcSsidRaw()); String tlmArea = cube.frameTlmEntrySat().payload().tlmArea(); String typeFrame = cube.frameTlmEntrySat().payload().tlmType(); - System.out.println(tlmArea +" "+ typeFrame); + System.out.println(tlmArea + " " + typeFrame); Frame fm = ff.creerFrame(tlmArea, typeFrame); fm.setUp(cube); System.out.println(fm.toString()); - - + } - - + } - - public static void main(String[] args) { + + public static void main(String[] args) throws ParseException { + final Options options = configParameters(); + + final CommandLineParser parser = new DefaultParser(); + + final CommandLine line = parser.parse(options, args); + + AmicalsatCli cli = new AmicalsatCli(); + + boolean helpMode = line.hasOption("help"); + + if (helpMode) { + + final HelpFormatter formatter = new HelpFormatter(); + + formatter.printHelp(args[0], options, true); + + System.exit(0); + + } + + boolean versionpMode = line.hasOption("Version"); + + if (versionpMode) { + + System.out.println(SoundModemCli.class.getSimpleName() + " " + cli.getVersion()); + + System.exit(0); + + } + + boolean configMode = line.hasOption("Config"); + + if (configMode) { + + cli.setConfigurationfile(line.getOptionValue("Config", "")); + + } + + boolean generateMode = line.hasOption("Generate"); + + if (generateMode) { + + cli.setGenerateRepository(line.getOptionValue("Generate", "")); + + } System.out.println(cli.getVersion()); cli.execute(); -- GitLab From 01ceb8cefab2f7ba493954330453eddec2c0bd71 Mon Sep 17 00:00:00 2001 From: xtof Date: Sun, 29 Mar 2020 18:16:44 +0200 Subject: [PATCH 4/5] minor change --- .../src/test/java/org/josast/amicalsat/FrameFactoryTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java b/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java index 817bc88..9dd2abe 100644 --- a/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java +++ b/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java @@ -9,6 +9,9 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Iterator; + +import org.josast.ModuleSoundModem.KissException; +import org.josast.ModuleSoundModem.kiss; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; -- GitLab From 8eb17831ef2647dd96e2b945e13d0df1306a7018 Mon Sep 17 00:00:00 2001 From: xtof Date: Sun, 29 Mar 2020 18:17:12 +0200 Subject: [PATCH 5/5] minor change --- .../src/test/java/org/josast/amicalsat/FrameFactoryTest.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java b/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java index 9dd2abe..96a453b 100644 --- a/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java +++ b/ModuleAmicalsat/src/test/java/org/josast/amicalsat/FrameFactoryTest.java @@ -111,11 +111,6 @@ class FrameFactoryTest { e.printStackTrace(); } - - - - - // fail("Not yet implemented"); } } -- GitLab