mil.navy.nps.dis
Class RadioCommunicationsPduScriptNode

java.lang.Object
  |
  +--vrml.BaseNode
        |
        +--vrml.node.Script
              |
              +--mil.navy.nps.dis.RadioCommunicationsPduScriptNode
All Implemented Interfaces:
NetworkCommBadge, PduSubscriber

public class RadioCommunicationsPduScriptNode
extends Script
implements PduSubscriber, NetworkCommBadge

This Java class provides the communications interface between the radio-communications Script node (in the VRML scene) and the DIS ReceiverPdu, SignalPdu and TransmitterPdu class libraries.

Version:
1.0
Author:
Don Brutzman (http://web.nps.navy.mil/~brutzman), David W. Laflam (http://www.web3d.org/WorkingGroups/vrtp/dis-java-vrml/)
Location:
RadioCommunicationsPduScriptNode.java
web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPduScriptNode.java
www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/EspduTransform.java
Hierarchy Diagram:
History:
14 September 2000 Don Brutzman, Dave Laflam New, patterned after EspduTransform

Associated VRML/X3D files:
RAUAntennaPROTO.xml, RAUAntennaPROTO.wrl (PROTO definition)
SHFAntennaPROTO.xml, SHFAntennaPROTO.wrl (PROTO definition)
UHFAntennaPROTO.xml, UHFAntennaPROTO.wrl (PROTO definition)
AntennaWorldFortIrwin.xml, AntennaWorldFortIrwin.wrl (Example use)

Debugging notes:
System.out.println text appears in the Netscape Java console when using CosmoPlayer
See Also:
EspduTransform, EntityDispatcher, RadioCommunicationsFamily, ReceiverPdu, SignalPdu, TransmitterPdu

Field Summary
protected  SFBool active
          eventOut: recent active signalPdu's heard
protected  SFString address
          field, multicast address, or "unicast"
protected  SFVec3f antennaLocation
          VRML scene eventOut for TransmitterPdu.antennaLocation
protected  SFInt32 antennaPatternLength
          VRML scene eventOut for TransmitterPdu.antennaPatternLength
protected  SFInt32 antennaPatternType
          VRML scene eventOut for TransmitterPdu.antennaPatternType
protected  SFInt32 applicationID
          field, entityID triplet: unique application ID at that site
protected  SFInt32 cryptoKeyId
          VRML scene eventOut for TransmitterPdu.cryptoKeyId
protected  SFInt32 cryptoSytem
          VRML scene eventOut for TransmitterPdu.cryptoSytem
protected  SFInt32 data00
          VRML scene eventOut for SignalPdu.data00
protected  SFInt32 data01
          VRML scene eventOut for SignalPdu.data01
protected  SFInt32 data02
          VRML scene eventOut for SignalPdu.data02
protected  SFInt32 data03
          VRML scene eventOut for SignalPdu.data03
protected  SFInt32 data04
          VRML scene eventOut for SignalPdu.data04
protected  SFInt32 data05
          VRML scene eventOut for SignalPdu.data05
protected  SFInt32 data06
          VRML scene eventOut for SignalPdu.data06
protected  SFInt32 data07
          VRML scene eventOut for SignalPdu.data07
protected  SFInt32 data08
          VRML scene eventOut for SignalPdu.data08
protected  SFInt32 data09
          VRML scene eventOut for SignalPdu.data09
protected  SFInt32 data10
          VRML scene eventOut for SignalPdu.data10
protected  SFInt32 dataLength
          VRML scene eventOut for SignalPdu.dataLength
protected  boolean DEBUG
          When DEBUG is true, console text messages trace the internals of script operation.
protected  SFInt32 encodingScheme
          VRML scene eventOut for SignalPdu.encodingScheme
protected static EntityDispatcher entityDispatcher
           
protected static java.lang.Thread entityDispatcherThread
           
protected  SFInt32 entityID
          field, entity ID triplet: ID within that app
protected  EntityID entityIDObject
           
protected  SFInt32 frequency
          VRML scene eventOut for TransmitterPdu.frequency
protected  SFInt32 inputSource
          VRML scene eventOut for TransmitterPdu.inputSource
protected  SFInt32 lengthOfModulationParameters
          VRML scene eventOut for TransmitterPdu.lengthOfModulationParameters
protected  int MAX_DATA_PARAMETERS
          No more than 11 data elements.
protected  SFInt32 modulationTypeDetail
          VRML scene eventOut for TransmitterPdu#modulationTypeDetail
protected  SFInt32 modulationTypeMajor
          VRML scene eventOut for TransmitterPdu#modulationTypeMajor
protected  SFInt32 modulationTypeSpreadSpectrum
          VRML scene eventOut for TransmitterPdu#modulationTypeSpreadSpectrum
protected  SFInt32 modulationTypeSystem
          VRML scene eventOut for TransmitterPdu#modulationTypeSystem
protected  SFString multicastRelayHost
          field, relay host name or IP address (used only if no multicast heard)
protected  SFInt32 multicastRelayPort
          field, relay host port to connect to (used only if no multicast heard)
protected  ProtocolDataUnit nextPdu
          ProtocolDataUnit is an abstract class used to inspect each incoming PDU for type information, do not initialize per se.
protected  boolean pduFirstHeard
          Report via Java console when a PDU is first heard
protected  SFInt32 port
          field, port to listen on
protected  SFInt32 power
          VRML scene eventOut for TransmitterPdu.power
protected  SFInt32 radioEntityTypeCategory
          VRML scene eventOut for TransmitterPdu#radioEntityTypeCategory
protected  SFInt32 radioEntityTypeCountry
          VRML scene eventOut for TransmitterPdu#radioEntityTypeCountry
protected  SFInt32 radioEntityTypeDomain
          VRML scene eventOut for TransmitterPdu#radioEntityTypeDomain
protected  SFInt32 radioEntityTypeKind
          VRML scene eventOut for TransmitterPdu#radioEntityTypeKind
protected  SFInt32 radioEntityTypeNomenclature
          VRML scene eventOut for TransmitterPdu#radioEntityTypeNomenclature
protected  SFInt32 radioEntityTypeNomenclatureVersion
          VRML scene eventOut for TransmitterPdu#radioEntityTypeNomenclatureVersion
protected  SFInt32 radioID
          VRML scene eventOut for RadioCommunicationsFamily.radioID
protected  SFString radioPduType
          VRML scene field to specify which RadioCommunicationsFamily PDU is being utilized: ReceiverPdu, SignalPdu or TransmitterPdu.
protected  long readInterval
          field, how often to look for DIS PDUs.
protected  ReceiverPdu receiverPdu
          Carries receiver information among simulation participants
protected  SFFloat receiverPower
          VRML scene eventOut for ReceiverPdu.receiverPower
protected  SFInt32 receiverState
          VRML scene eventOut for ReceiverPdu.receiverState
protected  SFVec3f relativeAntennaLocation
          VRML scene eventOut for TransmitterPdu.relativeAntennaLocation
protected  SFBool rtpHeaderExpected
          field, are RTP headers expected? Only set by VRML scene at initialization (because it is a field) but can be reset at runtime if the opposite situation is encountered.
protected  SFBool rtpHeaderHeard
          eventOut, are RTP headers being heard on the wire?
protected  SFInt32 sampleRate
          VRML scene eventOut for SignalPdu.sampleRate
protected  SFInt32 samples
          VRML scene eventOut for SignalPdu.samples
protected  SignalPdu signalPdu
          Carries signal information among simulation participants
protected  SFInt32 siteID
          field, entityID triplet: site ID
protected  SecurityStrategy strategy
          Get platform-specific security strategy
protected  SFInt32 tdlType
          VRML scene eventOut for SignalPdu.tdlType
protected  SFTime timestamp
          eventOut: timestamp
protected  SFBool traceJava
          field: enable Java trace statements to console
protected  SFInt32 transmitFrequencyBandwidth
          VRML scene eventOut for TransmitterPdu.transmitFrequencyBandwidth
protected  SFInt32 transmitState
          VRML scene eventOut for TransmitterPdu.transmitState
protected  SFInt32 transmitterApplicationID
          field, entityID triplet: transmitterApplicationID (as part of transmitterEntityID member object for ReceiverPdu)
protected  SFInt32 transmitterEntityID
          field, entity ID triplet: transmitterEntityID (as part of transmitterEntityID member object for ReceiverPdu)
protected  TransmitterPdu transmitterPdu
          Carries transmitterPdu information among simulation participants
protected  SFInt32 transmitterRadioID
          VRML scene eventOut for ReceiverPdu.transmitterRadioID
protected  SFInt32 transmitterSiteID
          field, entityID triplet: transmitterSiteID (as part of transmitterEntityID member object for ReceiverPdu)
protected  long writeInterval
          field, how often to write DIS PDUs.
 
Constructor Summary
RadioCommunicationsPduScriptNode()
          Constructor that includes setting security permissions since Internet Explorer will throw a com.ms.security.SecurityExceptionEx if initialize () is called from an external source (i.e.
 
Method Summary
protected  void debug(java.lang.String pDiagnostic)
          Debugging output routine.
 boolean getDEBUG()
          Access DEBUG trace variable.
 EntityID getEntityIDObject()
          gets the entity ID, which is the unique triplet that identifies the entity, consisting of (site, application, entity) ID numbers.
 java.lang.String getName()
          Simple identifying name for the signalPdu is entityID
 void initialize()
          initialize () gets needed information for setup from the invoking scene entity and VRML browser, and also prints the values if DEBUG is true.
static void main(java.lang.String[] args)
          main method was originally intended to be used for debugging, to determine if EntityDispatcher really is sending things to us.
 void processEvent(Event event)
          This is the main method, called by the VRML scene with periodicity readInterval (or writeInterval).
 void receivePDU(ProtocolDataUnit pPDU)
          receivePDU () is called by the entity dispatcher when a PDU for the node arrives from the network.
 void setDEBUG(boolean pDEBUG)
          Modify DEBUG trace variable.
 void setEntityIDObject(EntityID pEIO)
          resets the entity ID triplet = (site, application, entity) ID numbers.
 void shutdown()
          shutdown() is called when VRML scene exits.
 void startEntityDispatcherThread()
          Simple method to launch thread because Microsoft puts security restraints on everything.
protected  void trace(java.lang.String pDiagnostic)
          Guaranteed trace output routine.
 
Methods inherited from class vrml.node.Script
eventsProcessed, getEventIn, getEventOut, getField, processEvents, toString
 
Methods inherited from class vrml.BaseNode
getBrowser, getType
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timestamp

protected SFTime timestamp
eventOut: timestamp

readInterval

protected long readInterval
field, how often to look for DIS PDUs. Units are seconds in VRML, converted to msec in Java in initialize (). readInterval=0 means no reading. Longs are used because VRML SFFloat units are seconds.

writeInterval

protected long writeInterval
field, how often to write DIS PDUs. Units are seconds in VRML, converted to msec in Java in initialize (). writeInterval=0 means no writing (which is the default). Longs are used because VRML SFFloat units are seconds.

address

protected SFString address
field, multicast address, or "unicast"

port

protected SFInt32 port
field, port to listen on

multicastRelayHost

protected SFString multicastRelayHost
field, relay host name or IP address (used only if no multicast heard)

multicastRelayPort

protected SFInt32 multicastRelayPort
field, relay host port to connect to (used only if no multicast heard)

rtpHeaderExpected

protected SFBool rtpHeaderExpected
field, are RTP headers expected? Only set by VRML scene at initialization (because it is a field) but can be reset at runtime if the opposite situation is encountered.

rtpHeaderHeard

protected SFBool rtpHeaderHeard
eventOut, are RTP headers being heard on the wire?

siteID

protected SFInt32 siteID
field, entityID triplet: site ID

applicationID

protected SFInt32 applicationID
field, entityID triplet: unique application ID at that site

entityID

protected SFInt32 entityID
field, entity ID triplet: ID within that app

radioPduType

protected SFString radioPduType
VRML scene field to specify which RadioCommunicationsFamily PDU is being utilized: ReceiverPdu, SignalPdu or TransmitterPdu.

radioID

protected SFInt32 radioID
VRML scene eventOut for RadioCommunicationsFamily.radioID

encodingScheme

protected SFInt32 encodingScheme
VRML scene eventOut for SignalPdu.encodingScheme

tdlType

protected SFInt32 tdlType
VRML scene eventOut for SignalPdu.tdlType

sampleRate

protected SFInt32 sampleRate
VRML scene eventOut for SignalPdu.sampleRate

samples

protected SFInt32 samples
VRML scene eventOut for SignalPdu.samples

dataLength

protected SFInt32 dataLength
VRML scene eventOut for SignalPdu.dataLength

data00

protected SFInt32 data00
VRML scene eventOut for SignalPdu.data00

data01

protected SFInt32 data01
VRML scene eventOut for SignalPdu.data01

data02

protected SFInt32 data02
VRML scene eventOut for SignalPdu.data02

data03

protected SFInt32 data03
VRML scene eventOut for SignalPdu.data03

data04

protected SFInt32 data04
VRML scene eventOut for SignalPdu.data04

data05

protected SFInt32 data05
VRML scene eventOut for SignalPdu.data05

data06

protected SFInt32 data06
VRML scene eventOut for SignalPdu.data06

data07

protected SFInt32 data07
VRML scene eventOut for SignalPdu.data07

data08

protected SFInt32 data08
VRML scene eventOut for SignalPdu.data08

data09

protected SFInt32 data09
VRML scene eventOut for SignalPdu.data09

data10

protected SFInt32 data10
VRML scene eventOut for SignalPdu.data10

receiverPower

protected SFFloat receiverPower
VRML scene eventOut for ReceiverPdu.receiverPower

receiverState

protected SFInt32 receiverState
VRML scene eventOut for ReceiverPdu.receiverState

transmitterSiteID

protected SFInt32 transmitterSiteID
field, entityID triplet: transmitterSiteID (as part of transmitterEntityID member object for ReceiverPdu)

transmitterApplicationID

protected SFInt32 transmitterApplicationID
field, entityID triplet: transmitterApplicationID (as part of transmitterEntityID member object for ReceiverPdu)

transmitterEntityID

protected SFInt32 transmitterEntityID
field, entity ID triplet: transmitterEntityID (as part of transmitterEntityID member object for ReceiverPdu)

transmitterRadioID

protected SFInt32 transmitterRadioID
VRML scene eventOut for ReceiverPdu.transmitterRadioID

antennaLocation

protected SFVec3f antennaLocation
VRML scene eventOut for TransmitterPdu.antennaLocation

antennaPatternLength

protected SFInt32 antennaPatternLength
VRML scene eventOut for TransmitterPdu.antennaPatternLength

antennaPatternType

protected SFInt32 antennaPatternType
VRML scene eventOut for TransmitterPdu.antennaPatternType

cryptoKeyId

protected SFInt32 cryptoKeyId
VRML scene eventOut for TransmitterPdu.cryptoKeyId

cryptoSytem

protected SFInt32 cryptoSytem
VRML scene eventOut for TransmitterPdu.cryptoSytem

frequency

protected SFInt32 frequency
VRML scene eventOut for TransmitterPdu.frequency

inputSource

protected SFInt32 inputSource
VRML scene eventOut for TransmitterPdu.inputSource

lengthOfModulationParameters

protected SFInt32 lengthOfModulationParameters
VRML scene eventOut for TransmitterPdu.lengthOfModulationParameters

modulationTypeDetail

protected SFInt32 modulationTypeDetail
VRML scene eventOut for TransmitterPdu#modulationTypeDetail

modulationTypeMajor

protected SFInt32 modulationTypeMajor
VRML scene eventOut for TransmitterPdu#modulationTypeMajor

modulationTypeSpreadSpectrum

protected SFInt32 modulationTypeSpreadSpectrum
VRML scene eventOut for TransmitterPdu#modulationTypeSpreadSpectrum

modulationTypeSystem

protected SFInt32 modulationTypeSystem
VRML scene eventOut for TransmitterPdu#modulationTypeSystem

power

protected SFInt32 power
VRML scene eventOut for TransmitterPdu.power

radioEntityTypeCategory

protected SFInt32 radioEntityTypeCategory
VRML scene eventOut for TransmitterPdu#radioEntityTypeCategory

radioEntityTypeCountry

protected SFInt32 radioEntityTypeCountry
VRML scene eventOut for TransmitterPdu#radioEntityTypeCountry

radioEntityTypeDomain

protected SFInt32 radioEntityTypeDomain
VRML scene eventOut for TransmitterPdu#radioEntityTypeDomain

radioEntityTypeKind

protected SFInt32 radioEntityTypeKind
VRML scene eventOut for TransmitterPdu#radioEntityTypeKind

radioEntityTypeNomenclature

protected SFInt32 radioEntityTypeNomenclature
VRML scene eventOut for TransmitterPdu#radioEntityTypeNomenclature

radioEntityTypeNomenclatureVersion

protected SFInt32 radioEntityTypeNomenclatureVersion
VRML scene eventOut for TransmitterPdu#radioEntityTypeNomenclatureVersion

relativeAntennaLocation

protected SFVec3f relativeAntennaLocation
VRML scene eventOut for TransmitterPdu.relativeAntennaLocation

transmitFrequencyBandwidth

protected SFInt32 transmitFrequencyBandwidth
VRML scene eventOut for TransmitterPdu.transmitFrequencyBandwidth

transmitState

protected SFInt32 transmitState
VRML scene eventOut for TransmitterPdu.transmitState

traceJava

protected SFBool traceJava
field: enable Java trace statements to console

active

protected SFBool active
eventOut: recent active signalPdu's heard

nextPdu

protected ProtocolDataUnit nextPdu
ProtocolDataUnit is an abstract class used to inspect each incoming PDU for type information, do not initialize per se.

receiverPdu

protected ReceiverPdu receiverPdu
Carries receiver information among simulation participants

signalPdu

protected SignalPdu signalPdu
Carries signal information among simulation participants

transmitterPdu

protected TransmitterPdu transmitterPdu
Carries transmitterPdu information among simulation participants

pduFirstHeard

protected boolean pduFirstHeard
Report via Java console when a PDU is first heard

entityIDObject

protected EntityID entityIDObject

entityDispatcher

protected static EntityDispatcher entityDispatcher

entityDispatcherThread

protected static java.lang.Thread entityDispatcherThread

MAX_DATA_PARAMETERS

protected final int MAX_DATA_PARAMETERS
No more than 11 data elements. This is very clumsy and needs to be replaced by an MFFloat array.

strategy

protected SecurityStrategy strategy
Get platform-specific security strategy

DEBUG

protected boolean DEBUG
When DEBUG is true, console text messages trace the internals of script operation.
Constructor Detail

RadioCommunicationsPduScriptNode

public RadioCommunicationsPduScriptNode()
Constructor that includes setting security permissions since Internet Explorer will throw a com.ms.security.SecurityExceptionEx if initialize () is called from an external source (i.e. the IE browser) and security isn't already set up. Reference: Code Signing for Java Applets by Daniel Griscom, griscom@suitable.com at http://www.suitable.com/CodeSigningCodeExp.shtml
Method Detail

getDEBUG

public boolean getDEBUG()
Access DEBUG trace variable.

setDEBUG

public void setDEBUG(boolean pDEBUG)
Modify DEBUG trace variable.

debug

protected void debug(java.lang.String pDiagnostic)
Debugging output routine. Pass in a string, and it gets printed out on the console. You can pass in strings such as "foo " + bar.getName(). Text output appears in the Java Console (CosmoPlayer browser) or in the VRML console (WorldView browser).

trace

protected void trace(java.lang.String pDiagnostic)
Guaranteed trace output routine. Pass in a string, and it gets printed out on the console. You can pass in strings such as "foo " + bar.getName(). Text output appears in the Java Console (CosmoPlayer browser) or in the VRML console (WorldView browser).

Can't be static or all entities look the same.


getName

public java.lang.String getName()
Simple identifying name for the signalPdu is entityID

initialize

public void initialize()
initialize () gets needed information for setup from the invoking scene entity and VRML browser, and also prints the values if DEBUG is true. For a good initialize () discussion, see example 3.15, pp. 95-97, "Java for 3D and VRML Worlds," Lea/Matsuda/Miyashita, New Riders Press, 1996.
Overrides:
initialize in class Script

startEntityDispatcherThread

public void startEntityDispatcherThread()
Simple method to launch thread because Microsoft puts security restraints on everything.

EntityDispatcher is static; only one copy is shared between all instances of the RadioCommunicationsPduScriptNode. If it's null the first time through here, create and thread it.

This is synchronized, since we may have N RadioCommunicationsPduScriptNodes attempting to instantiate themselves at once, all accessing this shared class variable. The synchronization prevents multiple access.

This is actually some magic code. Java keeps several mutex locks around, one for every instance of a class and one for the class itself. We can't sychronize on entityDispatcher because that's null the first time through, which will fail silently. We also can't use a java primitive type. So I created a completely arbitrary instance of an object as a class variable, and synchronize on that. It's a standin for the EntityDispatcher in a way.


receivePDU

public void receivePDU(ProtocolDataUnit pPDU)
receivePDU () is called by the entity dispatcher when a PDU for the node arrives from the network. The PDU is added to the list of PDUs that have already arrived, and is later sent up to the 3D scene graph when processEvent() is called by the VRML scene.
Specified by:
receivePDU in interface PduSubscriber

getEntityIDObject

public EntityID getEntityIDObject()
gets the entity ID, which is the unique triplet that identifies the entity, consisting of (site, application, entity) ID numbers. This is set in the VRML node, and retrieved for use here.

setEntityIDObject

public void setEntityIDObject(EntityID pEIO)
resets the entity ID triplet = (site, application, entity) ID numbers.

processEvent

public void processEvent(Event event)
This is the main method, called by the VRML scene with periodicity readInterval (or writeInterval).
Overrides:
processEvent in class Script

shutdown

public void shutdown()
shutdown() is called when VRML scene exits.
Overrides:
shutdown in class Script

main

public static void main(java.lang.String[] args)
main method was originally intended to be used for debugging, to determine if EntityDispatcher really is sending things to us.

Sigh. We can't actually use main(), since that's declared in Script, and we can't override static methods. So as an alternative we rename this something else and then call it from another class that can have a main method. Reverify that this block of code is correct if you do resurrect it.