Class CbusEvent

    • Constructor Detail

      • 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 Detail

      • 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​(java.lang.String name)
        Set event name.
        Parameters:
        name - new Event Name
      • setNameIfNoName

        public void setNameIfNoName​(@Nonnull
                                    java.lang.String name)
        Set event name only if there is no existing name.
        Parameters:
        name - Event Name
      • getName

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

        public java.lang.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​(java.lang.Object o)

        Custom method to compare Node Number and Event Number.

        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.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 java.lang.String toString()
        Get a String with event overview.
        Overrides:
        toString in class java.lang.Object
        Returns:
        includes event name and node name if known