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
94 #define AZ_IOT_HUB_CLIENT_WEB_SOCKET_PATH "/$iothub/websocket"
102 #define AZ_IOT_HUB_CLIENT_WEB_SOCKET_PATH_NO_X509_CLIENT_CERT \
103 AZ_IOT_HUB_CLIENT_WEB_SOCKET_PATH "?iothub-no-client-cert=true"
124 char* mqtt_user_name,
125 size_t mqtt_user_name_size,
126 size_t* out_mqtt_user_name_length);
146 char* mqtt_client_id,
147 size_t mqtt_client_id_size,
148 size_t* out_mqtt_client_id_length);
175 uint64_t token_expiration_epoch_time,
205 uint64_t token_expiration_epoch_time,
206 az_span base64_hmac_sha256_signature,
209 size_t mqtt_password_size,
210 size_t* out_mqtt_password_length);
238 size_t mqtt_topic_size,
239 size_t* out_mqtt_topic_length);
251 #define AZ_IOT_HUB_CLIENT_C2D_SUBSCRIBE_TOPIC "devices/+/messages/devicebound/#"
291 #define AZ_IOT_HUB_CLIENT_METHODS_SUBSCRIBE_TOPIC "$iothub/methods/POST/#"
344 size_t mqtt_topic_size,
345 size_t* out_mqtt_topic_length);
357 #define AZ_IOT_HUB_CLIENT_TWIN_RESPONSE_SUBSCRIBE_TOPIC "$iothub/twin/res/#"
363 #define AZ_IOT_HUB_CLIENT_TWIN_PATCH_SUBSCRIBE_TOPIC "$iothub/twin/PATCH/properties/desired/#"
371 AZ_IOT_CLIENT_TWIN_RESPONSE_TYPE_GET = 1,
372 AZ_IOT_CLIENT_TWIN_RESPONSE_TYPE_DESIRED_PROPERTIES = 2,
373 AZ_IOT_CLIENT_TWIN_RESPONSE_TYPE_REPORTED_PROPERTIES = 3,
431 size_t mqtt_topic_size,
432 size_t* out_mqtt_topic_length);
454 size_t mqtt_topic_size,
455 size_t* out_mqtt_topic_length);
457 #include <azure/core/_az_cfg_suffix.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:259
az_span name
Definition: az_iot_hub_client.h:301
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_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_result
The type represents the various success and error conditions.
Definition: az_result.h:53
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:385
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_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_status status
Definition: az_iot_hub_client.h:383
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.
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_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:258
Telemetry or C2D properties.
Definition: az_iot_common.h:97
az_iot_hub_client_twin_response_type
Twin response type.
Definition: az_iot_hub_client.h:370
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:382
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_span user_agent
Definition: az_iot_hub_client.h:45
az_span module_id
Definition: az_iot_hub_client.h:44
az_span request_id
Definition: az_iot_hub_client.h:299
Azure IoT Hub Client options.
Definition: az_iot_hub_client.h:43
az_span version
Definition: az_iot_hub_client.h:386
A method request received from IoT Hub.
Definition: az_iot_hub_client.h:298
Twin response.
Definition: az_iot_hub_client.h:381
az_iot_status
Azure IoT service status codes.
Definition: az_iot_common.h:39
Azure IoT Hub Client.
Definition: az_iot_hub_client.h:55
Azure IoT common definitions.
az_span model_id
Definition: az_iot_hub_client.h:47
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_twin_response)
Attempts to parse a received message's topic for twin features.
Represents a "view" over a byte buffer that represents a contiguous region of memory....
Definition: az_span.h:33