Class ControllerApiMqttImpl

java.lang.Object
io.openems.edge.common.component.AbstractOpenemsComponent
io.openems.edge.controller.api.mqtt.ControllerApiMqttImpl
All Implemented Interfaces:
OpenemsComponent, Controller, ControllerApiMqtt, org.osgi.service.event.EventHandler

public class ControllerApiMqttImpl extends AbstractOpenemsComponent implements ControllerApiMqtt, Controller, OpenemsComponent, org.osgi.service.event.EventHandler
  • Field Details

    • COMPONENT_NAME

      protected static final String COMPONENT_NAME
      See Also:
    • componentManager

      protected ComponentManager componentManager
    • config

      protected io.openems.edge.controller.api.mqtt.Config config
  • Constructor Details

    • ControllerApiMqttImpl

      public ControllerApiMqttImpl()
  • Method Details

    • deactivate

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

      public void run() throws OpenemsError.OpenemsNamedException
      Description copied from interface: Controller
      Executes the Controller logic.
      Specified by:
      run in interface Controller
      Throws:
      OpenemsError.OpenemsNamedException - on error
    • logInfo

      protected void logInfo(org.slf4j.Logger log, String message)
      Description copied from class: AbstractOpenemsComponent
      Log an info message including the Component ID.
      Overrides:
      logInfo in class AbstractOpenemsComponent
      Parameters:
      log - the Logger instance
      message - the message
    • logWarn

      protected void logWarn(org.slf4j.Logger log, String message)
      Description copied from class: AbstractOpenemsComponent
      Log a warn message including the Component ID.
      Overrides:
      logWarn in class AbstractOpenemsComponent
      Parameters:
      log - the Logger instance
      message - the message
    • handleEvent

      public void handleEvent(org.osgi.service.event.Event event)
      Specified by:
      handleEvent in interface org.osgi.service.event.EventHandler
    • publish

      protected boolean publish(String subTopic, org.eclipse.paho.mqttv5.common.MqttMessage message)
      Publish a message to a topic.
      Parameters:
      subTopic - the MQTT topic. The global MQTT Topic prefix is added in front of this string
      message - the message
      Returns:
      true if message was successfully published; false otherwise
    • publish

      protected boolean publish(String subTopic, String message, int qos, boolean retained, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties)
      Publish a message to a topic.
      Parameters:
      subTopic - the MQTT topic. The global MQTT Topic prefix is added in front of this string
      message - the message; internally translated to a UTF-8 byte array
      qos - the MQTT QOS
      retained - the MQTT retained parameter
      properties - the MqttProperties
      Returns:
      true if message was successfully published; false otherwise