37#include <core/pubsub.h>
38#include <core/string.h>
47#define RECORD_MQTT "mqtt"
52#define MQTT_LINK_PIN_LEN (4)
297 uint32_t props_count);
MqttPropertyType
Enumeration of available property types.
Definition mqtt.h:92
@ MqttPropertyTypeExpiryInterval
Data type: integer.
Definition mqtt.h:93
@ MqttPropertyTypeResponseTopic
Data type: string.
Definition mqtt.h:94
@ MqttPropertyTypeMax
Special value, internal use.
Definition mqtt.h:97
@ MqttPropertyTypeCorrelationData
Data type: string.
Definition mqtt.h:95
const void * mqtt_message_get_data(const MqttMessage *message, size_t *data_size)
Get the payload (data) contained in a MqttMessage object.
Definition mqtt_message.c:19
bool mqtt_request_link_pin(Mqtt *instance)
Request the account linking PIN from the BUSY cloud.
Definition mqtt_api.c:30
bool mqtt_publish(Mqtt *instance, MqttQos qos, const char *topic, const void *data, size_t data_size)
Publish a message to a topic on the MQTT broker.
Definition mqtt_api.c:108
MqttStatus mqtt_get_status(Mqtt *instance)
Get the current status of the MQTT service.
Definition mqtt_api.c:13
MqttStatus
Enumeration of possible states that the MQTT service can be in.
Definition mqtt.h:135
@ MqttStatusNotConnected
Not connected to MQTT broker.
Definition mqtt.h:137
@ MqttStatusMax
Special value, internal use.
Definition mqtt.h:140
@ MqttStatusConnectedNotLinked
Connected to MQTT broker, but not linked to an account.
Definition mqtt.h:138
@ MqttStatusConnectedLinked
Connected to MQTT broker, and linked to an account.
Definition mqtt.h:139
@ MqttStatusError
An error has occurred, usually because clent certificates are missing.
Definition mqtt.h:136
MqttQos
Enumeration of possible MQTT QoS (Quality of Service) levels.
Definition mqtt.h:168
@ MqttQosAtMostOnce
Deliver at most once (lowest)
Definition mqtt.h:169
@ MqttQosAtLeastOnce
Deliver at least once.
Definition mqtt.h:170
@ MqttQosMax
Special value, internal use.
Definition mqtt.h:172
@ MqttQosExactlyOnce
Deliver exactly once (highest)
Definition mqtt.h:171
void mqtt_get_session_info(Mqtt *instance, MqttSessionInfo *info)
Get current session information.
Definition mqtt_api.c:57
struct MqttMessage MqttMessage
Opaque data type for the MQTT message object.
Definition mqtt.h:64
FuriPubSub * mqtt_get_pubsub(Mqtt *instance)
Get the pointer to the associated FuriPubSub object.
Definition mqtt_api.c:218
bool mqtt_message_get_string_property(const MqttMessage *message, MqttPropertyType property_type, FuriString *value)
Get the string property possibly attached to a MqttMessage object.
Definition mqtt_message.c:68
bool mqtt_message_get_integer_property(const MqttMessage *message, MqttPropertyType property_type, uint32_t *value)
Get the integer property possibly attached to a MqttMessage object.
Definition mqtt_message.c:106
void mqtt_unsubscribe(Mqtt *instance, MqttSubscription *subscription)
Unsubscribe from a topic on the MQTT broker and stop receiving messages.
Definition mqtt_api.c:201
bool mqtt_set_config(Mqtt *instance, const MqttConfig *config)
Set the backend configuration.
Definition mqtt_api.c:89
MqttEventType
Enumeration of possible event types emitted by the MQTT service.
Definition mqtt.h:114
@ MqttEventTypeUnlinked
Account was unlinked from the device.
Definition mqtt.h:118
@ MqttEventTypeLinkPinReceived
An account linking PIN has been received in response to a request.
Definition mqtt.h:116
@ MqttEventTypeMax
Special value, internal use.
Definition mqtt.h:119
@ MqttEventTypeLinkDone
Account linking has been successfully completed.
Definition mqtt.h:117
@ MqttEventTypeStatusChanged
A status change has occurred.
Definition mqtt.h:115
bool mqtt_publish_ex(Mqtt *instance, MqttQos qos, const char *topic, const void *data, size_t data_size, const MqttProperty *props, uint32_t props_count)
Publish a message to a topic on the MQTT broker with additional properties.
Definition mqtt_api.c:138
void mqtt_get_config(Mqtt *instance, MqttConfig *config)
Get the current backend configuration.
Definition mqtt_api.c:74
MqttSubscription * mqtt_subscribe(Mqtt *instance, MqttQos qos, const char *topic, MqttSubscriptionCallback callback, void *context)
Subscribe to a topic on the MQTT broker and start receiving messages.
Definition mqtt_api.c:172
void(* MqttSubscriptionCallback)(const MqttMessage *message, void *context)
Subscription callback function type.
Definition mqtt.h:83
void mqtt_unlink(Mqtt *instance)
Unlink the device from the BUSY account.
Definition mqtt_api.c:47
Mqtt backend configuration strcuture types and APIs.
Mqtt backend configuration structure.
Definition mqtt_config.h:32
Data type describing the generic MQTT service event, complete with type and specific data.
Definition mqtt.h:153
MqttEventStatusChanged status_changed
Data for an event of type MqttEventTypeStatusChanged.
Definition mqtt.h:157
MqttEventLinkPinReceived link_pin_received
Data for an event of type MqttEventTypeLinkPinReceived.
Definition mqtt.h:159
MqttEventType type
A value determining the specific data type.
Definition mqtt.h:154
Data type describing the event of type MqttEventTypeLinkPinReceived.
Definition mqtt.h:127
const char * pin
Pointer to a string of length MQTT_LINK_PIN_LEN.
Definition mqtt.h:128
time_t expires_at
Timestamp past which the PIN will no longer be valid.
Definition mqtt.h:129
Data type describing the event of type MqttEventTypeStatusChanged.
Definition mqtt.h:146
MqttStatus status
New status value from the MqttStatus enum.
Definition mqtt.h:147
Data type for a single MQTT property.
Definition mqtt.h:103
int32_t integer
Integer value, valid only for integer properties.
Definition mqtt.h:106
MqttPropertyType type
A type from the MqttPropertyType enum.
Definition mqtt.h:104
const char * string
String value, valid only for string properties.
Definition mqtt.h:107
Data type for a linked account information.
Definition mqtt.h:199
FuriString * email
Linked account email string pointer, should be allocated before.
Definition mqtt.h:203
bool is_valid
true if the account link data presents, false otherwise
Definition mqtt.h:206
FuriString * session_id
Session ID string pointer, should be allocated before.
Definition mqtt.h:201
FuriString * user_id
Linked account user ID string pointer, should be allocated before.
Definition mqtt.h:205
TIME (Simple Network Time Protocol) service API.