Class AbstractChannelListenerManager

java.lang.Object
io.openems.edge.common.channel.AbstractChannelListenerManager
Direct Known Subclasses:
AbstractChannelManager, AddChannelManager, ChannelManager, SubtractChannelManager

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

    • AbstractChannelListenerManager

      public AbstractChannelListenerManager()
  • Method Details

    • deactivate

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

      protected <T> void addOnSetNextValueListener(OpenemsComponent component, ChannelId channelId, 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, 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