platform | device | language |
---|---|---|
windows |
desktop |
c |
About this document
This document describes how to build and run sample applications on the Windows platform. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device
You should have the following items ready before beginning the process:
- Prepare your development environment
- Computer with Git client installed and access to the azure-iot-sdks GitHub public repository.
- Setup your IoT hub
- Provision your device and get its credentials
-
Start a new instance of Visual Studio 2015. Open the azure_iot_sdks.sln solution in the cmake folder in your home directory.
-
In Visual Studio, in Solution Explorer, navigate to project based on your choice of protocol:
For AMQP protocol:
Navigate to simplesample_amqp project and open the simplesample_amqp.c file.
For HTTP protocol:
Navigate to simplesample_http project and open the simplesample_http.c file.
For MQTT protocol:
Navigate to simplesample_mqtt project and open the simplesample_mqtt.c file.
-
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 and save the changes:
static const char* connectionString = "HostName=..."
-
In Solution Explorer, right-click the project updated, click Debug, and then click Start new instance to build and run the sample.
-
The console displays messages as the application sends device-to-cloud messages to IoT Hub.
-
See Manage IoT Hub to learn how to observe the messages IoT Hub receives from the application and how to send cloud-to-device messages to the application.