Skip to content
Snippets Groups Projects
Commit 4ed842e6 authored by brutzman's avatar brutzman
Browse files

updated package structure dis7 library

parent 0d79e777
No related branches found
No related tags found
No related merge requests found
......@@ -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[])
......
......@@ -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) {
......
......@@ -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.
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment