ESPHome  2022.12.8
Data Structures | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes
esphome::mqtt::MQTTBackendIDF Class Referencefinal

#include <mqtt_backend_idf.h>

Inheritance diagram for esphome::mqtt::MQTTBackendIDF:
esphome::mqtt::MQTTBackend

Data Structures

struct  MqttClientDeleter
 

Public Member Functions

void set_keep_alive (uint16_t keep_alive) final
 
void set_client_id (const char *client_id) final
 
void set_clean_session (bool clean_session) final
 
void set_credentials (const char *username, const char *password) final
 
void set_will (const char *topic, uint8_t qos, bool retain, const char *payload) final
 
void set_server (network::IPAddress ip, uint16_t port) final
 
void set_server (const char *host, uint16_t port) final
 
void set_on_connect (std::function< on_connect_callback_t > &&callback) final
 
void set_on_disconnect (std::function< on_disconnect_callback_t > &&callback) final
 
void set_on_subscribe (std::function< on_subscribe_callback_t > &&callback) final
 
void set_on_unsubscribe (std::function< on_unsubscribe_callback_t > &&callback) final
 
void set_on_message (std::function< on_message_callback_t > &&callback) final
 
void set_on_publish (std::function< on_publish_user_callback_t > &&callback) final
 
bool connected () const final
 
void connect () final
 
void disconnect () final
 
bool subscribe (const char *topic, uint8_t qos) final
 
bool unsubscribe (const char *topic) final
 
bool publish (const char *topic, const char *payload, size_t length, uint8_t qos, bool retain) final
 
void loop () final
 
void set_ca_certificate (const std::string &cert)
 
void set_skip_cert_cn_check (bool skip_check)
 
- Public Member Functions inherited from esphome::mqtt::MQTTBackend
virtual bool publish (const MQTTMessage &message)
 

Static Public Attributes

static const size_t MQTT_BUFFER_SIZE = 4096
 

Protected Types

using ClientHandler_ = std::unique_ptr< esp_mqtt_client, MqttClientDeleter >
 

Protected Member Functions

bool initialize_ ()
 
void mqtt_event_handler_ (const esp_mqtt_event_t &event)
 

Static Protected Member Functions

static void mqtt_event_handler (void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data)
 static - Dispatch event to instance method More...
 

Protected Attributes

ClientHandler_ handler_
 
bool is_connected_ {false}
 
bool is_initalized_ {false}
 
esp_mqtt_client_config_t mqtt_cfg_ {}
 
std::string host_
 
uint16_t port_
 
std::string username_
 
std::string password_
 
std::string lwt_topic_
 
std::string lwt_message_
 
uint8_t lwt_qos_
 
bool lwt_retain_
 
std::string client_id_
 
uint16_t keep_alive_
 
bool clean_session_
 
optional< std::string > ca_certificate_
 
bool skip_cert_cn_check_ {false}
 
CallbackManager< on_connect_callback_ton_connect_
 
CallbackManager< on_disconnect_callback_ton_disconnect_
 
CallbackManager< on_subscribe_callback_ton_subscribe_
 
CallbackManager< on_unsubscribe_callback_ton_unsubscribe_
 
CallbackManager< on_message_callback_ton_message_
 
CallbackManager< on_publish_user_callback_ton_publish_
 
std::queue< esp_mqtt_event_t > mqtt_events_
 

Additional Inherited Members

- Public Types inherited from esphome::mqtt::MQTTBackend
using on_connect_callback_t = void(bool session_present)
 
using on_disconnect_callback_t = void(MQTTClientDisconnectReason reason)
 
using on_subscribe_callback_t = void(uint16_t packet_id, uint8_t qos)
 
using on_unsubscribe_callback_t = void(uint16_t packet_id)
 
using on_message_callback_t = void(const char *topic, const char *payload, size_t len, size_t index, size_t total)
 
using on_publish_user_callback_t = void(uint16_t packet_id)
 

Detailed Description

Definition at line 15 of file mqtt_backend_idf.h.

Member Typedef Documentation

◆ ClientHandler_

using esphome::mqtt::MQTTBackendIDF::ClientHandler_ = std::unique_ptr<esp_mqtt_client, MqttClientDeleter>
protected

Definition at line 108 of file mqtt_backend_idf.h.

Member Function Documentation

◆ connect()

void esphome::mqtt::MQTTBackendIDF::connect ( )
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 65 of file mqtt_backend_idf.h.

◆ connected()

bool esphome::mqtt::MQTTBackendIDF::connected ( ) const
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 63 of file mqtt_backend_idf.h.

◆ disconnect()

void esphome::mqtt::MQTTBackendIDF::disconnect ( )
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 72 of file mqtt_backend_idf.h.

