About this document
This document describes how to build and run sample applications on the Windows platform. This multi-step process includes:
- Preparing your development environment
- Creating and configuring and instance of Azure IoT Hub
- Build and deploy Azure IoT SDK on device
You should have the following items ready before beginning the process:
- Prepare your development environment
- 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_win32 folder in your home directory (usually C:\\users\username\).
-
In Visual Studio, in Solution Explorer, navigate to and open the following file:
IoTHub_Samples\iothub_client_device_twin_and_methods_sample\Source Files\iothub_client_device_twin_and_methods_sample.c
-
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 IoTHub_Samples\iothub_client_device_twin_and_methods_sample, click Debug, and then click Start new instance to build and run the sample.
-
As the client is running it will receive the current complete Twin json content, as well as send an update to the reported properties.