Azure IoT Examples

Our SDK supports all examples provided in Azure Embedded C SDK. In this section, we will provide an overview of each example and introduce how to enable them in our SDK. Readers can expect the same results described in Sample Descriptions on Azure Embedded C SDK and interact with the examples according to it.

IoT Hub Samples

C2D:

This sample receives incoming cloud-to-device (C2D) messages sent from the Azure IoT Hub to the device. X509 Certificate is used to connect to IoT Hub.

  • Select the IoT Hub C2D example in example_azure_iot_entry.h

Uncomment EXAMPLE_AZURE_IOT_HUB_C2D to select the example.

  • Change the parameters in example_azure_iot_hub_c2d.c

Modify HUB_HOSTNAME to your own IoT Hub name.

Modify HUB_DEVICE_ID to your own IoT Hub device id.

Modify X509CERTIFICATE to your own x509 certificate.

Modify X509PRIVATEKEY to your own x509 private key.

IoT Provisioning Samples

X509:

This sample registers a device with the Azure IoT Device Provisioning Service. X509 Certificate is used to connect to device provisioning service.

  • For the X509 certificate used for IoT provisioning, please make sure

    your x509 certificate is created with x509 v3 extension.

X509v3 Basic Constraints: CA:FALSE
X509v3 Key Usage: Digital Signature, Non Repudiation, Key Encipherment
  • Select the IoT provisioning certificate example in example_azure_iot_entry.h

Uncomment EXAMPLE_AZURE_IOT_PROVISIONING to select the example.

  • Change the parameters in example_azure_iot_provisioning.c

Modify ID_SCOPE to your own DPS id scope.

Modify REGISTRATION_ID to your own registration id.

Modify X509CERTIFICATE to your own x509 certificate.

Modify X509PRIVATEKEY to your own x509 private key.