Package io.openems.edge.common.channel
Class EnumWriteChannel
- java.lang.Object
-
- io.openems.edge.common.channel.internal.AbstractReadChannel<EnumDoc,java.lang.Integer>
-
- io.openems.edge.common.channel.EnumReadChannel
-
- io.openems.edge.common.channel.EnumWriteChannel
-
- All Implemented Interfaces:
Channel<java.lang.Integer>
,WriteChannel<java.lang.Integer>
public class EnumWriteChannel extends EnumReadChannel implements WriteChannel<java.lang.Integer>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EnumWriteChannel.MirrorToDebugChannel
-
Field Summary
-
Fields inherited from class io.openems.edge.common.channel.internal.AbstractReadChannel
parent
-
Fields inherited from interface io.openems.edge.common.channel.Channel
NO_OF_PAST_VALUES
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EnumWriteChannel(OpenemsComponent component, ChannelId channelId, EnumDoc channelDoc, OptionsEnum optionsEnum)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
_setNextWriteValue(java.lang.Integer value)
Deprecated.java.util.Optional<java.lang.Integer>
getNextWriteValue()
Gets the next write value.java.util.List<ThrowingConsumer<java.lang.Integer,OpenemsError.OpenemsNamedException>>
getOnSetNextWrites()
Gets the onSetNextWrite callbacks.void
onSetNextWrite(ThrowingConsumer<java.lang.Integer,OpenemsError.OpenemsNamedException> callback)
Add an onSetNextWrite callback.void
setNextWriteValue(OptionsEnum value)
Updates the 'next' write value of Channel from an Enum value.void
setNextWriteValue(java.lang.String value)
Updates the 'next' write value of Channel from an Enum-String value.-
Methods inherited from class io.openems.edge.common.channel.EnumReadChannel
_setNextValue
-
Methods inherited from class io.openems.edge.common.channel.internal.AbstractReadChannel
address, channelDoc, channelId, deactivate, getComponent, getMetaInfo, getNextValue, getPastValues, getType, nextProcessImage, onChange, onSetNextValue, onUpdate, removeOnChangeCallback, removeOnSetNextValueCallback, removeOnUpdateCallback, setMetaInfo, toString, value
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.openems.edge.common.channel.Channel
_setNextValue, address, channelDoc, channelId, deactivate, getComponent, getMetaInfo, getNextValue, getPastValues, getType, nextProcessImage, onChange, onSetNextValue, onUpdate, removeOnChangeCallback, removeOnSetNextValueCallback, removeOnUpdateCallback, setMetaInfo, setNextValue, value
-
Methods inherited from interface io.openems.edge.common.channel.WriteChannel
getNextWriteValueAndReset, setNextWriteValue, setNextWriteValueFromObject
-
-
-
-
Constructor Detail
-
EnumWriteChannel
protected EnumWriteChannel(OpenemsComponent component, ChannelId channelId, EnumDoc channelDoc, OptionsEnum optionsEnum)
-
-
Method Detail
-
setNextWriteValue
public void setNextWriteValue(java.lang.String value) throws OpenemsError.OpenemsNamedException
Updates the 'next' write value of Channel from an Enum-String value.- Parameters:
value
- the name of the option as string- Throws:
OpenemsError.OpenemsNamedException
- one error
-
setNextWriteValue
public void setNextWriteValue(OptionsEnum value) throws OpenemsError.OpenemsNamedException
Updates the 'next' write value of Channel from an Enum value.- Parameters:
value
- the OptionsEnum value- Throws:
OpenemsError.OpenemsNamedException
- on error
-
_setNextWriteValue
@Deprecated public void _setNextWriteValue(java.lang.Integer value)
Deprecated.Internal method. Do not call directly.- Specified by:
_setNextWriteValue
in interfaceWriteChannel<java.lang.Integer>
- Parameters:
value
- the value as Integer
-
getNextWriteValue
public java.util.Optional<java.lang.Integer> getNextWriteValue()
Description copied from interface:WriteChannel
Gets the next write value.- Specified by:
getNextWriteValue
in interfaceWriteChannel<java.lang.Integer>
- Returns:
- the next write value; not-present if no write value had been set
-
getOnSetNextWrites
public java.util.List<ThrowingConsumer<java.lang.Integer,OpenemsError.OpenemsNamedException>> getOnSetNextWrites()
Description copied from interface:WriteChannel
Gets the onSetNextWrite callbacks.- Specified by:
getOnSetNextWrites
in interfaceWriteChannel<java.lang.Integer>
- Overrides:
getOnSetNextWrites
in classAbstractReadChannel<EnumDoc,java.lang.Integer>
- Returns:
- a List of callbacks
-
onSetNextWrite
public void onSetNextWrite(ThrowingConsumer<java.lang.Integer,OpenemsError.OpenemsNamedException> callback)
Description copied from interface:WriteChannel
Add an onSetNextWrite callback. It is called when a 'next write value' was set.The callback can throw an
OpenemsError.OpenemsNamedException
.- Specified by:
onSetNextWrite
in interfaceWriteChannel<java.lang.Integer>
- Parameters:
callback
- the callback
-
-