The following document describes the process of connecting an openSUSE system to Azure IoT Hub.
## Requirements- Computer with a Git client installed so that you can access the azure-iot-sdks code on GitHub.
Before you begin you will need to create and configure an IoT hub to connect to.
- Set up your IoT Hub.
- With your IoT hub configured and running in Azure, follow the instructions in Connecting your device to an IoT hub.
- Make note of the Connection String for your device from the previous step.
## Setup the development environmentNote: You can skip this step if you just want to build the sample application without running it.
This section shows you how to set up a development environment for the Azure IoT device SDK for C on openSUSE.
-
Clone this repository (azure-iot-sdks) to the machine you are using.
-
Open a shell and navigate to the folder c/build_all/linux in your local copy of the repository.
-
Run the
setup_opensuse.sh
script to install the prerequisite packages and the dependent libraries. -
Run the
build.sh
script.
This script builds the iothub_client and serializer libraries and their associated samples in a folder called "cmake" inside you home folder.
## Build and run the sampleNote: you will not be able to run the samples until you configure them with a valid IoT Hub device connection string. For more information, see Run sample on Linux.
-
Open the file c/serializer/samples/simplesample_amqp/simplesample_amqp.c in a text editor.
-
Locate the following code in the file:
static const char* connectionString = "[device connection string]";
-
Replace "[device connection string]" with the device connection string you noted earlier. Save the changes.
-
The section "Send events" in the document How to use Device Explorer describes how to prepare the DeviceExplorer tool to receive device-to-cloud messages from the sample application.
-
Save your changes and build the samples. To build your sample you can run the the build.sh script in the c/build_all/linux directory.
-
Run the ~/cmake/serializer/samples/simplesample_amqp/simplesample_amqp sample application.
-
Use the DeviceExplorer utility to observe the messages IoT Hub receives from the simplesample_amqp application.
-
See "Send cloud-to-device messages" in the document How to use Device Explorer for IoT Hub devices for instructions on sending messages with the DeviceExplorer utility.