Skip to content
Snippets Groups Projects
Commit 3c6ce3bf authored by brutzman's avatar brutzman
Browse files

better comments, clear warnings

parent 9a8f739d
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,10 @@ import edu.nps.moves.dis7.enumerations.PlatformDomain; ...@@ -19,7 +19,10 @@ import edu.nps.moves.dis7.enumerations.PlatformDomain;
*/ */
public class EspduSender public class EspduSender
{ {
public static final int NUMBER_TO_SEND = 5; // 5000 /**
* Putting any upper limit on # packets sent avoids possibility of non-terminating infinite loops that continue sending packets.
*/
public static final int NUMBER_PDUS_TO_SEND = 5; // 5000
/** /**
* Default multicast group address we send on. * Default multicast group address we send on.
...@@ -29,7 +32,7 @@ public class EspduSender ...@@ -29,7 +32,7 @@ public class EspduSender
/** /**
* Default multicast port used, matches Wireshark DIS capture default * Default multicast port used, matches Wireshark DIS capture default
*/ */
public static final int DEFAULT_MULTICAST_PORT = 3000; public static final int DEFAULT_MULTICAST_PORT = 3000;
public enum NetworkMode { public enum NetworkMode {
UNICAST, MULTICAST, BROADCAST UNICAST, MULTICAST, BROADCAST
...@@ -46,6 +49,7 @@ public class EspduSender ...@@ -46,6 +49,7 @@ public class EspduSender
* *
* @param args * @param args
*/ */
@SuppressWarnings("SleepWhileInLoop") // allows Thread.sleep(value) without warning in code
public static void main(String args[]) public static void main(String args[])
{ {
System.out.println("DisExamplesOpenDis7.EspduSender started..."); System.out.println("DisExamplesOpenDis7.EspduSender started...");
...@@ -157,21 +161,22 @@ public class EspduSender ...@@ -157,21 +161,22 @@ public class EspduSender
// Manual way: // Manual way:
/* /*
EntityType entityType = espdu.getEntityType();
entityType.setEntityKind(EntityKind.PLATFORM); //(short) 1); // Platform (vs lifeform, munition, sensor, etc.)
entityType.setCountry(Country.UNITED_STATES_OF_AMERICA_USA); //225); // USA
entityType.setDomain(Domain.inst(PlatformDomain.LAND)); // Land (vs air, surface, subsurface, space)
entityType.setCategory((byte) 1); // Tank
entityType.setSubCategory((byte) 1); // M1 Abrams
entityType.setSpecific((byte) 3); // M1A2 Abrams
*/ */
EntityType entityType = espdu.getEntityType();
entityType.setEntityKind(EntityKind.PLATFORM); //(short) 1); // Platform (vs lifeform, munition, sensor, etc.)
entityType.setCountry(Country.UNITED_STATES_OF_AMERICA_USA); // 225 USA
entityType.setDomain(Domain.inst(PlatformDomain.LAND)); // Land (vs air, surface, subsurface, space)
entityType.setCategory ((byte) 1); // Tank
entityType.setSubCategory((byte) 1); // M1 Abrams
entityType.setSpecific ((byte) 3); // M1A2 Abrams
Set<InetAddress> broadcastAddresses; Set<InetAddress> broadcastAddresses;
try // Loop through sending N ESPDUs try // Loop through sending N ESPDUs
{ {
System.out.println("Sending " + NUMBER_TO_SEND + " sets of packets:"); // + address.toString() System.out.println("Sending " + NUMBER_PDUS_TO_SEND + " sets of packets:"); // + address.toString()
for (int index = 0; index < NUMBER_TO_SEND; index++) { for (int index = 0; index < NUMBER_PDUS_TO_SEND; index++) {
// DIS time is a pain in the uh, neck. DIS time units are 2^31-1 units per // DIS time is a pain in the uh, neck. DIS time units are 2^31-1 units per
// hour, and time is set to DIS time units from the top of the hour. // hour, and time is set to DIS time units from the top of the hour.
// This means that if you start sending just before the top of the hour // This means that if you start sending just before the top of the hour
......
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