Azure IoT middleware for FreeRTOS
|
The middleware IoT Provisioning Client used to connect a device to Azure IoT Device Provisioning. More...
#include "FreeRTOS.h"
#include "azure_iot.h"
#include "azure_iot_result.h"
#include "azure_iot_mqtt_port.h"
#include "azure_iot_transport_interface.h"
#include "azure/iot/az_iot_common.h"
#include "azure/iot/az_iot_provisioning_client.h"
#include "azure/core/_az_cfg_prefix.h"
#include "azure/core/_az_cfg_suffix.h"
Go to the source code of this file.
Data Structures | |
struct | AzureIoTProvisioningClientOptions |
The options for the Azure IoT Device Provisioning client. More... | |
struct | AzureIoTProvisioningClient |
The Azure IoT Device Provisioning client. More... | |
Macros | |
#define | azureiotprovisioningRESPONSE_MAX ( azureiotconfigTOPIC_MAX + azureiotconfigPROVISIONING_REQUEST_PAYLOAD_MAX ) |
The maximum size of the response buffer. | |
#define | azureiotprovisioningNO_WAIT ( 0 ) |
Do not wait on the function call. | |
#define | azureiotprovisioningWAIT_FOREVER ( ( uint32_t ) 0xFFFFFFFF ) |
Wait as long as it takes to complete the operation (success or failure) | |
Typedefs | |
typedef struct AzureIoTProvisioningClientOptions | AzureIoTProvisioningClientOptions_t |
The options for the Azure IoT Device Provisioning client. | |
typedef struct AzureIoTProvisioningClient | AzureIoTProvisioningClient_t |
The Azure IoT Device Provisioning client. | |
Functions | |
AzureIoTResult_t | AzureIoTProvisioningClient_OptionsInit (AzureIoTProvisioningClientOptions_t *pxProvisioningClientOptions) |
Initialize the Azure IoT Provisioning Options with default values. More... | |
AzureIoTResult_t | AzureIoTProvisioningClient_Init (AzureIoTProvisioningClient_t *pxAzureProvClient, const uint8_t *pucEndpoint, uint32_t ulEndpointLength, const uint8_t *pucIDScope, uint32_t ulIDScopeLength, const uint8_t *pucRegistrationID, uint32_t ulRegistrationIDLength, AzureIoTProvisioningClientOptions_t *pxProvisioningClientOptions, uint8_t *pucBuffer, uint32_t ulBufferLength, AzureIoTGetCurrentTimeFunc_t xGetTimeFunction, const AzureIoTTransportInterface_t *pxTransportInterface) |
Initialize the Azure IoT Provisioning Client. More... | |
void | AzureIoTProvisioningClient_Deinit (AzureIoTProvisioningClient_t *pxAzureProvClient) |
Deinitialize the Azure IoT Provisioning Client. More... | |
AzureIoTResult_t | AzureIoTProvisioningClient_SetSymmetricKey (AzureIoTProvisioningClient_t *pxAzureProvClient, const uint8_t *pucSymmetricKey, uint32_t ulSymmetricKeyLength, AzureIoTGetHMACFunc_t xHmacFunction) |
Set the symmetric key to use for authentication. More... | |
AzureIoTResult_t | AzureIoTProvisioningClient_Register (AzureIoTProvisioningClient_t *pxAzureProvClient, uint32_t ulTimeoutMilliseconds) |
Begin the provisioning process. More... | |
AzureIoTResult_t | AzureIoTProvisioningClient_GetDeviceAndHub (AzureIoTProvisioningClient_t *pxAzureProvClient, uint8_t *pucHubHostname, uint32_t *pulHostnameLength, uint8_t *pucDeviceID, uint32_t *pulDeviceIDLength) |
After a registration has been completed, get the IoT Hub hostname and device ID. More... | |
AzureIoTResult_t | AzureIoTProvisioningClient_GetExtendedCode (AzureIoTProvisioningClient_t *pxAzureProvClient, uint32_t *pulExtendedErrorCode) |
Get extended code for Provisioning failure. More... | |
AzureIoTResult_t | AzureIoTProvisioningClient_SetRegistrationPayload (AzureIoTProvisioningClient_t *pxAzureProvClient, const uint8_t *pucPayload, uint32_t ulPayloadLength) |
Set registration payload. More... | |
The middleware IoT Provisioning Client used to connect a device to Azure IoT Device Provisioning.
void AzureIoTProvisioningClient_Deinit | ( | AzureIoTProvisioningClient_t * | pxAzureProvClient | ) |
Deinitialize the Azure IoT Provisioning Client.
pxAzureProvClient | The AzureIoTProvisioningClient_t * to use for this call. |
AzureIoTResult_t AzureIoTProvisioningClient_GetDeviceAndHub | ( | AzureIoTProvisioningClient_t * | pxAzureProvClient, |
uint8_t * | pucHubHostname, | ||
uint32_t * | pulHostnameLength, | ||
uint8_t * | pucDeviceID, | ||
uint32_t * | pulDeviceIDLength | ||
) |
After a registration has been completed, get the IoT Hub hostname and device ID.
[in] | pxAzureProvClient | The AzureIoTProvisioningClient_t * to use for this call. |
[out] | pucHubHostname | The pointer to a buffer which will be populated with the IoT Hub hostname. |
[out] | pulHostnameLength | The pointer to the uint32_t which will be populated with the length of the hostname. |
[out] | pucDeviceID | The pointer to a buffer which will be populated with the device ID. |
[out] | pulDeviceIDLength | The pointer to the uint32_t which will be populated with the length of the device ID. |
AzureIoTResult_t AzureIoTProvisioningClient_GetExtendedCode | ( | AzureIoTProvisioningClient_t * | pxAzureProvClient, |
uint32_t * | pulExtendedErrorCode | ||
) |
Get extended code for Provisioning failure.
[in] | pxAzureProvClient | The AzureIoTProvisioningClient_t * to use for this call. |
[out] | pulExtendedErrorCode | The pointer to the uint32_t which will be populated with the extended code. |
AzureIoTResult_t AzureIoTProvisioningClient_Init | ( | AzureIoTProvisioningClient_t * | pxAzureProvClient, |
const uint8_t * | pucEndpoint, | ||
uint32_t | ulEndpointLength, | ||
const uint8_t * | pucIDScope, | ||
uint32_t | ulIDScopeLength, | ||
const uint8_t * | pucRegistrationID, | ||
uint32_t | ulRegistrationIDLength, | ||
AzureIoTProvisioningClientOptions_t * | pxProvisioningClientOptions, | ||
uint8_t * | pucBuffer, | ||
uint32_t | ulBufferLength, | ||
AzureIoTGetCurrentTimeFunc_t | xGetTimeFunction, | ||
const AzureIoTTransportInterface_t * | pxTransportInterface | ||
) |
Initialize the Azure IoT Provisioning Client.
[out] | pxAzureProvClient | The AzureIoTProvisioningClient_t * to use for this call. |
[in] | pucEndpoint | The IoT Provisioning Hostname. |
[in] | ulEndpointLength | The length of the IoT Provisioning Hostname. |
[in] | pucIDScope | The ID scope to use for provisioning. |
[in] | ulIDScopeLength | The length of the ID scope. |
[in] | pucRegistrationID | The registration ID to use for provisioning. |
[in] | ulRegistrationIDLength | The length of the registration ID. |
[in] | pxProvisioningClientOptions | The AzureIoTProvisioningClientOptions_t for the IoT Provisioning client instance. |
[in] | pucBuffer | The buffer to use for MQTT messages. |
[in] | ulBufferLength | bufferLength The length of the pucBuffer . |
[in] | xGetTimeFunction | A function pointer to a function which gives the current epoch time. |
[in] | pxTransportInterface | The transport interface to use for the MQTT library. |
AzureIoTResult_t AzureIoTProvisioningClient_OptionsInit | ( | AzureIoTProvisioningClientOptions_t * | pxProvisioningClientOptions | ) |
Initialize the Azure IoT Provisioning Options with default values.
[out] | pxProvisioningClientOptions | The AzureIoTProvisioningClientOptions_t instance to set with default values. |
AzureIoTResult_t AzureIoTProvisioningClient_Register | ( | AzureIoTProvisioningClient_t * | pxAzureProvClient, |
uint32_t | ulTimeoutMilliseconds | ||
) |
Begin the provisioning process.
The initial call to this function will issue the request to the service to provision this device. If this function is called with the same pxAzureProvClient after a previous call to it returned "eAzureIoTErrorPending", then the function will simply poll to see if the registration has succeeded or failed. After a successful result, AzureIoTProvisioningClient_GetDeviceAndHub() can be called to get the IoT Hub and device ID.
[in] | pxAzureProvClient | The AzureIoTProvisioningClient_t * to use for this call. |
[in] | ulTimeoutMilliseconds | Timeout in milliseconds to wait for registration to finish. |
AzureIoTResult_t AzureIoTProvisioningClient_SetRegistrationPayload | ( | AzureIoTProvisioningClient_t * | pxAzureProvClient, |
const uint8_t * | pucPayload, | ||
uint32_t | ulPayloadLength | ||
) |
Set registration payload.
This routine sets registration payload, which is JSON object.
[in] | pxAzureProvClient | The AzureIoTProvisioningClient_t * to use for this call. |
[in] | pucPayload | A pointer to registration payload. |
[in] | ulPayloadLength | Length of payload . Does not include the NULL terminator. |
AzureIoTResult_t AzureIoTProvisioningClient_SetSymmetricKey | ( | AzureIoTProvisioningClient_t * | pxAzureProvClient, |
const uint8_t * | pucSymmetricKey, | ||
uint32_t | ulSymmetricKeyLength, | ||
AzureIoTGetHMACFunc_t | xHmacFunction | ||
) |
Set the symmetric key to use for authentication.
[in] | pxAzureProvClient | The AzureIoTProvisioningClient_t * to use for this call. |
[in] | pucSymmetricKey | The symmetric key to use for the connection. |
[in] | ulSymmetricKeyLength | The length of the pucSymmetricKey . |
[in] | xHmacFunction | The AzureIoTGetHMACFunc_t function pointer to a function which computes the HMAC256 over a set of bytes. |