Class AbstractEdge2Edge

All Implemented Interfaces:
ModbusComponent, OpenemsComponent, Edge2Edge
Direct Known Subclasses:
Edge2EdgeEssImpl

public abstract class AbstractEdge2Edge extends AbstractOpenemsModbusComponent implements Edge2Edge, ModbusComponent, OpenemsComponent
  • Constructor Details

  • Method Details

    • activate

      protected boolean activate(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled, int unitId, org.osgi.service.cm.ConfigurationAdmin cm, String modbusReference, 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, String id, String alias, boolean enabled, int unitId, org.osgi.service.cm.ConfigurationAdmin cm, String modbusReference, String modbusId, String remoteComponentId, AccessMode remoteAccessMode) throws OpenemsException
      Throws:
      OpenemsException
    • deactivate

      protected void deactivate()
      Description copied from class: AbstractOpenemsComponent
      Handles @Deactivate of implementations. Prints log output.
      Overrides:
      deactivate in class AbstractOpenemsModbusComponent
    • isHashEqual

      protected static boolean isHashEqual(Integer value, 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
    • defineModbusProtocol

      protected final ModbusProtocol defineModbusProtocol()
      Description copied from class: AbstractOpenemsModbusComponent
      Defines the Modbus protocol.
      Specified by:
      defineModbusProtocol in class AbstractOpenemsModbusComponent
      Returns:
      the ModbusProtocol
    • getOnUpdateCallback

      protected abstract Consumer<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
    • getWriteChannelId

      protected abstract ChannelId getWriteChannelId(ModbusSlaveNatureTable modbusSlaveNatureTable, ModbusRecord record)
      Provide a local ChannelId that gets mapped to remote READ_WRITE or WRITE_ONLY registers.
      Parameters:
      modbusSlaveNatureTable - the ModbusSlaveNatureTable of the Register
      record - the ModbusRecord
      Returns:
      a local ChannelId