Skip to content

Latest commit

 

History

History

samples

Samples for the Azure IoT device SDK for C

This folder contains simple samples showing how to use the various features of the Microsoft Azure IoT Hub service from a device running C code.

List of samples

  • Simple send and receive messages:

    • iothub_client_sample_mqtt: send and receive messages from a single device over an MQTT connection
    • iothub_client_sample_mqtt_websockets: send and receive messages from a single device over an MQTT over WebSockets connection
    • iothub_client_sample_amqp: send and receive messages from a single device over an AMQP connection
    • iothub_client_sample_amqp_websockets: send and receive messages from a single device over an AMQP over WebSockets connection
    • iothub_client_sample_http: send and receive messages from a single device over an HTTP connection
  • Multiplexing send and receive of several devices over a single connection (useful in Gateway scenarios where multiplexing might be needed):

    • iothub_client_sample_amqp_shared: send and receive messages from 2 devices over a single AMQP connection
    • iothub_ll_client_sample_amqp_shared: send and receive messages from 2 devices over a single AMQP connection using the lower level API set of the SDK
    • iothub_client_sample_amqp_websockets_shared: send and receive messages from 2 devices over a single AMQP over Websockets connection
    • iothub_client_sample_http_shared: send and receive messages from 2 devices over a single HTTP connection (multiplexing) (useful in Gateway scenarios)
  • Device services samples (Device Twins, Methods, and Device Management):

    • iothub_client_sample_device_method: Implements a simple Cloud to Device Direct Method
    • iothub_client_sample_mqtt_dm: Shows the implementation of a firmware update of a device (Raspberry Pi 3)
  • Uploading blob to Azure:

    • iothub_client_sample_upload_to_blob: Uploads a blob to Azure through IoT Hub

How to compile and run the samples

Prior to running the samples, you will need to have an instance of Azure IoT Hub available and a device Identity created in the hub.

It is recommended to leverage the library packages when available to run the samples, but sometimes you will need to compile the SDK for/on your device in order to be able to run the samples.

This document describes in detail how to prepare your development environment as well as how to run the samples on Linux, Windows or other platforms.