diff --git a/src/edu/nps/moves/dis7/examples/PduReaderPlayer.java b/src/edu/nps/moves/dis7/examples/PduReaderPlayer.java index 2b5d2dafa4568f6a93c1de9720414743058a3a9d..fd292dcfc71bd92e44b159f51cadcfa5197ca75f 100644 --- a/src/edu/nps/moves/dis7/examples/PduReaderPlayer.java +++ b/src/edu/nps/moves/dis7/examples/PduReaderPlayer.java @@ -41,22 +41,24 @@ public class PduReaderPlayer break; case 1: outDir = args[0]; + sendToNet = Boolean.valueOf(args[1]); break; case 3: outDir = args[0]; mcast = args[1]; port = Integer.parseInt(args[2]); - sendToNet = true; + sendToNet = Boolean.valueOf(args[3]); break; default: - System.err.println("Usage: PduReaderPlayer() or PduReaderPlayer(\"outputdir\") or PduReaderPlayer(\"outputdir\",\"multicast address\", ipPort"); + System.err.println("Usage: PduReaderPlayer() or " + + "PduReaderPlayer(\"outputdir\", \"sendToNet true/false\") or " + + "PduReaderPlayer(\"outputdir\", \"multicast address\", \"ipPort\", \"sendToNet true/false\""); System.exit(1); } System.out.println("Beginning pdu playback from directory " + outDir); try { - PduPlayer pduPlayer = new PduPlayer(mcast, port, Path.of(outDir)); - pduPlayer.sendToNet(sendToNet); + PduPlayer pduPlayer = new PduPlayer(mcast, port, Path.of(outDir), sendToNet); mystate state = mystate.RUNNING; Scanner scan = new Scanner(System.in); diff --git a/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java b/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java index 5ec1250128f2fc0a18e4c86a44d3b3bde1c974f7..7ca8ff4aca955397c41b648ca77490b23421182a 100644 --- a/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java +++ b/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java @@ -54,12 +54,14 @@ public class PduPlayer { * @param ip the multicast group address to utilize * @param port the multicast port to utilize * @param disLogDirectory a path to the directory containing PDU log files + * @param sendToNet to capture X3D interpolator values - if desired * @throws IOException if something goes wrong processing files */ - public PduPlayer(String ip, int port, Path disLogDirectory) throws IOException { + public PduPlayer(String ip, int port, Path disLogDirectory, boolean sendToNet) throws IOException { this.disLogDirectory = disLogDirectory; this.ip = ip; this.port = port; + this.netSend = sendToNet; thrd = new Thread(() -> begin()); thrd.setPriority(Thread.NORM_PRIORITY); @@ -84,10 +86,6 @@ public class PduPlayer { private byte[] globalByteBufferForX3dInterPolators = null; // -------------------- End Variables for X3D autogenerated code - public void sendToNet(boolean tf) { - netSend = tf; - } - public void addRawListener(RawListener lis) { rawListener = lis; } diff --git a/test/edu/nps/moves/dis7/AllPduRoundTripTest.java b/test/edu/nps/moves/dis7/AllPduRoundTripTest.java index 484f495eeef16aecee24f8ce5e45c005d66fbba3..e8a798ddfff3bf21d4a88bb6ec67afaeb67ae7c9 100644 --- a/test/edu/nps/moves/dis7/AllPduRoundTripTest.java +++ b/test/edu/nps/moves/dis7/AllPduRoundTripTest.java @@ -207,8 +207,7 @@ public class AllPduRoundTripTest { sem.acquire(); Path path = Path.of(recorder.getLogFile()).getParent(); - PduPlayer player = new PduPlayer(disnetworking.getMcastGroup(), disnetworking.getDisPort(), path); - player.sendToNet(false); + PduPlayer player = new PduPlayer(disnetworking.getMcastGroup(), disnetworking.getDisPort(), path, false); player.addRawListener(ba -> { if (ba != null) { Pdu pdu = pduFactory.createPdu(ba); diff --git a/test/edu/nps/moves/dis7/SignalPdusTest.java b/test/edu/nps/moves/dis7/SignalPdusTest.java index c416f7bd35b653265a5c99686871b3c73ce7cddc..5f9b670838cd68cbb41b671bca05e1d08d9f1edc 100644 --- a/test/edu/nps/moves/dis7/SignalPdusTest.java +++ b/test/edu/nps/moves/dis7/SignalPdusTest.java @@ -133,8 +133,7 @@ public class SignalPdusTest { Path path = Path.of(recorder.getLogFile()).getParent(); // Note: the player will playback all log files in the given path - PduPlayer player = new PduPlayer(netif.getMcastGroup(), netif.getDisPort(), path); - player.sendToNet(false); + PduPlayer player = new PduPlayer(netif.getMcastGroup(), netif.getDisPort(), path, false); player.addRawListener(ba -> { if (ba != null) assertNotNull(pduFac.createPdu(ba), "PDU creation failure");