◆ initialize_()

bool esphome::mqtt::MQTTBackendIDF::initialize_ ( )
protected

Definition at line 13 of file mqtt_backend_idf.cpp.

◆ loop()

void esphome::mqtt::MQTTBackendIDF::loop ( )
finalvirtual

Reimplemented from esphome::mqtt::MQTTBackend.

Definition at line 62 of file mqtt_backend_idf.cpp.

◆ mqtt_event_handler()

void esphome::mqtt::MQTTBackendIDF::mqtt_event_handler ( void *  handler_args,
esp_event_base_t  base,
int32_t  event_id,
void *  event_data 
)
staticprotected

static - Dispatch event to instance method

Definition at line 138 of file mqtt_backend_idf.cpp.

◆ mqtt_event_handler_()

void esphome::mqtt::MQTTBackendIDF::mqtt_event_handler_ ( const esp_mqtt_event_t &  event)
protected

Definition at line 72 of file mqtt_backend_idf.cpp.

◆ publish()

bool esphome::mqtt::MQTTBackendIDF::publish ( const char *  topic,
const char *  payload,
size_t  length,
uint8_t  qos,
bool  retain 
)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 82 of file mqtt_backend_idf.h.

◆ set_ca_certificate()

void esphome::mqtt::MQTTBackendIDF::set_ca_certificate ( const std::string &  cert)
inline

Definition at line 97 of file mqtt_backend_idf.h.

◆ set_clean_session()

void esphome::mqtt::MQTTBackendIDF::set_clean_session ( bool  clean_session)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 21 of file mqtt_backend_idf.h.

◆ set_client_id()

void esphome::mqtt::MQTTBackendIDF::set_client_id ( const char *  client_id)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 20 of file mqtt_backend_idf.h.

◆ set_credentials()

void esphome::mqtt::MQTTBackendIDF::set_credentials ( const char *  username,
const char *  password 
)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 23 of file mqtt_backend_idf.h.

◆ set_keep_alive()

void esphome::mqtt::MQTTBackendIDF::set_keep_alive ( uint16_t  keep_alive)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 19 of file mqtt_backend_idf.h.

◆ set_on_connect()

void esphome::mqtt::MQTTBackendIDF::set_on_connect ( std::function< on_connect_callback_t > &&  callback)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 45 of file mqtt_backend_idf.h.

◆ set_on_disconnect()

void esphome::mqtt::MQTTBackendIDF::set_on_disconnect ( std::function< on_disconnect_callback_t > &&  callback)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 48 of file mqtt_backend_idf.h.

◆ set_on_message()

void esphome::mqtt::MQTTBackendIDF::set_on_message ( std::function< on_message_callback_t > &&  callback)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 57 of file mqtt_backend_idf.h.

◆ set_on_publish()

void esphome::mqtt::MQTTBackendIDF::set_on_publish ( std::function< on_publish_user_callback_t > &&  callback)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 60 of file mqtt_backend_idf.h.

◆ set_on_subscribe()

void esphome::mqtt::MQTTBackendIDF::set_on_subscribe ( std::function< on_subscribe_callback_t > &&  callback)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 51 of file mqtt_backend_idf.h.

◆ set_on_unsubscribe()

void esphome::mqtt::MQTTBackendIDF::set_on_unsubscribe ( std::function< on_unsubscribe_callback_t > &&  callback)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 54 of file mqtt_backend_idf.h.

◆ set_server() [1/2]

void esphome::mqtt::MQTTBackendIDF::set_server ( network::IPAddress  ip,
uint16_t  port 
)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 37 of file mqtt_backend_idf.h.

◆ set_server() [2/2]

void esphome::mqtt::MQTTBackendIDF::set_server ( const char *  host,
uint16_t  port 
)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 41 of file mqtt_backend_idf.h.

◆ set_skip_cert_cn_check()

void esphome::mqtt::MQTTBackendIDF::set_skip_cert_cn_check ( bool  skip_check)
inline

Definition at line 98 of file mqtt_backend_idf.h.

◆ set_will()

void esphome::mqtt::MQTTBackendIDF::set_will ( const char *  topic,
uint8_t  qos,
bool  retain,
const char *  payload 
)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 29 of file mqtt_backend_idf.h.

◆ subscribe()

bool esphome::mqtt::MQTTBackendIDF::subscribe ( const char *  topic,
uint8_t  qos 
)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 77 of file mqtt_backend_idf.h.

◆ unsubscribe()

bool esphome::mqtt::MQTTBackendIDF::unsubscribe ( const char *  topic)
inlinefinalvirtual

Implements esphome::mqtt::MQTTBackend.

