Go to the documentation of this file.
17 #ifndef _az_IOT_HUB_CLIENT_H
18 #define _az_IOT_HUB_CLIENT_H
27 #include <azure/core/_az_cfg_prefix.h>
35 AZ_HUB_CLIENT_DEFAULT_MQTT_TELEMETRY_QOS = 0
123 #define AZ_IOT_HUB_CLIENT_WEB_SOCKET_PATH "/$iothub/websocket"
131 #define AZ_IOT_HUB_CLIENT_WEB_SOCKET_PATH_NO_X509_CLIENT_CERT \
132 AZ_IOT_HUB_CLIENT_WEB_SOCKET_PATH "?iothub-no-client-cert=true"
161 char* mqtt_user_name,
162 size_t mqtt_user_name_size,
163 size_t* out_mqtt_user_name_length);
192 char* mqtt_client_id,
193 size_t mqtt_client_id_size,
194 size_t* out_mqtt_client_id_length);
255 uint64_t token_expiration_epoch_time,
289 uint64_t token_expiration_epoch_time,
290 az_span base64_hmac_sha256_signature,
293 size_t mqtt_password_size,
294 size_t* out_mqtt_password_length);
323 size_t mqtt_topic_size,
324 size_t* out_mqtt_topic_length);
336 #define AZ_IOT_HUB_CLIENT_C2D_SUBSCRIBE_TOPIC "devices/+/messages/devicebound/#"
385 #define AZ_IOT_HUB_CLIENT_METHODS_SUBSCRIBE_TOPIC "$iothub/methods/POST/#"
455 size_t mqtt_topic_size,
456 size_t* out_mqtt_topic_length);
468 #define AZ_IOT_HUB_CLIENT_COMMANDS_SUBSCRIBE_TOPIC AZ_IOT_HUB_CLIENT_METHODS_SUBSCRIBE_TOPIC
545 size_t mqtt_topic_size,
546 size_t* out_mqtt_topic_length);
558 #define AZ_IOT_HUB_CLIENT_TWIN_RESPONSE_SUBSCRIBE_TOPIC "$iothub/twin/res/#"
564 #define AZ_IOT_HUB_CLIENT_TWIN_PATCH_SUBSCRIBE_TOPIC "$iothub/twin/PATCH/properties/desired/#"
572 AZ_IOT_HUB_CLIENT_TWIN_RESPONSE_TYPE_GET = 1,
573 AZ_IOT_HUB_CLIENT_TWIN_RESPONSE_TYPE_DESIRED_PROPERTIES = 2,
574 AZ_IOT_HUB_CLIENT_TWIN_RESPONSE_TYPE_REPORTED_PROPERTIES = 3,
575 AZ_IOT_HUB_CLIENT_TWIN_RESPONSE_TYPE_REQUEST_ERROR = 4,
660 size_t mqtt_topic_size,
661 size_t* out_mqtt_topic_length);
687 size_t mqtt_topic_size,
688 size_t* out_mqtt_topic_length);
700 #define AZ_IOT_HUB_CLIENT_PROPERTIES_MESSAGE_SUBSCRIBE_TOPIC \
701 AZ_IOT_HUB_CLIENT_TWIN_RESPONSE_SUBSCRIBE_TOPIC
707 #define AZ_IOT_HUB_CLIENT_PROPERTIES_WRITABLE_UPDATES_SUBSCRIBE_TOPIC \
708 AZ_IOT_HUB_CLIENT_TWIN_PATCH_SUBSCRIBE_TOPIC
788 size_t mqtt_topic_size,
789 size_t* out_mqtt_topic_length);
817 size_t mqtt_topic_size,
818 size_t* out_mqtt_topic_length);
820 #include <azure/core/_az_cfg_suffix.h>
822 #endif // _az_IOT_HUB_CLIENT_H
AZ_NODISCARD az_result az_iot_hub_client_methods_response_get_publish_topic(az_iot_hub_client const *client, az_span request_id, uint16_t status, char *mqtt_topic, size_t mqtt_topic_size, size_t *out_mqtt_topic_length)
Gets the MQTT topic that must be used to respond to method requests.
Definition of az_result and helper functions.
az_iot_message_properties properties
Definition: az_iot_hub_client.h:347
az_span name
Definition: az_iot_hub_client.h:402
Properties message.
Definition: az_iot_hub_client.h:732
AZ_NODISCARD az_result az_iot_hub_client_commands_parse_received_topic(az_iot_hub_client const *client, az_span received_topic, az_iot_hub_client_command_request *out_request)
Attempts to parse a received message's topic for command features.
AZ_NODISCARD az_result az_iot_hub_client_init(az_iot_hub_client *client, az_span iot_hub_hostname, az_span device_id, az_iot_hub_client_options const *options)
Initializes an Azure IoT Hub Client.
az_span * component_names
Definition: az_iot_hub_client.h:66
AZ_NODISCARD az_result az_iot_hub_client_twin_document_get_publish_topic(az_iot_hub_client const *client, az_span request_id, char *mqtt_topic, size_t mqtt_topic_size, size_t *out_mqtt_topic_length)
Gets the MQTT topic that must be used to submit a Twin GET request.
@ AZ_IOT_HUB_CLIENT_PROPERTIES_MESSAGE_TYPE_ACKNOWLEDGEMENT
Definition: az_iot_hub_client.h:721
AZ_NODISCARD az_result az_iot_hub_client_sas_get_signature(az_iot_hub_client const *client, uint64_t token_expiration_epoch_time, az_span signature, az_span *out_signature)
Gets the Shared Access clear-text signature.
az_span request_id
Definition: az_iot_hub_client.h:587
AZ_NODISCARD az_iot_hub_client_options az_iot_hub_client_options_default()
Gets the default Azure IoT Hub Client options.
AZ_NODISCARD az_result az_iot_hub_client_twin_parse_received_topic(az_iot_hub_client const *client, az_span received_topic, az_iot_hub_client_twin_response *out_response)
Attempts to parse a received message's topic for twin features.
AZ_NODISCARD az_result az_iot_hub_client_get_user_name(az_iot_hub_client const *client, char *mqtt_user_name, size_t mqtt_user_name_size, size_t *out_mqtt_user_name_length)
Gets the MQTT user name.
@ AZ_IOT_HUB_CLIENT_PROPERTIES_MESSAGE_TYPE_WRITABLE_UPDATED
Definition: az_iot_hub_client.h:718
AZ_NODISCARD az_result az_iot_hub_client_properties_get_reported_publish_topic(az_iot_hub_client const *client, az_span request_id, char *mqtt_topic, size_t mqtt_topic_size, size_t *out_mqtt_topic_length)
Gets the MQTT topic that is used to send properties from the device to service.
az_iot_status status
Definition: az_iot_hub_client.h:600
AZ_NODISCARD az_result az_iot_hub_client_get_client_id(az_iot_hub_client const *client, char *mqtt_client_id, size_t mqtt_client_id_size, size_t *out_mqtt_client_id_length)
Gets the MQTT client ID.
int32_t az_result
The type represents the various success and error conditions.
Definition: az_result.h:46
@ AZ_IOT_HUB_CLIENT_PROPERTIES_MESSAGE_TYPE_ERROR
Definition: az_iot_hub_client.h:723
AZ_NODISCARD az_result az_iot_hub_client_properties_document_get_publish_topic(az_iot_hub_client const *client, az_span request_id, char *mqtt_topic, size_t mqtt_topic_size, size_t *out_mqtt_topic_length)
Gets the MQTT topic that is used to submit a properties GET request.
az_span request_id
Definition: az_iot_hub_client.h:735
AZ_NODISCARD az_result az_iot_hub_client_telemetry_get_publish_topic(az_iot_hub_client const *client, az_iot_message_properties const *properties, char *mqtt_topic, size_t mqtt_topic_size, size_t *out_mqtt_topic_length)
Gets the MQTT topic that must be used for device to cloud telemetry messages.
AZ_NODISCARD az_result az_iot_hub_client_methods_parse_received_topic(az_iot_hub_client const *client, az_span received_topic, az_iot_hub_client_method_request *out_request)
Attempts to parse a received message's topic for method features.
az_span request_id
Definition: az_iot_hub_client.h:480
AZ_NODISCARD az_result az_iot_hub_client_c2d_parse_received_topic(az_iot_hub_client const *client, az_span received_topic, az_iot_hub_client_c2d_request *out_request)
Attempts to parse a received message's topic for C2D features.
AZ_NODISCARD az_result az_iot_hub_client_sas_get_password(az_iot_hub_client const *client, uint64_t token_expiration_epoch_time, az_span base64_hmac_sha256_signature, az_span key_name, char *mqtt_password, size_t mqtt_password_size, size_t *out_mqtt_password_length)
Gets the MQTT password.
The Cloud-To-Device Request.
Definition: az_iot_hub_client.h:343
Telemetry or C2D properties.
Definition: az_iot_common.h:156
az_iot_hub_client_twin_response_type
Twin response type.
Definition: az_iot_hub_client.h:571
An az_span represents a contiguous byte buffer and is used for string manipulations,...
az_iot_hub_client_twin_response_type response_type
Definition: az_iot_hub_client.h:595
AZ_NODISCARD az_result az_iot_hub_client_twin_patch_get_publish_topic(az_iot_hub_client const *client, az_span request_id, char *mqtt_topic, size_t mqtt_topic_size, size_t *out_mqtt_topic_length)
Gets the MQTT topic that must be used to submit a Twin PATCH request.
az_iot_status status
Definition: az_iot_hub_client.h:734
az_span command_name
Definition: az_iot_hub_client.h:491
az_span user_agent
Definition: az_iot_hub_client.h:56
az_span module_id
Definition: az_iot_hub_client.h:51
AZ_NODISCARD az_result az_iot_hub_client_commands_response_get_publish_topic(az_iot_hub_client const *client, az_span request_id, uint16_t status, char *mqtt_topic, size_t mqtt_topic_size, size_t *out_mqtt_topic_length)
Gets the MQTT topic that is used to respond to command requests.
AZ_NODISCARD az_result az_iot_hub_client_properties_parse_received_topic(az_iot_hub_client const *client, az_span received_topic, az_iot_hub_client_properties_message *out_message)
Attempts to parse a received message's topic for properties features.
az_span request_id
Definition: az_iot_hub_client.h:397
az_span component_name
Definition: az_iot_hub_client.h:486
Azure IoT Hub Client options.
Definition: az_iot_hub_client.h:43
az_span version
Definition: az_iot_hub_client.h:609
int32_t component_names_length
Definition: az_iot_hub_client.h:71
az_iot_hub_client_properties_message_type message_type
Definition: az_iot_hub_client.h:733
A command request received from IoT Hub.
Definition: az_iot_hub_client.h:475
A method request received from IoT Hub.
Definition: az_iot_hub_client.h:392
Twin response.
Definition: az_iot_hub_client.h:583
az_iot_status
Azure IoT service status codes.
Definition: az_iot_common.h:78
@ AZ_IOT_HUB_CLIENT_PROPERTIES_MESSAGE_TYPE_GET_RESPONSE
Definition: az_iot_hub_client.h:716
Azure IoT Hub Client.
Definition: az_iot_hub_client.h:78
Azure IoT common definitions.
az_iot_hub_client_properties_message_type
Properties message type.
Definition: az_iot_hub_client.h:715
az_span model_id
Definition: az_iot_hub_client.h:61
Represents a "view" over a byte buffer that represents a contiguous region of memory....
Definition: az_span.h:33