Package nl.tno.imb
Class TEventEntry
java.lang.Object
nl.tno.imb.TEventEntry
public class TEventEntry extends Object
This class implements the events that can be send and received over the IMB framework.
Handlers can be attached to events that get called when specified events are received.
Handlers can be attached to events that get called when specified events are received.
- Author:
- hans.cornelissen@tno.nl
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTEventEntry.TLogLeveldefines the type of log entry to sendstatic interfaceTEventEntry.TOnBufferOverride dispatch to implement a buffer event handlerstatic interfaceTEventEntry.TOnChangeFederationOverride dispatch to implement a federation change handlerstatic interfaceTEventEntry.TOnChangeObjectOverride dispatch to implement a change object event handlerstatic interfaceTEventEntry.TOnChangeObjectDataOverride dispatch to implement a change object data event handlerstatic interfaceTEventEntry.TOnChildEventOverride dispatch to implement a handler for hub child event creation eventsstatic interfaceTEventEntry.TOnFocusOverride dispatch to implement a focus event handlerstatic interfaceTEventEntry.TOnNormalEventOverride dispatch to implement a normal event handlerstatic interfaceTEventEntry.TOnOtherEventOverride dispatch to implement a event handler for non-standard eventsstatic interfaceTEventEntry.TOnStreamCreateOverride dispatch to implement a handler of received streams, creating the local streamstatic interfaceTEventEntry.TOnStreamEndOverride dispatch to implement a handler of received streams, action on end of streamstatic interfaceTEventEntry.TOnSubAndPubEventstatic interfaceTEventEntry.TOnTimerCmdOverride dispatch to implement a timer command handler for commands reset/start/stopstatic interfaceTEventEntry.TOnTimerTickOverride dispatch to implement a timer tick handler -
Field Summary
Fields Modifier and Type Field Description static intACTION_CHANGEsignal an object change: an existing object has changedstatic intACTION_DELETEsignal an object change: an object is deletedstatic intACTION_NEWsignal an object change: a new object is createdstatic intEK_BUFFERevent kind: buffer eventstatic intEK_CHANGE_OBJECT_DATA_EVENTevent kind: change object including changed datastatic intEK_CHANGE_OBJECT_EVENTevent kind: change objectstatic intEK_CHILD_EVENT_ADDevent kind: a child event was createdstatic intEK_CHILD_EVENT_REMOVEevent kind: a child event was removedstatic intEK_LOG_WRITELNevent kind: send a line to the logstatic intEK_NORMAL_EVENTevent kind: normal eventstatic intEK_STREAM_BODYevent kind: body of a streamstatic intEK_STREAM_HEADERevent kind: header of a streamstatic intEK_STREAM_TAILevent kind: end of a streamstatic intEK_TIMER_ACKNOWLEDGEevent kind: acknowledge timer tickstatic intEK_TIMER_ACKNOWLEDGE_LIST_ADDevent kind: add client to the acknowledge list of a timerstatic intEK_TIMER_ACKNOWLEDGE_LIST_REMOVEevent kind: remove client from the acknowledge list of a timerstatic intEK_TIMER_CANCELevent kind: cancel/remove a running timerstatic intEK_TIMER_PREPAREevent kind: reset a timerstatic intEK_TIMER_SET_SPEEDevent kind: set the relative speed of the timerstatic intEK_TIMER_STARTevent kind: start or continue a timerstatic intEK_TIMER_STATUS_REQUESTevent kind: request status update of a timerstatic intEK_TIMER_STOPevent kind: stop a running timerstatic intEK_TIMER_TICKevent kind: timer tickintIDThe local ID related to this eventTEventEntry.TOnBufferonBufferHandler to be called on receive of a buffer eventTEventEntry.TOnChangeFederationonChangeFederationHandler to be called on receive of a federation change eventTEventEntry.TOnChangeObjectonChangeObjectHandler to be called on receive of a change object eventTEventEntry.TOnChangeObjectDataonChangeObjectDataHandler to be called on receive of a change object with data eventTEventEntry.TOnChildEventonChildEventHandler to be called on receive of a child add/remove eventTEventEntry.TOnFocusonFocusHandler to be called on receive of a focus eventTEventEntry.TOnNormalEventonNormalEventHandler to be called on receive of a normal eventTEventEntry.TOnOtherEventonOtherEventHandler to be called on receive of an unhandled eventTEventEntry.TOnStreamCreateonStreamCreateHandler to be called on receive of a stream header eventTEventEntry.TOnStreamEndonStreamEndHandler to be called on receive of a stream tail eventTEventEntry.TOnSubAndPubEventonSubAndPubTEventEntry.TOnTimerCmdonTimerCmdHandler to be called on receive of a timer command reset/start/stopTEventEntry.TOnTimerTickonTimerTickHandler to be called on receive of a timer tick eventstatic intTRC_INFINITEno limit on the number of timer events to send -
Method Summary
Modifier and Type Method Description voidcopyHandlersFrom(TEventEntry aEventEntry)StringgetEventName()Returns the fully qualified name of this eventStringgetShortEventName()booleanisPublished()Returns true if this event is publishedbooleanisSubscribed()Returns true if this event is subscribedintlogWriteLn(String aLine, TEventEntry.TLogLevel aLevel)Send a line to the central framework logbooleanpublishers()intsignalBuffer(int aBufferID, byte[] aBuffer)Send a buffer event to the frameworkintsignalBuffer(int aBufferID, byte[] aBuffer, int aEventFlags)Send a buffer event to the frameworkintsignalChangeObject(int aAction, int aObjectID, String aAttribute)Send a change object event to the frameworkintsignalEvent(int aEventKind, byte[] aEventPayload)Send an event to the frameworkintsignalStream(String aStreamName, InputStream aStream)Send a stream to the frameworkbooleansubscribers()inttimerAcknowledge(String aTimerName, String aClientName, int aProposedTimeStep)Acknowledge a timer tick.
All clients on the timer acknowledge list must send an acknowledge on each timer tick for the timer to advance.inttimerAcknowledgeAdd(String aTimerName, String aClientName)Add a client name to the acknowledge list of a timer.
All entries in this list must send an acknowledge on each timer tick for the timer to advance.inttimerAcknowledgeRemove(String aTimerName, String aClientName)Remove a client name from the acknowledge list of a timer.
All entries in this list must send an acknowledge on each timer tick for the timer to advance.inttimerCancel(String aTimerName)Cancel a running timer; the timer is destroyed.inttimerCreate(String aTimerName, long aStartTimeUTCorRelFT, int aResolutionms, double aSpeedFactor)Create a timer on the connected HUBinttimerCreate(String aTimerName, long aStartTimeUTCorRelFT, int aResolutionms, double aSpeedFactor, int aRepeatCount)Create a timer on the connected HUBinttimerPrepare(String aTimerName)Prepare a timer; the timer is stopped and reset to an initial stateinttimerSetSpeed(String aTimerName, double aSpeedFactor)Set the relative running speed of the timerinttimerStart(String aTimerName)Start or continue the timerinttimerStop(String aTimerName)Stop or pause the timer
-
Field Details
-
EK_CHANGE_OBJECT_EVENT
public static final int EK_CHANGE_OBJECT_EVENTevent kind: change object- See Also:
- Constant Field Values
-
EK_STREAM_HEADER
public static final int EK_STREAM_HEADERevent kind: header of a stream- See Also:
- Constant Field Values
-
EK_STREAM_BODY
public static final int EK_STREAM_BODYevent kind: body of a stream- See Also:
- Constant Field Values
-
EK_STREAM_TAIL
public static final int EK_STREAM_TAILevent kind: end of a stream- See Also:
- Constant Field Values
-
EK_BUFFER
public static final int EK_BUFFERevent kind: buffer event- See Also:
- Constant Field Values
-
EK_NORMAL_EVENT
public static final int EK_NORMAL_EVENTevent kind: normal event- See Also:
- Constant Field Values
-
EK_CHANGE_OBJECT_DATA_EVENT
public static final int EK_CHANGE_OBJECT_DATA_EVENTevent kind: change object including changed data- See Also:
- Constant Field Values
-
EK_CHILD_EVENT_ADD
public static final int EK_CHILD_EVENT_ADDevent kind: a child event was created- See Also:
- Constant Field Values
-
EK_CHILD_EVENT_REMOVE
public static final int EK_CHILD_EVENT_REMOVEevent kind: a child event was removed- See Also:
- Constant Field Values
-
EK_LOG_WRITELN
public static final int EK_LOG_WRITELNevent kind: send a line to the log- See Also:
- Constant Field Values
-
EK_TIMER_CANCEL
public static final int EK_TIMER_CANCELevent kind: cancel/remove a running timer- See Also:
- Constant Field Values
-
EK_TIMER_PREPARE
public static final int EK_TIMER_PREPAREevent kind: reset a timer- See Also:
- Constant Field Values
-
EK_TIMER_START
public static final int EK_TIMER_STARTevent kind: start or continue a timer- See Also:
- Constant Field Values
-
EK_TIMER_STOP
public static final int EK_TIMER_STOPevent kind: stop a running timer- See Also:
- Constant Field Values
-
EK_TIMER_ACKNOWLEDGE_LIST_ADD
public static final int EK_TIMER_ACKNOWLEDGE_LIST_ADDevent kind: add client to the acknowledge list of a timer- See Also:
- Constant Field Values
-
EK_TIMER_ACKNOWLEDGE_LIST_REMOVE
public static final int EK_TIMER_ACKNOWLEDGE_LIST_REMOVEevent kind: remove client from the acknowledge list of a timer- See Also:
- Constant Field Values
-
EK_TIMER_SET_SPEED
public static final int EK_TIMER_SET_SPEEDevent kind: set the relative speed of the timer- See Also:
- Constant Field Values
-
EK_TIMER_TICK
public static final int EK_TIMER_TICKevent kind: timer tick- See Also:
- Constant Field Values
-
EK_TIMER_ACKNOWLEDGE
public static final int EK_TIMER_ACKNOWLEDGEevent kind: acknowledge timer tick- See Also:
- Constant Field Values
-
EK_TIMER_STATUS_REQUEST
public static final int EK_TIMER_STATUS_REQUESTevent kind: request status update of a timer- See Also:
- Constant Field Values
-
TRC_INFINITE
public static final int TRC_INFINITEno limit on the number of timer events to send- See Also:
- Constant Field Values
-
ID
public final int IDThe local ID related to this event -
onChangeObject
Handler to be called on receive of a change object event -
onFocus
Handler to be called on receive of a focus event -
onNormalEvent
Handler to be called on receive of a normal event -
onBuffer
Handler to be called on receive of a buffer event -
onStreamCreate
Handler to be called on receive of a stream header event -
onStreamEnd
Handler to be called on receive of a stream tail event -
onChangeFederation
Handler to be called on receive of a federation change event -
onTimerTick
Handler to be called on receive of a timer tick event -
onTimerCmd
Handler to be called on receive of a timer command reset/start/stop -
onChildEvent
Handler to be called on receive of a child add/remove event -
onChangeObjectData
Handler to be called on receive of a change object with data event -
onSubAndPub
-
onOtherEvent
Handler to be called on receive of an unhandled event -
ACTION_NEW
public static final int ACTION_NEWsignal an object change: a new object is created- See Also:
- Constant Field Values
-
ACTION_DELETE
public static final int ACTION_DELETEsignal an object change: an object is deleted- See Also:
- Constant Field Values
-
ACTION_CHANGE
public static final int ACTION_CHANGEsignal an object change: an existing object has changed- See Also:
- Constant Field Values
-
-
Method Details
-
subscribers
public boolean subscribers() -
publishers
public boolean publishers() -
getEventName
Returns the fully qualified name of this event -
getShortEventName
-
isPublished
public boolean isPublished()Returns true if this event is published -
isSubscribed
public boolean isSubscribed()Returns true if this event is subscribed -
copyHandlersFrom
-
signalEvent
public int signalEvent(int aEventKind, byte[] aEventPayload)Send an event to the framework- Parameters:
aEventKind- int;aEventPayload- byte[];- Returns:
- status of the request (TConnection.ICE_* constants)
-
signalBuffer
public int signalBuffer(int aBufferID, byte[] aBuffer)Send a buffer event to the framework- Parameters:
aBufferID- int; self chosen ID to separate streams of buffer eventsaBuffer- byte[];- Returns:
- status of the request (TConnection.ICE_* constants)
-
signalBuffer
public int signalBuffer(int aBufferID, byte[] aBuffer, int aEventFlags)Send a buffer event to the framework- Parameters:
aBufferID- int; self chosen ID to separate streams of buffer eventsaBuffer- byte[];aEventFlags- flags for special processing within the hub; not fully implemented, use 0- Returns:
- status of the request (TConnection.ICE_* constants)
-
signalStream
Send a stream to the framework- Parameters:
aStreamName- String;aStream- InputStream;- Returns:
- status of the request (TConnection.ICE_* constants)
-
signalChangeObject
Send a change object event to the framework- Parameters:
aAction- int; see ACTION_* constantsaObjectID- int; ID of the object that has changedaAttribute- String; optional name of the attribute that has changed- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerCreate
public int timerCreate(String aTimerName, long aStartTimeUTCorRelFT, int aResolutionms, double aSpeedFactor)Create a timer on the connected HUB- Parameters:
aTimerName- String; unique name of the timer within this eventaStartTimeUTCorRelFT- long; 0 means now<br> larger than 0 means in absolute system time (UTC)
less than 0 means system timer relative to nowaResolutionms- int; the resolution of a timer tick (step) in millisecondsaSpeedFactor- double; 1 means same speed as real time, 0 means the timer runs in simulation time- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerCreate
public int timerCreate(String aTimerName, long aStartTimeUTCorRelFT, int aResolutionms, double aSpeedFactor, int aRepeatCount)Create a timer on the connected HUB- Parameters:
aTimerName- String; unique name of the timer within this eventaStartTimeUTCorRelFT- long; 0 means now<br> larger than 0 means in absolute system time (UTC)
less than 0 means system timer relative to nowaResolutionms- int; the resolution of a timer tick (step) in millisecondsaSpeedFactor- double; 1 means same speed as real time, 0 means the timer runs in simulation timeaRepeatCount- int; number of timer the timer must send a timer tick (TRC_INFINITE for infinite)- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerCancel
Cancel a running timer; the timer is destroyed.- Parameters:
aTimerName- String;- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerPrepare
Prepare a timer; the timer is stopped and reset to an initial state- Parameters:
aTimerName- String;- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerStart
Start or continue the timer- Parameters:
aTimerName- String;- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerStop
Stop or pause the timer- Parameters:
aTimerName- String;- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerSetSpeed
Set the relative running speed of the timer- Parameters:
aTimerName- String;aSpeedFactor- double; 1 means the timer is running in real time, 0 means the timer runs in simulation time- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerAcknowledgeAdd
Add a client name to the acknowledge list of a timer.
All entries in this list must send an acknowledge on each timer tick for the timer to advance.- Parameters:
aTimerName- String;aClientName- String;- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerAcknowledgeRemove
Remove a client name from the acknowledge list of a timer.
All entries in this list must send an acknowledge on each timer tick for the timer to advance.- Parameters:
aTimerName- String;aClientName- String;- Returns:
- status of the request (TConnection.ICE_* constants)
-
timerAcknowledge
Acknowledge a timer tick.
All clients on the timer acknowledge list must send an acknowledge on each timer tick for the timer to advance.- Parameters:
aTimerName- String;aClientName- String;aProposedTimeStep- int; clients can specify the next step that they wish. The overall lowest next step is used if the timer is not running in real time- Returns:
- status of the request (TConnection.ICE_* constants)
-
logWriteLn
Send a line to the central framework log- Parameters:
aLine- String; text to enter into the logaLevel- TLogLevel; severity of the entry to log. See TLogLevel for values.- Returns:
- status of the request (TConnection.ICE_* constants)
-