Class AbstractEdge2Edge

    • Method Detail

      • activate

        protected boolean activate​(org.osgi.service.component.ComponentContext context,
                                   java.lang.String id,
                                   java.lang.String alias,
                                   boolean enabled,
                                   int unitId,
                                   org.osgi.service.cm.ConfigurationAdmin cm,
                                   java.lang.String modbusReference,
                                   java.lang.String modbusId)
                            throws OpenemsException
        Description copied from class: AbstractOpenemsModbusComponent
        Call this method from Component implementations activate().
        Overrides:
        activate in class AbstractOpenemsModbusComponent
        Parameters:
        context - ComponentContext of this component. Receive it from parameter for @Activate
        id - ID of this component. Typically 'config.id()'
        alias - Human-readable name of this Component. Typically 'config.alias()'. Defaults to 'id' if empty
        enabled - Whether the component should be enabled. Typically 'config.enabled()'
        unitId - Unit-ID of the Modbus target
        cm - An instance of ConfigurationAdmin. Receive it using @Reference
        modbusReference - The name of the @Reference setter method for the Modbus bridge - e.g. 'Modbus' if you have a setModbus()-method
        modbusId - The ID of the Modbus bridge. Typically 'config.modbus_id()'
        Returns:
        true if the target filter was updated. You may use it to abort the activate() method.
        Throws:
        OpenemsException - on error
      • activate

        protected boolean activate​(org.osgi.service.component.ComponentContext context,
                                   java.lang.String id,
                                   java.lang.String alias,
                                   boolean enabled,
                                   int unitId,
                                   org.osgi.service.cm.ConfigurationAdmin cm,
                                   java.lang.String modbusReference,
                                   java.lang.String modbusId,
                                   java.lang.String remoteComponentId,
                                   AccessMode remoteAccessMode)
                            throws OpenemsException
        Throws:
        OpenemsException
      • isHashEqual

        protected static boolean isHashEqual​(java.lang.Integer value,
                                             java.lang.String text)
        Compares a Integer (e.g. read from Modbus) with the hash-code of a text.
        Parameters:
        value - an Integer, possibly null
        text - the text for the hash-code
        Returns:
        true on match
      • getOnUpdateCallback

        protected abstract java.util.function.Consumer<java.lang.Object> getOnUpdateCallback​(ModbusSlaveNatureTable modbusSlaveNatureTable,
                                                                                             ModbusRecord record)
        Provide a Consumer for Registers that cannot be automatically mapped to Channels.
        Parameters:
        modbusSlaveNatureTable - the ModbusSlaveNatureTable of the Register
        record - the ModbusRecord
        Returns:
        a Consumer that receives the value from Modbus