Definition at line 80 of file mqtt_backend_idf.h.

Field Documentation

◆ ca_certificate_

optional<std::string> esphome::mqtt::MQTTBackendIDF::ca_certificate_
protected

Definition at line 127 of file mqtt_backend_idf.h.

◆ clean_session_

bool esphome::mqtt::MQTTBackendIDF::clean_session_
protected

Definition at line 126 of file mqtt_backend_idf.h.

◆ client_id_

std::string esphome::mqtt::MQTTBackendIDF::client_id_
protected

Definition at line 124 of file mqtt_backend_idf.h.

◆ handler_

ClientHandler_ esphome::mqtt::MQTTBackendIDF::handler_
protected

Definition at line 109 of file mqtt_backend_idf.h.

◆ host_

std::string esphome::mqtt::MQTTBackendIDF::host_
protected

Definition at line 116 of file mqtt_backend_idf.h.

◆ is_connected_

bool esphome::mqtt::MQTTBackendIDF::is_connected_ {false}
protected

Definition at line 111 of file mqtt_backend_idf.h.

◆ is_initalized_

bool esphome::mqtt::MQTTBackendIDF::is_initalized_ {false}
protected

Definition at line 112 of file mqtt_backend_idf.h.

◆ keep_alive_

uint16_t esphome::mqtt::MQTTBackendIDF::keep_alive_
protected

Definition at line 125 of file mqtt_backend_idf.h.

◆ lwt_message_

std::string esphome::mqtt::MQTTBackendIDF::lwt_message_
protected

Definition at line 121 of file mqtt_backend_idf.h.

◆ lwt_qos_

uint8_t esphome::mqtt::MQTTBackendIDF::lwt_qos_
protected

Definition at line 122 of file mqtt_backend_idf.h.

◆ lwt_retain_

bool esphome::mqtt::MQTTBackendIDF::lwt_retain_
protected

Definition at line 123 of file mqtt_backend_idf.h.

◆ lwt_topic_

std::string esphome::mqtt::MQTTBackendIDF::lwt_topic_
protected

Definition at line 120 of file mqtt_backend_idf.h.

◆ MQTT_BUFFER_SIZE

const size_t esphome::mqtt::MQTTBackendIDF::MQTT_BUFFER_SIZE = 4096
static

Definition at line 17 of file mqtt_backend_idf.h.

◆ mqtt_cfg_

esp_mqtt_client_config_t esphome::mqtt::MQTTBackendIDF::mqtt_cfg_ {}
protected

Definition at line 114 of file mqtt_backend_idf.h.

◆ mqtt_events_

std::queue<esp_mqtt_event_t> esphome::mqtt::MQTTBackendIDF::mqtt_events_
protected

Definition at line 137 of file mqtt_backend_idf.h.

◆ on_connect_

CallbackManager<on_connect_callback_t> esphome::mqtt::MQTTBackendIDF::on_connect_
protected

Definition at line 131 of file mqtt_backend_idf.h.

◆ on_disconnect_

CallbackManager<on_disconnect_callback_t> esphome::mqtt::MQTTBackendIDF::on_disconnect_
protected

Definition at line 132 of file mqtt_backend_idf.h.

◆ on_message_

CallbackManager<on_message_callback_t> esphome::mqtt::MQTTBackendIDF::on_message_
protected

Definition at line 135 of file mqtt_backend_idf.h.

◆ on_publish_

CallbackManager<on_publish_user_callback_t> esphome::mqtt::MQTTBackendIDF::on_publish_
protected

Definition at line 136 of file mqtt_backend_idf.h.

◆ on_subscribe_

CallbackManager<on_subscribe_callback_t> esphome::mqtt::MQTTBackendIDF::on_subscribe_
protected

Definition at line 133 of file mqtt_backend_idf.h.

◆ on_unsubscribe_

CallbackManager<on_unsubscribe_callback_t> esphome::mqtt::MQTTBackendIDF::on_unsubscribe_
protected

Definition at line 134 of file mqtt_backend_idf.h.

◆ password_

std::string esphome::mqtt::MQTTBackendIDF::password_
protected

Definition at line 119 of file mqtt_backend_idf.h.

◆ port_

uint16_t esphome::mqtt::MQTTBackendIDF::port_
protected

Definition at line 117 of file mqtt_backend_idf.h.

◆ skip_cert_cn_check_

bool esphome::mqtt::MQTTBackendIDF::skip_cert_cn_check_ {false}
protected

Definition at line 128 of file mqtt_backend_idf.h.

◆ username_

std::string esphome::mqtt::MQTTBackendIDF::username_
protected

Definition at line 118 of file mqtt_backend_idf.h.


The documentation for this class was generated from the following files: