Package io.openems.edge.common.channel
Class AbstractChannelListenerManager
java.lang.Object
io.openems.edge.common.channel.AbstractChannelListenerManager
- Direct Known Subclasses:
AbstractChannelManager
,ChannelManager
,ChannelManager
,SymmetricChannelManager
Helper wrapping class to manage everything related to Channel Listeners; It
takes care of registering and unregistering listeners.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> void
addOnChangeListener
(OpenemsComponent component, ChannelId channelId, BiConsumer<Value<T>, Value<T>> callback) Adds a Listener.protected <T> void
addOnSetNextValueListener
(OpenemsComponent component, ChannelId channelId, Consumer<Value<T>> callback) Adds a Listener.void
Called on deactivate().
-
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 ComponentchannelId
- the ChannelIdcallback
- 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 ComponentchannelId
- the ChannelIdcallback
- the callback
-