This is a sample client application for Azure IoT Hub. The application uses the lower level APIs with an _ll_ infix that is contained in the C SDK. This is just for learning purpose or possibly to support a resource constrained device for my project in the future. The appilcation will support the following:
- D2C and C2D message
- Device Twin (Getting desired / Updating reported props)
- Direct Methods
- Upload file to Azure storage
- Authentication: SAS key, X509
- Device Provisioning Service
- Leaf device of IoT Edge; Supporting downstream device
You will need to build Azure IoT Hub C SDK in your development environment before compiling the application. See Set up a Linux development environment and Build the C SDK on Linux.
- Ubuntu 18.04. I would recommend to build with LTS version.
- Go to azure-iot-sdk-c/iothub_client/samples, and run the following:
>git clone https://github.com/kojish/iothub_c_client
After downloading the source code, the directory should look like the following:
azure-iot-sdk-c/iothub_client/samples/iothub_c_client - Open main.c and set the connection string generated by your IoT Hub.
- Open azure-iot-sdk-c/iothub_client/samples/CMakeLists.txt. Add "add_sample_directory(iothub_c_client)" to CMakeLists.txt to be compiled.
- Go to azure-iot-sdk-c/cmake directory, and run "cmake --build ." to build the application. You will find the executable file under azure-iot-sdk-c/cmake/iothub_client/samples/iothub_c_client directory. The file name is iothub_c_client.
- You can also run the "cmake --build ." command under azure-iot-sdk-c/cmake/iothub_client/sample/iothub_c_client diredtory after the initial build.