Skip to content
Snippets Groups Projects
Commit 9b861501 authored by UnityGrunt03's avatar UnityGrunt03
Browse files

Created a more elements to the firePDU, removed other unnecessary files

parent c9f707ca
No related branches found
No related tags found
No related merge requests found
Invocation instructions:
1. run/debug EspduReceiver.java (since sender does not block, first be ready to listen)
2. run/debug EspduSender.java
Program responses, sender and receiver:
===================================================
run:
DisExamplesOpenDis7.EspduSender started...
Sending 5 sets of packets:
===============
Create new PDUs
latitude, longitude: [36.595517, -121.87693999999999]
coordinate conversion: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
Espdu #0 entityID=[1,2,3]
Sending espdu datagram packet to /127.255.255.255
Sending fire datagram packet to /127.255.255.255
Sending espdu datagram packet to /172.20.221.218
Sending fire datagram packet to /172.20.221.218
Sending espdu datagram packet to /10.0.0.255
Sending fire datagram packet to /10.0.0.255
===============
Create new PDUs
latitude, longitude: [36.595517, -121.877]
coordinate conversion: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
Espdu #1 entityID=[1,2,3]
Sending espdu datagram packet to /127.255.255.255
Sending fire datagram packet to /127.255.255.255
Sending espdu datagram packet to /172.20.221.218
Sending fire datagram packet to /172.20.221.218
Sending espdu datagram packet to /10.0.0.255
Sending fire datagram packet to /10.0.0.255
===============
Create new PDUs
latitude, longitude: [36.595517, -121.87693999999999]
coordinate conversion: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
Espdu #2 entityID=[1,2,3]
Sending espdu datagram packet to /127.255.255.255
Sending fire datagram packet to /127.255.255.255
Sending espdu datagram packet to /172.20.221.218
Sending fire datagram packet to /172.20.221.218
Sending espdu datagram packet to /10.0.0.255
Sending fire datagram packet to /10.0.0.255
===============
Create new PDUs
latitude, longitude: [36.595517, -121.877]
coordinate conversion: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
Espdu #3 entityID=[1,2,3]
Sending espdu datagram packet to /127.255.255.255
Sending fire datagram packet to /127.255.255.255
Sending espdu datagram packet to /172.20.221.218
Sending fire datagram packet to /172.20.221.218
Sending espdu datagram packet to /10.0.0.255
Sending fire datagram packet to /10.0.0.255
===============
Create new PDUs
latitude, longitude: [36.595517, -121.87693999999999]
coordinate conversion: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
Espdu #4 entityID=[1,2,3]
Sending espdu datagram packet to /127.255.255.255
Sending fire datagram packet to /127.255.255.255
Sending espdu datagram packet to /172.20.221.218
Sending fire datagram packet to /172.20.221.218
Sending espdu datagram packet to /10.0.0.255
Sending fire datagram packet to /10.0.0.255
===============
DisExamplesOpenDis7.EspduSender complete.
BUILD SUCCESSFUL (total time: 8 seconds)
===================================================
DisExamplesOpenDis7.EspduReceiver started...
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413]
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
===============
received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu
entityID triplet: [1, 2, 3]
Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu
FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413]
===================================================
\ No newline at end of file
/**
* Copyright (c) 2008-2019, MOVES Institute, Naval Postgraduate School. All rights reserved.
* This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html
*/
package MV3500Cohort2019JulySeptember.homework4.Yurkovich;
import edu.nps.moves.dis7.util.playerrecorder.Recorder;
import java.io.IOException;
import java.util.Scanner;
/**
* PduSaver.java created on Aug 21, 2019
* MOVES Institute Naval Postgraduate School, Monterey, CA, USA www.nps.edu
*
* @author Mike Bailey, jmbailey@nps.edu
* @version $Id$
*/
public class PduListenerSaver
{
private final static String DEFAULT_OUTPUTDIR = "./pduLog";
private final static String MCAST_ADDR = "239.1.2.3";
private final static int DIS_PORT = 3000;
private enum mystate
{
RUNNING,
PAUSED;
}
public static void main(String[] args)
{
String outDir = DEFAULT_OUTPUTDIR;
String mcast = MCAST_ADDR;
int port = DIS_PORT;
switch (args.length) {
case 0:
break;
case 1:
outDir = args[0];
break;
case 3:
outDir = args[0];
mcast = args[1];
port = Integer.parseInt(args[2]);
break;
default:
System.err.println("Usage: PduListener() or PduListener(\"outputdir\") or PduListener(\"outputdir\",\"multicast address\", ipPort");
System.exit(1);
}
System.out.println("Beginning pdu save to directory " + outDir);
try {
Recorder recorder = new Recorder(outDir, mcast, port);
recorder.startResume();
mystate state = mystate.RUNNING;
Scanner scan = new Scanner(System.in);
while (true) {
System.out.println("Type p/enter to pause, r/enter to resume, q/enter to quit");
String line = scan.nextLine();
if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) {
recorder.stopPause();
state = mystate.PAUSED;
}
else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) {
recorder.startResume();
state = mystate.RUNNING;
}
else if (line.equalsIgnoreCase("q")) {
recorder.end();
break;
}
}
System.out.println("Ending pdu save to "+recorder.getLogFile());
}
catch (IOException ex) {
System.err.println("Exception: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage());
}
}
}
/**
* Copyright (c) 2008-2019, MOVES Institute, Naval Postgraduate School. All rights reserved.
* This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html
*/
package MV3500Cohort2019JulySeptember.homework4.Yurkovich;
import edu.nps.moves.dis7.util.playerrecorder.Player;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
/**
* PduSaver.java created on Aug 21, 2019
* MOVES Institute Naval Postgraduate School, Monterey, CA, USA www.nps.edu
*
* @author Mike Bailey, jmbailey@nps.edu
* @version $Id$
*/
public class PduReaderPlayer
{
private final static String DEFAULT_OUTPUTDIR = "pduLog";
private final static String MCAST_ADDR = "239.1.2.3";
private final static int DIS_PORT = 3000;
private enum mystate
{
RUNNING,
PAUSED;
}
public static void main(String[] args)
{
String outDir = DEFAULT_OUTPUTDIR;
String mcast = MCAST_ADDR;
int port = DIS_PORT;
System.out.println("DisExamplesOpenDis7.PduReaderPlayer started...");
switch (args.length) {
case 0:
break;
case 1:
outDir = args[0];
break;
case 3:
outDir = args[0];
mcast = args[1];
port = Integer.parseInt(args[2]);
break;
default:
System.err.println("Usage: PduReaderPlayer() or PduReaderPlayer(\"outputdir\") or PduReaderPlayer(\"outputdir\",\"multicast address\", ipPort");
System.exit(1);
}
System.out.println("Beginning pdu playback from directory " + outDir);
try {
Player player = new Player(mcast, port, new File(outDir).toPath());
player.startResume();
mystate state = mystate.RUNNING;
Scanner scan = new Scanner(System.in);
while (true) {
System.out.println("Type p/enter to pause, r/enter to resume, q/enter to quit");
String line = scan.nextLine();
if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) {
player.stopPause();
state = mystate.PAUSED;
}
else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) {
player.startResume();
state = mystate.RUNNING;
}
else if (line.equalsIgnoreCase("q")) {
player.end();
break;
}
}
System.out.println("Ending pdu files playback for directory " + outDir);
System.out.println("DisExamplesOpenDis7.PduReaderPlayer complete.");
System.exit(0); // not sure why this is necessary with Netbeans...
}
catch (IOException ex) {
System.err.println("Exception: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage());
}
}
}
Invocation instructions:
0. check for existence of recorded files in directory, e.g. examples/pduLog/Pdusave.dislog
1. first running AllPduReceiver can confirm that DIS replay actually occurs.
2. run or debug PduReaderPlayer.java
3. Type p/enter to pause, r/enter to resume, q/enter to quit
Program response:
===================================================
DisExamplesOpenDis7.PduReaderPlayer started...
Beginning pdu playback from directory pduLog
Replaying DIS logs.
Replaying C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\Pdusave.dislog
Beginning of DIS capture file, Pdusave.dislog.
Type p/enter to pause, r/enter to resume, q/enter to quit
72
End of replay from Pdusave.dislog
End of DIS capture file, Pdusave.dislog.
q
Ending pdu files playback for directory pduLog
DisExamplesOpenDis7.PduReaderPlayer complete.
BUILD SUCCESSFUL (total time: 20 seconds)
\ No newline at end of file
# DIS Protocol Examples using Open-DIS-Java Library v7
TODO under development!
Course examples using the [Open-DIS-Java](https://github.com/open-dis/open-dis-java) library are presented in this package.
See [specifications](../../../specifications) directory to obtain reference copies of DIS and RPRFOM standards.
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