Class BitsWordElement

    • Method Detail

      • bit

        public BitsWordElement bit​(int bitIndex,
                                   ChannelId channelId)
        Adds a mapping for a given bit.
        Parameters:
        bitIndex - the index of the bit; a number between 0 and 15
        channelId - the Channel-ID
        Returns:
        myself for builder pattern
      • _setInputRegisters

        protected void _setInputRegisters​(com.ghgande.j2mod.modbus.procimg.InputRegister... registers)
        Sets the individual BooleanChannel-Values from an InputRegister.
        Overrides:
        _setInputRegisters in class AbstractWordElement<UnsignedWordElement,​java.lang.Integer>
        Parameters:
        registers - the InputRegisters
      • getNextWriteValueAndReset

        public java.util.Optional<com.ghgande.j2mod.modbus.procimg.Register[]> getNextWriteValueAndReset()
        Gets the next write value from all Bits and resets them.

        This method should be called once in every cycle on the TOPIC_CYCLE_EXECUTE_WRITE event. It makes sure, that the nextWriteValue gets initialized in every Cycle. If registers need to be written again in every cycle, next setNextWriteValue()-method needs to called on every Cycle.

        Returns:
        the next value as an Optional array of Registers
      • fromByteBuffer

        protected java.lang.Integer fromByteBuffer​(java.nio.ByteBuffer buff)
        Description copied from class: AbstractWordElement
        Converts a 2-byte ByteBuffer to the the current OpenemsType.
        Overrides:
        fromByteBuffer in class UnsignedWordElement
        Parameters:
        buff - the ByteBuffer
        Returns:
        an instance of the current OpenemsType
      • toByteBuffer

        protected java.nio.ByteBuffer toByteBuffer​(java.nio.ByteBuffer buff,
                                                   java.lang.Integer value)