Package edu.nps.moves.dis7.utilities
Class PduFactory
java.lang.Object
edu.nps.moves.dis7.utilities.PduFactory
PduFactory.java created on Jun 14, 2019
MOVES Institute Naval Postgraduate School, Monterey, CA, USA www.nps.edu
A class to 1) create new Pdus (for sending purposes) and 2) create Pdus from byte streams received from the net.
For the first use case, pdus will be initialized with country, exerciseId, siteId, applicationId and timestamp format, matching the parameters passed to the constructor. For no arg constructor, the defaults of USA, 1, 2, 3, and absolute timestamp are used.
- Author:
- Mike Bailey, jmbailey@nps.edu
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a PduFactory using defaults for country (USA), exerciseId (2), application (3) and absolute timestamps.PduFactory
(Country country, byte exerciseId, short siteId, short applicationId, DisTime.TimestampStyle timestampStyle) Create a PduFactory which creates pdus using the specified default values.PduFactory
(DisTime.TimestampStyle newTimestampStyle) Create a PduFactory using newTimestampStyle. -
Method Summary
Modifier and TypeMethodDescriptioncreatePdu
(byte[] data) PDU builder.createPdu
(DisPduType pduType) Create an empty PDU of the given typecreatePdu
(ByteBuffer byteBuffer) PDU builder.getPdusFromBundle
(byte[] data, int length) Decodes datagram contents with bundled PDUs.accessor to report valuestatic void
If invoked, notify location of unit test (which is located outside of the jar distribution).Create an Acknowledge PDU
IEEE Std 1278.1-2012, 5.6.5.6Create an Acknowledge-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.6Create an Action Request PDU
IEEE Std 1278.1-2012, 5.6.5.7Create an Action Request-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.7Create an Action Response PDU
IEEE Std 1278.1-2012, 5.6.5.8Create an Action Response-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.8Create a Designator PDU
IEEE Std 1278.1-2012, 5.7.4Create an Appearance PDU
IEEE Std 1278.1-2012, 9.4.3Create an Areal Object State PDU
IEEE Std 1278.1-2012, 5.11.3.4Create an Articulated Parts PDU
IEEE Std 1278.1-2012, 9.4.4Create an Attribute PDU
IEEE Std 1278.1-2012, 5.3.6Create a Collision-Elastic PDU
IEEE Std 1278.1-2012, 5.3.4Create a Collision PDU
IEEE Std 1278.1-2012, 5.3.3Create a Comment PDU
IEEE Std 1278.1-2012, 5.6.5.13makeCommentPdu
(VariableRecordType typ, String... comments) Create a Comment PDU containing the given String(s) and variable record typemakeCommentPdu
(String... comments) Create a Comment PDU containing the given String(s), variable record type = "OTHER"Create a Comment-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.13makeCommentReliablePdu
(VariableRecordType typ, String... comments) Create a CommentR PDU containing the given String(s) and variable record typemakeCommentReliablePdu
(String... comments) Create a Comment-R PDU containing the given String(s), variable record type = "OTHER"Create a Create Entity PDU
IEEE Std 1278.1-2012, 5.6.5.2Create a Create Entity-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.2Create a Data PDU
IEEE Std 1278.1-2012, 5.6.5.11Create a Data Query PDU
IEEE Std 1278.1-2012, 5.6.5.9Create a Data Query-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.9Create a Data-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.11Create a Designator PDU
IEEE Std 1278.1-2012, 5.7.4Create a Detonation PDU
IEEE Std 1278.1-2012, 5.4.4Create a Directed Energy (DE) Fire PDU
IEEE Std 1278.1-2012, 5.4.5Create a Electromagnetic Emission (EE) PDU
IEEE Std 1278.1-2012, 5.7.3Create a Collision-Elastic PDU
IEEE Std 1278.1-2012, 5.3.3Create an Entity State PDU
IEEE Std 1278.1-2012, 5.3.2Create a Entity State Update PDU
IEEE Std 1278.1-2012, 5.3.5Create an Environmental Process PDU
IEEE Std 1278.1-2012, 5.11.2.2Create an Event Report PDU
IEEE Std 1278.1-2012, 5.6.5.12Create an Event Report-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.12Create a Fire PDU
IEEE Std 1278.1-2012, 5.4.3Create a Gridded Data PDU
IEEE Std 1278.1-2012, 5.11.2.3Create a an Identification Friend or Foe (IFF) PDU
IEEE Std 1278.1-2012, 5.7.6Create an Information Operations (IO) Action PDU
IEEE Std 1278.1-2012, 5.13.3Create an Information Operations (IO) Report PDU
IEEE Std 1278.1-2012, 5.13.4Create an Intercom Control PDU
IEEE Std 1278.1-2012, 5.8.7Create an Intercom Signal PDU
IEEE Std 1278.1-2012, 5.8.6Create an IsGroupOf PDU
IEEE Std 1278.1-2012, 5.9.3Create an IsPartOf PDU
IEEE Std 1278.1-2012, 5.9.5Create a Live Entity (LE) Detonation PDU
IEEE Std 1278.1-2012, 9.4.6Create a Live Entity (LE) Fire PDU
IEEE Std 1278.1-2012, 9.4.5Create a Linear Object State PDU
IEEE Std 1278.1-2012, 5.11.3.3Create a Minefield Data PDU
IEEE Std 1278.1-2012, 5.10.4Create a Minefield Query PDU
IEEE Std 1278.1-2012, 5.10.3Create a Minefield Response Negative Acknowledgment (NACK) PDU
IEEE Std 1278.1-2012, 5.10.5Create a Minefield State PDU
IEEE Std 1278.1-2012, 5.10.2Create a Point Object State PDU
IEEE Std 1278.1-2012, 5.11.3.2Create a Receiver PDU
IEEE Std 1278.1-2012, 5.8.5Create a Record Query-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.14Create a Record-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.16Create a Remove Entity PDU
IEEE Std 1278.1-2012, 5.6.5.3Create a Remove Entity-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.3Create a Repair Complete PDU
IEEE Std 1278.1-2012, 5.5.10Create a Repair Response PDU
IEEE Std 1278.1-2012, 5.5.11Create a Resupply Cancel PDU
IEEE Std 1278.1-2012, 5.5.8Create a Resupply Offer PDU
IEEE Std 1278.1-2012, 5.5.6Create a Resupply Received PDU
IEEE Std 1278.1-2012, 5.5.7Create a Supplemental Emission/Entity State (SEES) PDU
IEEE Std 1278.1-2012, 5.7.7Create a Service Request PDU
IEEE Std 1278.1-2012, 5.5.5Create a Set DataPDU
IEEE Std 1278.1-2012, 5.6.5.10Create a Set Data-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.10Create a Set Record-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.15Create a Signal PDU
IEEE Std 1278.1-2012, 5.7.4Create a Start Resume PDU
IEEE Std 1278.1-2012, 5.6.5.4Create a Start/Resume-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.4Create a Stop Freeze PDU
IEEE Std 1278.1-2012, 5.6.5.5Create a Stop/Freeze-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.5Create a Transfer Ownership PDU
IEEE Std 1278.1-2012, 5.9.4Create a Transmitter PDU
IEEE Std 1278.1-2012, 5.8.3Create a Time Space Position Information (TSPI) PDU
IEEE Std 1278.1-2012, 9.4.2Create a Designator PDU
IEEE Std 1278.1-2012, 5.7.4void
setTimestampStyle
(DisTime.TimestampStyle newTimestampStyle) accessor to update value
-
Constructor Details
-
PduFactory
public PduFactory()Create a PduFactory using defaults for country (USA), exerciseId (2), application (3) and absolute timestamps. -
PduFactory
Create a PduFactory using newTimestampStyle.- Parameters:
newTimestampStyle
- timeStampStyle of interest
-
PduFactory
public PduFactory(Country country, byte exerciseId, short siteId, short applicationId, DisTime.TimestampStyle timestampStyle) Create a PduFactory which creates pdus using the specified default values.- Parameters:
country
- used in EntityType and RadioType objectsexerciseId
- used in standard PDU headersiteId
- used in standard PDU headerapplicationId
- used in standard PDU headertimestampStyle
- enum to specify time stamp style (IEEE Std 1278.1-2012, 4.6)- See Also:
-
-
Method Details
-
getTimestampStyle
accessor to report value- Returns:
- current timestampStyle
-
setTimestampStyle
accessor to update value- Parameters:
newTimestampStyle
- value of interest
-
makeEntityStatePdu
Create an Entity State PDU
IEEE Std 1278.1-2012, 5.3.2- Returns:
- the new pdu
-
makeFirePdu
Create a Fire PDU
IEEE Std 1278.1-2012, 5.4.3- Returns:
- the new pdu
-
makeDetonationPdu
Create a Detonation PDU
IEEE Std 1278.1-2012, 5.4.4- Returns:
- the new pdu
-
makeCollisionPdu
Create a Collision PDU
IEEE Std 1278.1-2012, 5.3.3- Returns:
- the new pdu
-
makeServiceRequestPdu
Create a Service Request PDU
IEEE Std 1278.1-2012, 5.5.5- Returns:
- the new pdu
-
makeResupplyOfferPdu
Create a Resupply Offer PDU
IEEE Std 1278.1-2012, 5.5.6- Returns:
- the new pdu
-
makeResupplyReceivedPdu
Create a Resupply Received PDU
IEEE Std 1278.1-2012, 5.5.7- Returns:
- the new pdu
-
makeResupplyCancelPdu
Create a Resupply Cancel PDU
IEEE Std 1278.1-2012, 5.5.8- Returns:
- the new pdu
-
makeRepairCompletePdu
Create a Repair Complete PDU
IEEE Std 1278.1-2012, 5.5.10- Returns:
- the new pdu
-
makeRepairResponsePdu
Create a Repair Response PDU
IEEE Std 1278.1-2012, 5.5.11- Returns:
- the new pdu
-
makeCreateEntityPdu
Create a Create Entity PDU
IEEE Std 1278.1-2012, 5.6.5.2- Returns:
- the new pdu
-
makeRemoveEntityPdu
Create a Remove Entity PDU
IEEE Std 1278.1-2012, 5.6.5.3- Returns:
- the new pdu
-
makeStartResumePdu
Create a Start Resume PDU
IEEE Std 1278.1-2012, 5.6.5.4- Returns:
- the new pdu
-
makeStopFreezePdu
Create a Stop Freeze PDU
IEEE Std 1278.1-2012, 5.6.5.5- Returns:
- the new pdu
-
makeAcknowledgePdu
Create an Acknowledge PDU
IEEE Std 1278.1-2012, 5.6.5.6- Returns:
- the new pdu
-
makeActionRequestPdu
Create an Action Request PDU
IEEE Std 1278.1-2012, 5.6.5.7- Returns:
- the new pdu
-
makeActionResponsePdu
Create an Action Response PDU
IEEE Std 1278.1-2012, 5.6.5.8- Returns:
- the new pdu
-
makeDataQueryPdu
Create a Data Query PDU
IEEE Std 1278.1-2012, 5.6.5.9- Returns:
- the new pdu
-
makeSetDataPdu
Create a Set DataPDU
IEEE Std 1278.1-2012, 5.6.5.10- Returns:
- the new pdu
-
makeDataPdu
Create a Data PDU
IEEE Std 1278.1-2012, 5.6.5.11- Returns:
- the new pdu
-
makeEventReportPdu
Create an Event Report PDU
IEEE Std 1278.1-2012, 5.6.5.12- Returns:
- the new pdu
-
makeCommentPdu
Create a Comment PDU
IEEE Std 1278.1-2012, 5.6.5.13- Returns:
- the new pdu
-
makeCommentPdu
Create a Comment PDU containing the given String(s), variable record type = "OTHER"- Parameters:
comments
- of interest- Returns:
- the new pdu
-
makeCommentPdu
Create a Comment PDU containing the given String(s) and variable record type- Parameters:
typ
- VariableRecordTypecomments
- of interest- Returns:
- the new pdu
-
makeElectronicEmissionsPdu
Create a Electromagnetic Emission (EE) PDU
IEEE Std 1278.1-2012, 5.7.3- Returns:
- the new pdu
-
makeDesignatorPdu
Create a Designator PDU
IEEE Std 1278.1-2012, 5.7.4- Returns:
- the new pdu
-
makeTransmitterPdu
Create a Transmitter PDU
IEEE Std 1278.1-2012, 5.8.3- Returns:
- the new pdu
-
makeSignalPdu
Create a Signal PDU
IEEE Std 1278.1-2012, 5.7.4- Returns:
- the new pdu
-
makeReceiverPdu
Create a Receiver PDU
IEEE Std 1278.1-2012, 5.8.5- Returns:
- the new pdu
-
makeIffPdu
Create a an Identification Friend or Foe (IFF) PDU
IEEE Std 1278.1-2012, 5.7.6- Returns:
- the new pdu
-
makeUnderwaterAcousticPdu
Create a Designator PDU
IEEE Std 1278.1-2012, 5.7.4- Returns:
- the new pdu
-
makeSeesPdu
Create a Supplemental Emission/Entity State (SEES) PDU
IEEE Std 1278.1-2012, 5.7.7- Returns:
- the new pdu
-
makeIntercomSignalPdu
Create an Intercom Signal PDU
IEEE Std 1278.1-2012, 5.8.6- Returns:
- the new pdu
-
makeIntercomControlPdu
Create an Intercom Control PDU
IEEE Std 1278.1-2012, 5.8.7- Returns:
- the new pdu
-
makeAggregateStatePdu
Create a Designator PDU
IEEE Std 1278.1-2012, 5.7.4- Returns:
- the new pdu
-
makeIsGroupOfPdu
Create an IsGroupOf PDU
IEEE Std 1278.1-2012, 5.9.3- Returns:
- the new pdu
-
makeTransferOwnershipPdu
Create a Transfer Ownership PDU
IEEE Std 1278.1-2012, 5.9.4- Returns:
- the new pdu
-
makeIsPartOfPdu
Create an IsPartOf PDU
IEEE Std 1278.1-2012, 5.9.5- Returns:
- the new pdu
-
makeMinefieldStatePdu
Create a Minefield State PDU
IEEE Std 1278.1-2012, 5.10.2- Returns:
- the new pdu
-
makeMinefieldQueryPdu
Create a Minefield Query PDU
IEEE Std 1278.1-2012, 5.10.3- Returns:
- the new pdu
-
makeMinefieldDataPdu
Create a Minefield Data PDU
IEEE Std 1278.1-2012, 5.10.4- Returns:
- the new pdu
-
makeMinefieldResponseNackPdu
Create a Minefield Response Negative Acknowledgment (NACK) PDU
IEEE Std 1278.1-2012, 5.10.5- Returns:
- the new pdu
-
makeEnvironmentalProcessPdu
Create an Environmental Process PDU
IEEE Std 1278.1-2012, 5.11.2.2- Returns:
- the new pdu
-
makeGriddedDataPdu
Create a Gridded Data PDU
IEEE Std 1278.1-2012, 5.11.2.3- Returns:
- the new pdu
-
makePointObjectStatePdu
Create a Point Object State PDU
IEEE Std 1278.1-2012, 5.11.3.2- Returns:
- the new pdu
-
makeLinearObjectStatePdu
Create a Linear Object State PDU
IEEE Std 1278.1-2012, 5.11.3.3- Returns:
- the new pdu
-
makeArealObjectStatePdu
Create an Areal Object State PDU
IEEE Std 1278.1-2012, 5.11.3.4- Returns:
- the new pdu
-
makeTspiPdu
Create a Time Space Position Information (TSPI) PDU
IEEE Std 1278.1-2012, 9.4.2- Returns:
- the new pdu
-
makeAppearancePdu
Create an Appearance PDU
IEEE Std 1278.1-2012, 9.4.3- Returns:
- the new pdu
-
makeArticulatedPartsPdu
Create an Articulated Parts PDU
IEEE Std 1278.1-2012, 9.4.4- Returns:
- the new pdu
-
makeLEFirePdu
Create a Live Entity (LE) Fire PDU
IEEE Std 1278.1-2012, 9.4.5- Returns:
- the new pdu
-
makeLEDetonationPdu
Create a Live Entity (LE) Detonation PDU
IEEE Std 1278.1-2012, 9.4.6- Returns:
- the new pdu
-
makeCreateEntityReliablePdu
Create a Create Entity-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.2- Returns:
- the new pdu
-
makeRemoveEntityReliablePdu
Create a Remove Entity-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.3- Returns:
- the new pdu
-
makeStartResumeReliablePdu
Create a Start/Resume-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.4- Returns:
- the new pdu
-
makeStopFreezeReliablePdu
Create a Stop/Freeze-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.5- Returns:
- the new pdu
-
makeAcknowledgeReliablePdu
Create an Acknowledge-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.6- Returns:
- the new pdu
-
makeActionRequestReliablePdu
Create an Action Request-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.7- Returns:
- the new pdu
-
makeActionResponseReliablePdu
Create an Action Response-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.8- Returns:
- the new pdu
-
makeDataQueryReliablePdu
Create a Data Query-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.9- Returns:
- the new pdu
-
makeSetDataReliablePdu
Create a Set Data-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.10- Returns:
- the new pdu
-
makeDataReliablePdu
Create a Data-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.11- Returns:
- the new pdu
-
makeEventReportReliablePdu
Create an Event Report-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.12- Returns:
- the new pdu
-
makeCommentReliablePdu
Create a Comment-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.13- Returns:
- the new pdu
-
makeCommentReliablePdu
Create a Comment-R PDU containing the given String(s), variable record type = "OTHER"- Parameters:
comments
- of interest- Returns:
- the new pdu
-
makeCommentReliablePdu
Create a CommentR PDU containing the given String(s) and variable record type- Parameters:
typ
- VariableRecordTypecomments
- of interest- Returns:
- the new pdu
-
makeRecordReliablePdu
Create a Record-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.16- Returns:
- the new pdu
-
makeSetRecordReliablePdu
Create a Set Record-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.15- Returns:
- the new pdu
-
makeRecordQueryReliablePdu
Create a Record Query-R (Reliable) PDU
IEEE Std 1278.1-2012, 5.12.4.14- Returns:
- the new pdu
-
makeCollisionElasticPdu
Create a Collision-Elastic PDU
IEEE Std 1278.1-2012, 5.3.4- Returns:
- the new pdu
-
makeEntityStateUpdatePdu
Create a Entity State Update PDU
IEEE Std 1278.1-2012, 5.3.5- Returns:
- the new pdu
-
makeDirectedEnergyFirePdu
Create a Directed Energy (DE) Fire PDU
IEEE Std 1278.1-2012, 5.4.5- Returns:
- the new pdu
-
makeEntityDamageStatusPdu
Create a Collision-Elastic PDU
IEEE Std 1278.1-2012, 5.3.3- Returns:
- the new pdu
-
makeInformationOperationsActionPdu
Create an Information Operations (IO) Action PDU
IEEE Std 1278.1-2012, 5.13.3- Returns:
- the new pdu
-
makeInformationOperationsReportPdu
Create an Information Operations (IO) Report PDU
IEEE Std 1278.1-2012, 5.13.4- Returns:
- the new pdu
-
makeAttributePdu
Create an Attribute PDU
IEEE Std 1278.1-2012, 5.3.6- Returns:
- the new pdu
-
createPdu
PDU builder. Pass in an array of bytes, get the correct type of pdu back based on the PDU type field contained in the byte array.- Parameters:
data
- an array of PDU data- Returns:
- A PDU of the appropriate concrete subclass of PDU or null if there was an error
-
createPdu
PDU builder. Pass in a data buffer, get the correct type of pdu back based on the PDU type field contained in the underlying array.- Parameters:
byteBuffer
- the buffer containing PDU data to input- Returns:
- A PDU of the appropriate concrete subclass of PDU or null if there was an error
-
createPdu
Create an empty PDU of the given type- Parameters:
pduType
- PDU type to create- Returns:
- the empty pdu
-
getPdusFromBundle
Decodes datagram contents with bundled PDUs. As a performance hack DIS may include several PDUs in one datagram. Typically the max datagram size is 8K (above that it runs into some issues with the default incoming socket buffer size) but it may be more. The PDUs may be of multiple types and different lengths, so we have to step through the buffer and depend on the reported PDU length in the header. There's a lot that can go wrong. If something blows up, we return all the decoded PDUs we can.- Parameters:
data
- a large buffer filled with possible multiple PDUslength
- the size of the multiple PDU buffer- Returns:
- List of decoded PDUs
-
main
If invoked, notify location of unit test (which is located outside of the jar distribution).- Parameters:
args
- none supported
-