Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
3c6ce3bf
Commit
3c6ce3bf
authored
4 years ago
by
brutzman
Browse files
Options
Downloads
Patches
Plain Diff
better comments, clear warnings
parent
9a8f739d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/src/OpenDis7Examples/EspduSender.java
+16
-11
16 additions, 11 deletions
examples/src/OpenDis7Examples/EspduSender.java
with
16 additions
and
11 deletions
examples/src/OpenDis7Examples/EspduSender.java
+
16
−
11
View file @
3c6ce3bf
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment