From 28141d97e0bfb7eb277b7241c53434e3316d5e82 Mon Sep 17 00:00:00 2001 From: Jose Damico Date: Sat, 21 Oct 2023 11:47:18 -0300 Subject: [PATCH] preparing for decode from soundcard --- java-land/.project | 23 -------- pom.xml | 41 +++++++++++++++ src/main/java/org/jdamico/javax25/App.java | 61 +++++++++++++++++++++- 3 files changed, 101 insertions(+), 24 deletions(-) delete mode 100644 java-land/.project diff --git a/java-land/.project b/java-land/.project deleted file mode 100644 index d76d1cb..0000000 --- a/java-land/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - javAX25 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/pom.xml b/pom.xml index bfa9344..80bea9f 100644 --- a/pom.xml +++ b/pom.xml @@ -33,4 +33,45 @@ + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + rtl433toaprs + package + + single + + + + + + org.jdamico.javax25.App + + + + + Jose Damico (PU2LVM) + ${project.version} + + + + + jar-with-dependencies + + + + + + + + + + + + diff --git a/src/main/java/org/jdamico/javax25/App.java b/src/main/java/org/jdamico/javax25/App.java index 41b5afe..68a5d52 100644 --- a/src/main/java/org/jdamico/javax25/App.java +++ b/src/main/java/org/jdamico/javax25/App.java @@ -1,5 +1,18 @@ package org.jdamico.javax25; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.util.Properties; + +import org.jdamico.javax25.ax25.Afsk1200Modulator; +import org.jdamico.javax25.ax25.Afsk1200MultiDemodulator; +import org.jdamico.javax25.ax25.Packet; +import org.jdamico.javax25.ax25.PacketDemodulator; +import org.jdamico.javax25.radiocontrol.SerialTransmitController; +import org.jdamico.javax25.radiocontrol.TransmitController; +import org.jdamico.javax25.soundcard.Soundcard; + /** * Hello world! * @@ -8,6 +21,52 @@ public class App { public static void main( String[] args ) { - System.out.println( "Hello World!" ); + Soundcard.enumerate(); + SerialTransmitController.enumerate(); + + Properties p = System.getProperties(); + + int rate = 48000; + int filter_length = 32; + + PacketHandlerImpl t = new PacketHandlerImpl(); + Afsk1200Modulator mod = null; + PacketDemodulator multi = null; + try { + multi = new Afsk1200MultiDemodulator(rate,t); + mod = new Afsk1200Modulator(rate); + } catch (Exception e) { + System.out.println("Exception trying to create an Afsk1200 object: "+e.getMessage()); + } + + + /*** preparing to generate or capture audio packets ***/ + + String input = null; + String output = "PulseAudio Mixer"; + + int buffer_size = -1; + try { + // our default is 100ms + buffer_size = Integer.parseInt(p.getProperty("latency", "100").trim()); + } catch (Exception e){ + System.err.println("Exception parsing buffersize "+e.toString()); + } + + Soundcard sc = new Soundcard(rate,input,output,buffer_size,multi,mod); + + if (p.containsKey("audio-level")) { + sc.displayAudioLevel(); + } + + + /*** listen for incoming packets ***/ + + if (input != null) { + System.out.printf("Listening for packets\n"); + //sc.openSoundInput(input); + sc.receive(); + } + } }