You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-pnp/quickstart-create-pnp-device-windows.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,9 +82,9 @@ In this quickstart, you use the [Vcpkg](https://github.com/microsoft/vcpkg) libr
82
82
83
83
In this quickstart, you use an existing sample device capability model and associated interfaces.
84
84
85
-
1. Create a `pnp_app` directory in your local drive. You use this folder for the device model files and device code stub.
85
+
1. Create a `pnp_app` folder in your local drive. You use this folder for the device model files and device code stub.
86
86
87
-
1. Download the [device capability model and interface sample files](https://github.com/Azure/IoTPlugandPlay/blob/master/samples/SampleDevice.capabilitymodel.json) and [interface sample](https://github.com/Azure/IoTPlugandPlay/blob/master/samples/EnvironmentalSensor.interface.json) and save files into `pnp_app` folder.
87
+
1. Download the [device capability model and interface sample files](https://github.com/Azure/IoTPlugandPlay/blob/master/samples/SampleDevice.capabilitymodel.json) and [interface sample](https://github.com/Azure/IoTPlugandPlay/blob/master/samples/EnvironmentalSensor.interface.json) and save the files into the `pnp_app` folder.
88
88
89
89
> [!TIP]
90
90
> To download a file from GitHub, navigate to the file, right-click on **Raw**, and then select **Save link as**.
@@ -106,7 +106,7 @@ Now that you have a DCM and its associated interfaces, you can generate the devi
106
106
107
107
1. Choose the **SampleDevice.capabilitymodel.json** file to use for generating the device code stub.
108
108
109
-
1. Enter the project name **sample_device**. This will be the name of your device application.
109
+
1. Enter the project name **sample_device**. This is the name of your device application.
110
110
111
111
1. Choose **ANSI C** as your language.
112
112
@@ -121,7 +121,7 @@ Now that you have a DCM and its associated interfaces, you can generate the devi
121
121
122
122
## Build and run the code
123
123
124
-
You use the device SDK source code to build the generated device code stub. The application you build simulates a device that connects to an IoT hub. The application sends telemetry and properties and receives commands.
124
+
You use the Vcpkg package to build the generated device code stub. The application you build simulates a device that connects to an IoT hub. The application sends telemetry and properties and receives commands.
125
125
126
126
1. Create a `cmake` subdirectory in the `sample_device` folder, and navigate to that folder:
Copy file name to clipboardExpand all lines: articles/iot-pnp/tutorial-build-device-certification.md
+39-6Lines changed: 39 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ To complete this tutorial, you need:
30
30
-[Visual Studio Code](https://code.visualstudio.com/download)
31
31
-[Azure IoT Tools for VS Code](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-tools) extension pack
32
32
33
-
You also need the IoT Plug and Play device that you create in the [Quickstart: Use a device capability model to create a device](quickstart-create-pnp-device-windows.md).
33
+
You also need to complete the [Use a device capability model to create a device](quickstart-create-pnp-device-windows.md) quickstart for Windows. The quickstart shows you how to set up your development environment using Vcpkg and create a sample project.
34
34
35
35
## Store a capability model and interfaces
36
36
@@ -102,20 +102,53 @@ To certify the device, it must enable provisioning through the [Azure IoT Device
102
102
103
103
1. Choose the DCM file you want to use to generate the device code stub.
104
104
105
-
1. Enter the project name, this is the name of your device application.
105
+
1. Enter the project name, such as **sample_device**. This is the name of your device application.
1. Choose **CMake Project on Windows** or **CMake Project on Linux** as project template depending on your device OS.
111
+
1. Choose **CMake Project on Windows** as your project template.
112
+
113
+
1. Choose **Via Vcpkg** as the way to include the device SDK.
112
114
113
115
1. VS Code opens a new window with generated device code stub files.
114
116
115
-
1. After building the code, enter the DPS credentials (**DPS ID Scope**, **DPS Symmetric Key**, **Device Id**) as parameters for the application. To get the credentials from certification portal, see [Connect and test your IoT Plug and Play device](tutorial-certification-test.md#connect-and-discover-interfaces).
117
+
## Build and run the code
116
118
117
-
```cmd/sh
118
-
.\your_pnp_app.exe [DPS ID Scope] [DPS symmetric key] [device ID]
119
+
You use the Vcpkg package to build the generated device code stub. The application you build simulates a device that connects to an IoT hub. The application sends telemetry and properties and receives commands.
120
+
121
+
1. Create a `cmake` subdirectory in the `sample_device` folder, and navigate to that folder:
122
+
123
+
```cmd
124
+
mkdir cmake
125
+
cd cmake
126
+
```
127
+
128
+
1. Run the following commands to build the generated code stub (replacing the placeholder with the directory of your Vcpkg repo):
129
+
130
+
```cmd
131
+
cmake .. -G "Visual Studio 16 2019" -A Win32 -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON -DCMAKE_TOOLCHAIN_FILE="<directory of your Vcpkg repo>\scripts\buildsystems\vcpkg.cmake"
132
+
133
+
cmake --build .
134
+
```
135
+
136
+
> [!NOTE]
137
+
> If you are using Visual Studio 2017 or 2015, you need to specify the CMake generator based on the build tools you are using:
138
+
>```cmd
139
+
># Either
140
+
>cmake .. -G "Visual Studio 15 2017" -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON -DCMAKE_TOOLCHAIN_FILE="{directory of your Vcpkg repo}\scripts\buildsystems\vcpkg.cmake"
141
+
># or
142
+
>cmake .. -G "Visual Studio 14 2015" -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON -DCMAKE_TOOLCHAIN_FILE="{directory of your Vcpkg repo}\scripts\buildsystems\vcpkg.cmake"
143
+
>```
144
+
145
+
> [!NOTE]
146
+
> If cmake can't find your C++ compiler, you get build errors when you run the previous command. If that happens, try running this command at the [Visual Studio command prompt](https://docs.microsoft.com/dotnet/framework/tools/developer-command-prompt-for-vs).
147
+
148
+
1. After the build completes successfully, enter the DPS credentials (**DPS ID Scope**, **DPS Symmetric Key**, **Device Id**) as parameters for the application. To get the credentials from certification portal, see [Connect and test your IoT Plug and Play device](tutorial-certification-test.md#connect-and-discover-interfaces).
149
+
150
+
```cmd\sh
151
+
.\Debug\sample_device.exe [Device ID] [DPS ID Scope] [DPS symmetric key]
0 commit comments