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.
Author:
hans.cornelissen@tno.nl
  • Field Details

  • Method Details

    • subscribers

      public boolean subscribers()
    • publishers

      public boolean publishers()
    • getEventName

      public String getEventName()
      Returns the fully qualified name of this event
    • getShortEventName

      public String getShortEventName()
    • isPublished

      public boolean isPublished()
      Returns true if this event is published
    • isSubscribed

      public boolean isSubscribed()
      Returns true if this event is subscribed
    • copyHandlersFrom

      public void copyHandlersFrom​(TEventEntry aEventEntry)
    • 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 events
      aBuffer - 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 events
      aBuffer - byte[];
      aEventFlags - flags for special processing within the hub; not fully implemented, use 0
      Returns:
      status of the request (TConnection.ICE_* constants)
    • signalStream

      public int signalStream​(String aStreamName, InputStream aStream)
      Send a stream to the framework
      Parameters:
      aStreamName - String;
      aStream - InputStream;
      Returns:
      status of the request (TConnection.ICE_* constants)
    • signalChangeObject

      public int signalChangeObject​(int aAction, int aObjectID, String aAttribute)
      Send a change object event to the framework
      Parameters:
      aAction - int; see ACTION_* constants
      aObjectID - int; ID of the object that has changed
      aAttribute - 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 event
      aStartTimeUTCorRelFT - long; 0 means now<br> larger than 0 means in absolute system time (UTC)
      less than 0 means system timer relative to now
      aResolutionms - int; the resolution of a timer tick (step) in milliseconds
      aSpeedFactor - 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 event
      aStartTimeUTCorRelFT - long; 0 means now<br> larger than 0 means in absolute system time (UTC)
      less than 0 means system timer relative to now
      aResolutionms - int; the resolution of a timer tick (step) in milliseconds
      aSpeedFactor - double; 1 means same speed as real time, 0 means the timer runs in simulation time
      aRepeatCount - int; number of timer the timer must send a timer tick (TRC_INFINITE for infinite)
      Returns:
      status of the request (TConnection.ICE_* constants)
    • timerCancel

      public int timerCancel​(String aTimerName)
      Cancel a running timer; the timer is destroyed.
      Parameters:
      aTimerName - String;
      Returns:
      status of the request (TConnection.ICE_* constants)
    • timerPrepare

      public int timerPrepare​(String aTimerName)
      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

      public int timerStart​(String aTimerName)
      Start or continue the timer
      Parameters:
      aTimerName - String;
      Returns:
      status of the request (TConnection.ICE_* constants)
    • timerStop

      public int timerStop​(String aTimerName)
      Stop or pause the timer
      Parameters:
      aTimerName - String;
      Returns:
      status of the request (TConnection.ICE_* constants)
    • timerSetSpeed

      public int timerSetSpeed​(String aTimerName, double aSpeedFactor)
      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

      public int timerAcknowledgeAdd​(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.
      Parameters:
      aTimerName - String;
      aClientName - String;
      Returns:
      status of the request (TConnection.ICE_* constants)
    • timerAcknowledgeRemove

      public int timerAcknowledgeRemove​(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.
      Parameters:
      aTimerName - String;
      aClientName - String;
      Returns:
      status of the request (TConnection.ICE_* constants)
    • timerAcknowledge

      public int timerAcknowledge​(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.
      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

      public int logWriteLn​(String aLine, TEventEntry.TLogLevel aLevel)
      Send a line to the central framework log
      Parameters:
      aLine - String; text to enter into the log
      aLevel - TLogLevel; severity of the entry to log. See TLogLevel for values.
      Returns:
      status of the request (TConnection.ICE_* constants)