diff --git a/examples/src/OpenDis7Examples/AllPduReceiver.java b/examples/src/OpenDis7Examples/AllPduReceiver.java index 101cde4519ba2917829753b1edf69e3dfba21765..c2ad0f3b89eeeddbf8522d69587640ff2a9b58ee 100644 --- a/examples/src/OpenDis7Examples/AllPduReceiver.java +++ b/examples/src/OpenDis7Examples/AllPduReceiver.java @@ -5,13 +5,13 @@ import java.io.*; import edu.nps.moves.dis7.*; import edu.nps.moves.dis7.enumerations.*; -import edu.nps.moves.dis7.util.*; +import edu.nps.moves.dis7.utilities.PduFactory; import java.util.ArrayList; public class AllPduReceiver { - public static final int DEFAULT_MULTICAST_PORT = AllPduSender.DEFAULT_MULTICAST_PORT; - public static final String DEFAULT_MULTICAST_ADDRESS = AllPduSender.DEFAULT_MULTICAST_ADDRESS; + public static final int DEFAULT_MULTICAST_PORT = AllPduSender.DEFAULT_MULTICAST_PORT; + public static final String DEFAULT_MULTICAST_ADDRESS = AllPduSender.DEFAULT_MULTICAST_ADDRESS; public static final boolean USE_FAST_ESPDU = false; public static void main(String args[]) diff --git a/examples/src/OpenDis7Examples/AllPduSender.java b/examples/src/OpenDis7Examples/AllPduSender.java index 7c2a4f6f0edb8f4e4588a4f8d14756b184208f08..b49965231f89a70ba2157b6444f3365d816b3872 100755 --- a/examples/src/OpenDis7Examples/AllPduSender.java +++ b/examples/src/OpenDis7Examples/AllPduSender.java @@ -21,7 +21,7 @@ public class AllPduSender public static final String DEFAULT_MULTICAST_ADDRESS = "239.1.2.3"; /** Default multicast port used, matches Wireshark DIS capture default */ - public static final int DEFAULT_MULTICAST_PORT = 2342; + public static final int DEFAULT_MULTICAST_PORT = 3000; private int port; InetAddress multicastAddress; @@ -381,8 +381,8 @@ public class AllPduSender for (String comment : commentsList) { VariableDatum newVariableDatum = new VariableDatum(); - newVariableDatum.setVariableDatumValue (comment.getBytes()); // conversion - newVariableDatum.setVariableDatumLength(comment.getBytes().length * 8); // bits, not bytes, see spec and javadoc + newVariableDatum.setVariableDatumValue (comment.getBytes()); // conversion + newVariableDatum.setVariableDatumLengthInBytes(comment.getBytes().length); // also available in bits, see spec and javadoc // alternatively, you do not need to set this and the marshaller will figure it out from the byte array // (see javadoc for VariableDatum.setVariableDatumLength()) payloadList.add(newVariableDatum); @@ -443,13 +443,13 @@ public class AllPduSender packet = new DatagramPacket(buffer, buffer.length, localMulticastAddress, DEFAULT_MULTICAST_PORT); multicastSocket.send(packet); try { - Thread.sleep(100L); // TODO shouldn't this kind of delay timing be in a DIS sender class? + Thread.sleep(10L); // TODO shouldn't this kind of delay timing be in a DIS sender class? } catch (InterruptedException ex) { } - String currentPduTypeValuePadded = String.format("%2s", aPdu.getPduType().getValue()); - String currentPduTypePadded = String.format("%-34s", aPdu.getPduType()); // - indicates right padding of whitespace - System.out.print ("Sent DIS PDU " + currentPduTypeValuePadded + " " + currentPduTypePadded ); + String currentPduTypeValuePadded = String.format("%2s", aPdu.getPduType().getValue()); + String currentPduTypePadded = String.format("%-34s", aPdu.getPduType()); // - indicates right padding of whitespace + System.out.print ("Sent DIS PDU " + currentPduTypePadded + " " + currentPduTypeValuePadded ); System.out.println(" of type " + aPdu.getClass().getName()); } catch (Exception ex) { diff --git a/examples/src/OpenDis7Examples/EspduReceiver.java b/examples/src/OpenDis7Examples/EspduReceiver.java index d98d61bca43d68d5ce4bf15dee4eb5b61fd08cfd..d019e783a1b81620f128096ce690df51eb6eaae8 100755 --- a/examples/src/OpenDis7Examples/EspduReceiver.java +++ b/examples/src/OpenDis7Examples/EspduReceiver.java @@ -5,7 +5,7 @@ import java.net.*; import java.util.*; import edu.nps.moves.dis7.*; -import edu.nps.moves.dis7.util.*; +import edu.nps.moves.dis7.utilities.*; /** * Receives PDUs from the network in IEEE DIS format. diff --git a/examples/src/OpenDis7Examples/EspduSender.java b/examples/src/OpenDis7Examples/EspduSender.java index 41e77d4e27b2defd01e15e7e5fee2f52f4050994..cdb5d1fb89f4526f6d3c3eaffc08596b48e667c5 100644 --- a/examples/src/OpenDis7Examples/EspduSender.java +++ b/examples/src/OpenDis7Examples/EspduSender.java @@ -5,7 +5,7 @@ import java.net.*; import java.util.*; import edu.nps.moves.dis7.*; -import edu.nps.moves.dis7.util.*; +import edu.nps.moves.dis7.utilities.*; import edu.nps.moves.dis7.enumerations.Country; import edu.nps.moves.dis7.enumerations.EntityKind; import edu.nps.moves.dis7.enumerations.PlatformDomain; diff --git a/examples/src/OpenDis7Examples/PduListenerSaver.java b/examples/src/OpenDis7Examples/PduListenerSaver.java index a64184e8dd6bc15af2877bb0ce5fa362bd9ed49f..1f9da30146db83e5a6e8fbcf0bfdf8ae667fba96 100644 --- a/examples/src/OpenDis7Examples/PduListenerSaver.java +++ b/examples/src/OpenDis7Examples/PduListenerSaver.java @@ -4,7 +4,8 @@ */ package OpenDis7Examples; -import edu.nps.moves.dis7.util.playerrecorder.Recorder; +//import edu.nps.moves.dis7.util.playerrecorder.Recorder; +import edu.nps.moves.dis7.utilities.stream.PduRecorder; import java.io.IOException; import java.util.Scanner; @@ -20,6 +21,8 @@ public class PduListenerSaver // TODO promote to open-dis7 library? private final static String DEFAULT_OUTPUTDIR = "pduLog"; private final static String MCAST_ADDR = "239.1.2.3"; private final static int DIS_PORT = 3000; +// public static final int DEFAULT_MULTICAST_PORT = AllPduSender.DEFAULT_MULTICAST_PORT; +// public static final String DEFAULT_MULTICAST_ADDRESS = AllPduSender.DEFAULT_MULTICAST_ADDRESS; private enum mystate { @@ -53,7 +56,7 @@ public class PduListenerSaver // TODO promote to open-dis7 library? System.out.println("Beginning pdu save to directory " + outDir); try { - Recorder recorder = new Recorder(outDir, mcast, port); + PduRecorder recorder = new PduRecorder(outDir, mcast, port); recorder.startResume(); mystate state = mystate.RUNNING; diff --git a/examples/src/OpenDis7Examples/PduReaderPlayer.java b/examples/src/OpenDis7Examples/PduReaderPlayer.java index 93515a581c3533c2ae797b20999fdf54db9f7c3e..8b3aac54b7c8103f0283377783ef0795f380c199 100644 --- a/examples/src/OpenDis7Examples/PduReaderPlayer.java +++ b/examples/src/OpenDis7Examples/PduReaderPlayer.java @@ -4,7 +4,7 @@ */ package OpenDis7Examples; -import edu.nps.moves.dis7.util.playerrecorder.Player; +import edu.nps.moves.dis7.utilities.stream.PduPlayer; import java.io.File; import java.io.IOException; import java.util.Scanner; @@ -54,7 +54,7 @@ public class PduReaderPlayer System.out.println("Beginning pdu playback from directory " + outDir); try { - Player player = new Player(mcast, port, new File(outDir).toPath()); + PduPlayer player = new PduPlayer(mcast, port, new File(outDir).toPath()); player.startResume(); mystate state = mystate.RUNNING; Scanner scan = new Scanner(System.in);