|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfaa.tg.util.concurrency.RepeatingStrand
faa.tg.dis.PduFactory
faa.tg.dis.TgPduFactory
public class TgPduFactory
The TgPduFactory creates ProtocolDataUnits. TgPduFactory listens for aircraft and simulation events and generates the appropriate PDUs. These PDUs packaged in datagram packets and sent to the DIS_Transmitter. The TgPduFactory also reads PDU packets from the DIS_Receiver, constructs the appropriate PDUs and sends them to any registered PduListeners.See the source: TgPduFactory.java
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class faa.tg.util.concurrency.RepeatingStrand |
|---|
RepeatingStrand.ThreadFactory |
| Field Summary | |
|---|---|
private static Port |
BASE
|
static java.lang.String |
CVS_VERSION_ID
The CVS Version ID |
private short |
disApp
DIS application id (host) |
private short |
disId
DIS id (chassis) |
private short |
disSite
DIS site id (subnet) |
private DIS_UdpTransmitter |
distx
The DIS Transmitter for this scenario. |
private short |
entityId
Next available entity id. |
private PduOutputStream |
espduOs
The PDU output stream used to build and queue up Entity State PDUs. |
private boolean |
isRunning
VERY BAD. |
private PduOutputStream |
pduOs
The PDU output stream used to build misc. |
private int |
pduPerPacket
Maximum number of Entity State PDUs in a disPacket |
private PduOutputStream |
pfpduOs
The PDU output stream used to build and queue up Pre Flight PDUs. |
private Scenario |
scenario
|
private double |
simTime
The simulation time as a double. |
| Constructor Summary | |
|---|---|
TgPduFactory(DIS_UdpTransmitter distx,
DIS_Receiver disrx,
Scenario scenario)
Constructor TgPduFactory |
|
TgPduFactory(java.net.InetAddress sendAddress,
Port disSendPort,
Port disRecvPort,
Scenario scenario)
Constructor TgPduFactory if you what to transmitt and receive on different ports (as XPVDSupport needs to) |
|
TgPduFactory(java.net.InetAddress sendAddress,
Port disPort,
Scenario scenario)
construct the TgPduFactory. |
|
| Method Summary | |
|---|---|
EntityStatePDU |
buildEntityStatePDU(Aircraft ac)
Builds an EnityStatePDU for an aircraft. |
PreFlightPDU |
buildPreFlightPDU(Flight flt)
Builds a PreFlightPDU for a Flight. |
StartPDU |
buildStartPDU()
Construct and return a StartPDU. |
StopPDU |
buildStopPDU(byte reason)
Construct and return a StopPDU with the specified reason code. |
DIS_UdpTransmitter |
getTransmitter()
Method getTransmitter ... |
void |
handleComputeCompleteEvent(ComputeCompleteEvent cce)
This method flushes any flights to the wire |
void |
handleEndOfEpochEvent(EndOfEpochEvent eoee)
Method handleEndOfEpochEvent ... |
void |
handleExecutiveEvent(ExecutiveEvent ee)
Transmits start/stop/pause pdus |
void |
handleFlightActivatedEvent(FlightActivatedEvent fae)
Registers the DIS_Transmitter to receive UpdateCompleteEvents and builds a PreFlightPDU for the flight. |
void |
handleFlightTerminatedEvent(FlightTerminatedEvent ft)
Builds an EntityStatePDU for the flight with the terminate bit set. |
void |
handlePdu(ProtocolDataUnit pdu)
Decodes a portion of a byte array into a Protocol Data Unit. |
void |
handlePreFlightRequestPDU(PreFlightRequestPDU pfrpdu)
Builds and sends PreFlightPDUs for the requested flights. |
void |
handleUpdateCompleteEvent(UpdateCompleteEvent uce)
Builds an EntityStatePDU for an Aircraft and writes it to a PduOutputStream, triggered by the UpdateCompleteEvent. |
private void |
registerForActiveAircraft()
xpvdSupport constructs a PduFactory after the start of the sim so collect active aircraft |
void |
sendRemainingPDUs(PduOutputStream pos)
Sends any remaining PDUs to the DIS Transmitter. |
void |
write2Pos(ProtocolDataUnit pdu)
Writes a PDU to the pduOs output stream. |
private void |
write2Pos(ProtocolDataUnit pdu,
PduOutputStream pos)
Writes a PDU to a PduOutputStream. |
| Methods inherited from class faa.tg.dis.PduFactory |
|---|
addPduListener, isCommunicating, repeatedAction, stopCleanup |
| Methods inherited from class faa.tg.util.concurrency.RepeatingStrand |
|---|
defaultName, incrementingName, isActive, isAlive, resume, run, runlimiter, runlimiter, sameName, start, startSetup, stop, suspend |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CVS_VERSION_ID
private static final Port BASE
private DIS_UdpTransmitter distx
private short disSite
private short disApp
private short disId
private int pduPerPacket
private double simTime
private short entityId
private PduOutputStream espduOs
private PduOutputStream pfpduOs
private PduOutputStream pduOs
private boolean isRunning
private final Scenario scenario
| Constructor Detail |
|---|
public TgPduFactory(java.net.InetAddress sendAddress,
Port disPort,
Scenario scenario)
sendAddress - the address to send the PDU to ie. 172.26.64.255 or unicastdisPort - the port to send and receive PDU's onscenario - the Scenario to attach to.
public TgPduFactory(DIS_UdpTransmitter distx,
DIS_Receiver disrx,
Scenario scenario)
distx - disrx - scenario - the Scenario to attach to.
public TgPduFactory(java.net.InetAddress sendAddress,
Port disSendPort,
Port disRecvPort,
Scenario scenario)
sendAddress - the address to send the PDU to ie. 172.26.64.255 or unicastdisSendPort - the port to send ondisRecvPort - the port to receive PDU's onscenario - the Scenario to attach to.| Method Detail |
|---|
private void registerForActiveAircraft()
public DIS_UdpTransmitter getTransmitter()
public void handlePdu(ProtocolDataUnit pdu)
handlePdu in interface PduListenerthe - bytes of the PDU
UnrecognizedPduTypeExceptionpublic PreFlightPDU buildPreFlightPDU(Flight flt)
flt - Flight to build PDU from.
public EntityStatePDU buildEntityStatePDU(Aircraft ac)
ac - the aircraft to get the entity state of.
public StartPDU buildStartPDU()
public StopPDU buildStopPDU(byte reason)
reason - code. Constant in StopPDU class.
public void handleExecutiveEvent(ExecutiveEvent ee)
handleExecutiveEvent in interface ExecutiveEventListener<ExecutiveEvent>ee - the Executive event start/stop/pausepublic void handleComputeCompleteEvent(ComputeCompleteEvent cce)
handleComputeCompleteEvent in interface ComputeCompleteListenercce - public void handleEndOfEpochEvent(EndOfEpochEvent eoee)
handleEndOfEpochEvent in interface EndOfEpochListenereoee - public void handleFlightActivatedEvent(FlightActivatedEvent fae)
handleFlightActivatedEvent in interface FlightActivatedListenerfae - FlightActivatedEventpublic void handleFlightTerminatedEvent(FlightTerminatedEvent ft)
handleFlightTerminatedEvent in interface FlightTerminatedListenerft - public void handlePreFlightRequestPDU(PreFlightRequestPDU pfrpdu)
pfrpdu - public void handleUpdateCompleteEvent(UpdateCompleteEvent uce)
handleUpdateCompleteEvent in interface UpdateCompleteListeneruce - An UpdateCompleteEventUpdateCompleteEventpublic void write2Pos(ProtocolDataUnit pdu)
pdu -
private void write2Pos(ProtocolDataUnit pdu,
PduOutputStream pos)
pdu - pos - public void sendRemainingPDUs(PduOutputStream pos)
pos -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||