Class CbusEvent

Direct Known Subclasses:
CbusBasicNodeEvent, CbusEventRequestMonitorEvent, CbusTableEvent

public class CbusEvent
extends CbusEventDataElements
  • Field Details

  • Constructor Details

    • CbusEvent

      public CbusEvent​(int nn, int en)
      Create a new event

      New events have an unknown on or off status

      Parameters:
      nn - Node Number
      en - Event Number
    • CbusEvent

      public CbusEvent​(CanSystemConnectionMemo memo, int nn, int en)
      Create a new event by Connection

      New events have an unknown on or off status

      Parameters:
      memo - System Connection
      nn - Node Number
      en - Event Number
  • Method Details

    • getState

      Get state of the event
      Returns:
      the enum event state, on off or unknown.
    • setState

      public void setState​(CbusEventDataElements.EvState newval)
      Set current state of the event.

      Does NOT send update to layout.

      Parameters:
      newval - the enum event state ie ON, OFF, UNKNOWN
    • getEn

      public int getEn()
      Get event event number
      Returns:
      event Number
    • getNn

      public int getNn()
      Get event node number.
      Returns:
      node Number
    • setEn

      public void setEn​(int en)
      Set event event number.
      Parameters:
      en - Event Number, not restricted so can be -1 for unknown
    • setNn

      public void setNn​(int nn)
      Set event node number.
      Parameters:
      nn - Node Number, not restricted so can be -1 for unknown
    • setName

      public void setName​(String name)
      Set event name.
      Parameters:
      name - Event Name
    • getName

      public String getName()
      Get event name.
      Returns:
      the Event Name
    • getNodeName

      public String getNodeName()
      Get Node name.

      Helper method, node name not stored in event, retrieved via @CbusNameService

      Returns:
      Node Name
    • matches

      public boolean matches​(int nn, int en)
      Test if a node and event number combination matches this event.
      Parameters:
      nn - Node Number
      en - Event Number
      Returns:
      true on match, else false
    • equals

      public boolean equals​(Object o)

      Custom method to compare Node Number and Event Number.

      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • sendOn

      public void sendOn()
      Send ON event CAN frame.

      Long event if Node num greater than 0, else short.

    • sendOff

      public void sendOff()
      Send OFF event CAN frame.

      Long event if Node num greater than 0, else short.

    • sendRequest

      public void sendRequest()
      Send event status request CAN frame.

      Long request if Node num greater than 0, else short.

    • sendEvent

      public void sendEvent​(CbusEventDataElements.EvState state)
      Send event CAN frame via ENUM.

      Also updates the event status as per the enum value.

      If current state unknown, toggle sends event off.

      Long event if Node num greater than 0, else short.

      Parameters:
      state - The enum state requested to be sent, ie ON, OFF, REQUEST, TOGGLE
    • toString

      public String toString()
      Get a String with event overview.
      Overrides:
      toString in class Object
      Returns:
      includes event name and node name if known