11#if THINGSBOARD_ENABLE_STREAM_UTILS
33#if THINGSBOARD_ENABLE_STREAM_UTILS
74 virtual bool set_buffer_size(uint16_t receive_buffer_size, uint16_t send_buffer_size) = 0;
95 virtual void set_server(
char const * domain, uint16_t port) = 0;
105 virtual bool connect(
char const * client_id,
char const * user_name,
char const * password) = 0;
127 virtual bool publish(
char const * topic,
uint8_t const * payload,
size_t const & length) = 0;
168#if THINGSBOARD_ENABLE_STREAM_UTILS
177 virtual bool begin_publish(
char const * topic,
size_t const & length) = 0;
181 virtual bool end_publish() = 0;
193 virtual size_t write(
uint8_t payload_byte) = 0;
201 virtual size_t write(
uint8_t const * buffer,
size_t const & size) = 0;
MQTT_Connection_Error
Possible error states the MQTT broker connection can be in, if connecting the device to the MQTT brok...
Definition: MQTT_Connection_Error.h:9
MQTT_Connection_State
Possible states the MQTT broker connection can be in.
Definition: MQTT_Connection_State.h:11
std::function< return_type(argument_types... arguments)> function
Callback signature.
Definition: Callback.h:34
MQTT Client interface that contains the method that a class that can be used to send and receive data...
Definition: IMQTT_Client.h:36
virtual void disconnect()=0
Force disconnects from the previously connected server and should release all used resources.
virtual ~IMQTT_Client()
Virtual default destructor, created to ensure that if a pointer to this class is used and deleted,...
Definition: IMQTT_Client.h:40
virtual bool loop()=0
Receives / sends any outstanding messages from and to the MQTT broker.
virtual bool connect(char const *client_id, char const *user_name, char const *password)=0
Connects to the previously with set_server configured server instance and port with the given credent...
virtual void subscribe_connection_state_changed_callback(Callback< void, MQTT_Connection_State, MQTT_Connection_Error >::function callback)=0
Sets the callback that is called, whenever the underlying state of our connection with the MQTT broke...
virtual MQTT_Connection_Error get_last_connection_error() const =0
Allows to deciper the reason for a failure, while attempting to establish a connection to the MQTT br...
virtual uint16_t get_receive_buffer_size()=0
Gets the previously set size of the internal buffer size meant for incoming MQTT data.
virtual void set_data_callback(Callback< void, char *, uint8_t *, unsigned int >::function callback)=0
Sets the callback that is called, if any message is received by the MQTT broker.
virtual bool unsubscribe(char const *topic)=0
Unsubscribes to previously subscribed MQTT messages of the given topic.
virtual bool set_buffer_size(uint16_t receive_buffer_size, uint16_t send_buffer_size)=0
Changes the size of the buffer for sent and received MQTT messages.
virtual MQTT_Connection_State get_connection_state() const =0
Get the current connection state to the server includes possible intermediate states between connecti...
virtual void set_server(char const *domain, uint16_t port)=0
Configures the server and port that the client should connect with over MQTT.
virtual bool publish(char const *topic, uint8_t const *payload, size_t const &length)=0
Sends the given payload over the previously established connection.
virtual uint16_t get_send_buffer_size()=0
Gets the previously set size of the internal buffer size meant for outgoing MQTT data.
virtual bool connected()=0
Returns our current connection status to MQTT, true meaning we are connected, false meaning we have b...
virtual bool subscribe(char const *topic)=0
Subscribes to MQTT message on the given topic, which will cause an internal callback to be called for...
virtual void set_connect_callback(Callback< void >::function callback)=0
Sets the callback that is called, if we have successfully established a connection with the MQTT brok...