Class AbstractChannelListenerManager

  • Direct Known Subclasses:
    AbstractChannelManager, ChannelManager, ChannelManager

    public abstract class AbstractChannelListenerManager
    extends java.lang.Object
    Helper wrapping class to manage everything related to Channel Listeners; It takes care of registering and unregistering listeners.
    • Constructor Detail

      • AbstractChannelListenerManager

        public AbstractChannelListenerManager()
    • Method Detail

      • deactivate

        public void deactivate()
        Called on deactivate(). Remove all callbacks from Channels.
      • addOnSetNextValueListener

        protected <T> void addOnSetNextValueListener​(OpenemsComponent component,
                                                     ChannelId channelId,
                                                     java.util.function.Consumer<Value<T>> callback)
        Adds a Listener. Also applies the callback once to make sure it applies already existing values.
        Type Parameters:
        T - the Channel value type
        Parameters:
        component - the Component
        channelId - the ChannelId
        callback - the callback
      • addOnChangeListener

        protected <T> void addOnChangeListener​(OpenemsComponent component,
                                               ChannelId channelId,
                                               java.util.function.BiConsumer<Value<T>,​Value<T>> callback)
        Adds a Listener. Also applies the callback once to make sure it applies already existing values.
        Type Parameters:
        T - the Channel value type
        Parameters:
        component - the Component
        channelId - the ChannelId
        callback - the callback