MqttClient.h
Go to the documentation of this file.
157 static uint8_t getFlags(mqtt_qos_t QoS, mqtt_retain_t retain = MQTT_RETAIN_FALSE, mqtt_dup_t dup = MQTT_DUP_FALSE)
228 static int staticOnDataPayload(void* user_data, mqtt_message_t* message, const char* data, size_t length);
Definition: Delegate.h:20
Definition: MqttClient.h:47
void setPayloadParser(MqttPayloadParser payloadParser=nullptr)
Sets or clears a payload parser (for PUBLISH messages from the server to us)
Definition: MqttClient.h:142
~MqttClient()
MqttClient(bool withDefaultPayloadParser=true, bool autoDestruct=false)
void setConnectedHandler(MqttDelegate handler)
Sets a handler to be called after successful MQTT connection.
Definition: MqttClient.h:167
void setMessageHandler(MqttDelegate handler)
Sets a handler to be called after receiving a PUBLISH message from the server.
Definition: MqttClient.h:189
bool connect(const Url &url, const String &uniqueClientName)
Connect to a MQTT server.
bool publish(const String &topic, IDataSourceStream *stream, uint8_t flags=0)
Publish a message.
bool publish(const String &topic, const String &message, uint8_t flags=0)
Publish a message.
bool setWill(const String &topic, const String &message, uint8_t flags=0)
void setDisconnectHandler(TcpClientCompleteDelegate handler)
Sets a handler to be called on disconnect from the server.
Definition: MqttClient.h:199
static uint8_t getFlags(mqtt_qos_t QoS, mqtt_retain_t retain=MQTT_RETAIN_FALSE, mqtt_dup_t dup=MQTT_DUP_FALSE)
Compute the flags value.
Definition: MqttClient.h:157
void onFinished(TcpClientState finishState) override
void setEventHandler(mqtt_type_t type, MqttDelegate handler)
Register a callback function to be invoked on incoming event notification.
Definition: MqttClient.h:131
void setPublishedHandler(MqttDelegate handler)
Sets a handler to be called after receiving confirmation from the server for a published message from...
Definition: MqttClient.h:178
void setKeepAlive(uint16_t seconds)
Sets keep-alive time. That information is sent during connection to the server.
Definition: MqttClient.h:57
void onReadyToSendData(TcpConnectionEvent sourceEvent) override
Definition: TcpClient.h:46
bool connect(const String &server, int port, bool useSsl=false) override
void setCompleteDelegate(TcpClientCompleteDelegate completeCb=nullptr)
Set or clear the callback for connection close.
Definition: TcpClient.h:97
IDataSourceStream * stream
The currently active stream being sent.
Definition: TcpClient.h:165
Ssl::Session * getSsl()
Get a pointer to the current SSL session object.
Definition: TcpConnection.h:152
void setSslInitHandler(Ssl::Session::InitDelegate handler)
Set the SSL session initialisation callback.
Definition: TcpConnection.h:129
Definition: MqttPayloadParser.h:29