Class EnumDoc

All Implemented Interfaces:
Doc
Direct Known Subclasses:
StateCollectorChannelDoc

public class EnumDoc extends AbstractDoc<Integer>
  • Field Details

    • debounce

      protected int debounce
  • Constructor Details

  • Method Details

    • getChannelCategory

      public ChannelCategory getChannelCategory()
      Description copied from interface: Doc
      Gets the ChannelCategory of the Channel of this Doc.
      Returns:
      the ChannelCategory
    • self

      protected EnumDoc self()
      Description copied from class: AbstractDoc
      Gets an instance of the correct subclass of myself.
      Specified by:
      self in class AbstractDoc<Integer>
      Returns:
      myself
    • getOptions

      public OptionsEnum[] getOptions()
    • initialValue

      public EnumDoc initialValue(OptionsEnum initialValue)
      Initial-Value. Default: none
      Parameters:
      initialValue - the initial value as OptionsEnum
      Returns:
      myself
    • createChannelInstance

      public EnumReadChannel createChannelInstance(OpenemsComponent component, ChannelId channelId)
      Creates an instance of Channel for the given Channel-ID using its Channel-Doc.
      Specified by:
      createChannelInstance in interface Doc
      Specified by:
      createChannelInstance in class AbstractDoc<Integer>
      Parameters:
      component - the OpenemsComponent
      channelId - the Channel-ID
      Returns:
      the Channel
    • getUndefinedOption

      public OptionsEnum getUndefinedOption()
      Gets the Undefined-Option, i.e. the default Option if the value has not been set.
      Returns:
      the Undefined-Option
    • getOptionFromString

      public OptionsEnum getOptionFromString(String name) throws OpenemsError.OpenemsNamedException
      Gets the Option from a String.
      Parameters:
      name - the name of the option. Comparison is case insensitive
      Returns:
      the OptionsEnum
      Throws:
      OpenemsError.OpenemsNamedException - if there is no option with that name
    • getOptionValueFromString

      public int getOptionValueFromString(String name) throws OpenemsError.OpenemsNamedException
      Gets the Option value from a String.
      Parameters:
      name - the name of the option. Comparison is case insensitive
      Returns:
      the integer value of the OptionsEnum
      Throws:
      OpenemsError.OpenemsNamedException - if there is no option with that name
    • getOption

      public OptionsEnum getOption(Integer value)
      Gets the OptionsEnum from the integer value.
      Parameters:
      value - the integer value of the option
      Returns:
      the OptionsEnum
    • getOptionString

      public String getOptionString(Integer value)
      Gets the name of the Option or 'UNDEFINED' if there is no option with that value.
      Parameters:
      value - the integer value of the Option
      Returns:
      the name of the Option as a String
    • getText

      public String getText()
      Description copied from interface: Doc
      Gets the descriptive text. Defaults to empty String.
      Specified by:
      getText in interface Doc
      Overrides:
      getText in class AbstractDoc<Integer>
      Returns:
      the text
    • debounce

      public EnumDoc debounce(int debounce)
      Debounce the Enum-Channel value: The EnumChannel is only set to the given value after it had been set to the same value for at least "debounce" times.

      Currently only working for read-only.

      Parameters:
      debounce - "debounce" times
      Returns:
      EnumDoc
    • getDebounce

      public int getDebounce()