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-linux.md
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,23 +54,23 @@ You can find your _company model repository connection string_ in the [Azure Cer
54
54
55
55
## Prepare an IoT hub
56
56
57
-
You need an Azure IoT hub in your Azure subscription to complete this quickstart. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
57
+
You also need an Azure IoT hub in your Azure subscription to complete this quickstart. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin. If you don't have an IoT hub, there will be steps to create one below.
58
58
59
59
If you're using the Azure CLI locally, the `az` version should be **2.0.75** or later, the Azure Cloud Shell uses the latest version. Use the `az --version` command to check the version installed on your machine.
60
60
61
-
Add the Microsoft Azure IoT Extension for Azure CLI:
61
+
Run the following command to add the Microsoft Azure IoT Extension for Azure CLI to your Cloud Shell instance:
62
62
63
63
```azurecli-interactive
64
64
az extension add --name azure-cli-iot-ext
65
65
```
66
66
67
67
The steps in this quickstart require version **0.8.5** or later of the extension. Use the `az extension list` command to check the version you have installed, and the `az extension update` command to update if necessary.
68
68
69
-
If don't have an IoT hub, create one using the following commands, replacing `{YourIoTHubName}` with a unique name of your choice. If you're running these commands locally, first sign in to your Azure subscription using `az login`. If you're running these commands in the Azure cloud shell, you're signed in automatically:
69
+
If don't have an IoT hub, create one using the following commands, replacing `<YourIoTHubName>` with a unique name of your choice. If you're running these commands locally, first sign in to your Azure subscription using `az login`. If you're running these commands in the Azure cloud shell, you're signed in automatically:
70
70
71
71
```azurecli-interactive
72
72
az group create --name pnpquickstarts_rg --location centralus
73
-
az iot hub create --name {YourIoTHubName} \
73
+
az iot hub create --name <YourIoTHubName> \
74
74
--resource-group pnpquickstarts_rg --sku S1
75
75
```
76
76
@@ -79,23 +79,23 @@ The previous commands create a resource group called `pnpquickstarts_rg` and an
79
79
> [!IMPORTANT]
80
80
> During public preview, IoT Plug and Play features are only available on IoT hubs created in the **Central US**, **North Europe**, and **Japan East** regions.
81
81
82
-
Run the following command to create a device identity fora device called `mypnpdevice`in your IoT hub. Replace the `{YourIoTHubName}` placeholder with the name of your IoT hub:
82
+
Run the following command to create a device identity in your IoT hub. Replace the **YourIoTHubName** and **YourDevice** placeholders with your actual names.
83
83
84
84
```azurecli-interactive
85
-
az iot hub device-identity create --hub-name {YourIoTHubName} --device-id mypnpdevice
85
+
az iot hub device-identity create --hub-name <YourIoTHubName> --device-id <YourDevice>
86
86
```
87
87
88
-
Run the following commands to get the _device connection string_ forthe device you just registered. You need this connection string laterin this quickstart:
88
+
Run the following commands to get the _device connection string_ for the device you just registered.
1. In the files you downloaded, replace `<YOUR_COMPANY_NAME_HERE>` in the `@id` and `schema` fields with a unique value. Use only the characters a-z, A-Z, 0-9, and underscore. For more information, see [Digital Twin identifier format](https://github.com/Azure/IoTPlugandPlay/tree/master/DTDL#digital-twin-identifier-format).
118
118
119
119
## Generate the C code stub
120
120
121
-
Now you have a DCM and its associated interfaces, you can generate the device code that implements the model. To generate the C code stub in VS code:
121
+
Now that you have a DCM and its associated interfaces, you can generate the device code that implements the model. To generate the C code stub in VS Code:
122
122
123
-
1. With the `pnp_app` folder open in VS code, use **Ctrl+Shift+P** to open the command palette, enter **IoT Plug and Play**, and select**Generate Device Code Stub**.
123
+
1. With the `pnp_app` folder open in VS Code, use **Ctrl+Shift+P** to open the command palette, enter **IoT Plug and Play**, and select **Generate Device Code Stub**.
124
124
125
125
> [!NOTE]
126
-
> The first time you use the IoT Plug and Play Code Generator utility, it takes a few seconds to download.
126
+
> The first time you use the IoT Plug and Play Code Generator utility, it takes a few seconds to download and install automatically.
127
127
128
-
1. Choose the **SampleDevice.capabilitymodel.json** file to use to generate the device code stub.
128
+
1. Choose the **SampleDevice.capabilitymodel.json** file to use for generating the device code stub.
129
129
130
-
1. Enter the project name **sample_device**, it will be the name of your device application.
130
+
1. Enter the project name **sample_device**. This will be the name of your device application.
1. Choose **CMake Project on Linux** as your project template.
137
137
138
-
1. Choose **Via Source Code** as the way to include the SDK.
138
+
1. Choose **Via Source Code** as the way to include the device SDK.
139
139
140
-
1. VS Code opens a new window with generated device code stub files.
140
+
1. A new folder called **sample_device** is created in the same location as the DCM file, and in it are the generated device code stub files. VS Code opens a new window to display these.
1. The device application starts sending data to IoT Hub.
@@ -192,25 +192,25 @@ To validate the device code with the **az** CLI, you need to publish the files t
192
192
> [!NOTE]
193
193
> The connection string is only required the first time you connect to the repository.
194
194
195
-
1. In VS Code output window and notification, you can check the files have been published successfully.
195
+
1. In VS Code output window and notification, you can check that the files have been published successfully.
196
196
197
197
> [!NOTE]
198
198
> If you get errors on publishing the device model files, you can try use command **IoT Plug and Play: Sign out Model Repository** to sign out and go through the steps again.
199
199
200
200
### Use the Azure IoT CLI to validate the code
201
201
202
-
After the device client sample starts, you can check it's working with the Azure CLI.
202
+
After the device client sample starts, you can check that it's working with the Azure CLI.
203
203
204
204
Use the following command to view the telemetry the sample device is sending. You may need to wait a minute or two before you see any telemetry in the output:
205
205
206
206
```azurecli-interactive
207
-
az iot dt monitor-events --hub-name {your IoT hub} --device-id mypnpdevice
207
+
az iot dt monitor-events --hub-name <YourIoTHubNme>--device-id <YourDevice>
208
208
```
209
209
210
210
Use the following command to view all the properties sent by the device:
211
211
212
212
```azurecli-interactive
213
-
az iot dt list-properties --device-id mypnpdevice --hub-name {Your IoT hub name} --source private --repo-login "{Your company model repository connection string}"
213
+
az iot dt list-properties --device-id <YourDevice> --hub-name <YourIoTHubNme>--source private --repo-login "<Your company model repository connection string>"
214
214
```
215
215
216
216
## Next steps
@@ -220,4 +220,4 @@ In this quickstart, you learned how to create an IoT Plug and Play device using
220
220
To learn more about DCMs and how to create your own models, continue to the tutorial:
221
221
222
222
> [!div class="nextstepaction"]
223
-
> [Tutorial: Create a test a device capability model using Visual Studio Code](tutorial-pnp-visual-studio-code.md)
223
+
> [Tutorial: Create andtest a device capability model using Visual Studio Code](tutorial-pnp-visual-studio-code.md)
Copy file name to clipboardExpand all lines: articles/iot-pnp/quickstart-create-pnp-device.md
+30-38Lines changed: 30 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Create an IoT Plug and Play Preview device | Microsoft Docs
2
+
title: Create an IoT Plug and Play Preview device (Windows) | Microsoft Docs
3
3
description: Use a device capability model to generate device code. Then run the device code and see the device connect to your IoT Hub.
4
4
author: miagdp
5
5
ms.author: miag
@@ -45,43 +45,35 @@ You can find your _company model repository connection string_ in the [Azure Cer
45
45
46
46
## Prepare an IoT hub
47
47
48
-
You also need an Azure IoT hub in your Azure subscription to complete this quickstart. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
48
+
You also need an Azure IoT hub in your Azure subscription to complete this quickstart. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin. If you don't have an IoT hub, follow [these instructions to create one](../iot-hub/iot-hub-create-using-cli.md).
49
49
50
-
> [!NOTE]
50
+
> [!IMPORTANT]
51
51
> During public preview, IoT Plug and Play features are only available on IoT hubs created in the **Central US**, **North Europe**, and **Japan East** regions.
52
52
53
-
Add the Microsoft Azure IoT Extension for Azure CLI:
53
+
Run the following command to add the Microsoft Azure IoT Extension for Azure CLI to your Cloud Shell instance:
54
54
55
55
```azurecli-interactive
56
56
az extension add --name azure-cli-iot-ext
57
57
```
58
58
59
-
Run the following command to create the device identity in your IoT hub. Replace the **YourIoTHubName** and **YourDevice** placeholders with your actual names. If you don't have an IoT Hub, follow [these instructions to create one](../iot-hub/iot-hub-create-using-cli.md):
59
+
Run the following command to create the device identity in your IoT hub. Replace the **YourIoTHubName** and **YourDevice** placeholders with your actual names.
60
60
61
61
```azurecli-interactive
62
-
az iot hub device-identity create --hub-name [YourIoTHubName] --device-id [YourDevice]
62
+
az iot hub device-identity create --hub-name <YourIoTHubName> --device-id <YourDevice>
63
63
```
64
64
65
-
Run the following commands to get the _device connection string_ for the device you just registered:
65
+
Run the following command to get the _device connection string_ for the device you just registered:
@@ -113,9 +105,9 @@ In this quickstart, you prepare a development environment by installing the Azur
113
105
114
106
In this quickstart, you use an existing sample device capability model and associated interfaces.
115
107
116
-
1. Create a `pnp_app` directory in your local drive.
108
+
1. Create a `pnp_app` directory in your local drive. You use this folder for the device model files and device code stub.
117
109
118
-
1. Download the [device capability model](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.
110
+
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.
119
111
120
112
> [!TIP]
121
113
> To download a file from GitHub, navigate to the file, right-click on **Raw**, and then select **Save link as**.
@@ -130,29 +122,29 @@ In this quickstart, you use an existing sample device capability model and assoc
130
122
131
123
Now that you have a DCM and its associated interfaces, you can generate the device code that implements the model. To generate the C code stub in VS Code:
132
124
133
-
1. With the folder with DCM files open, use **Ctrl+Shift+P** to open the command palette, enter **IoT Plug and Play**, and select **Generate Device Code Stub**.
125
+
1. With the `pnp_app` folder open in VS Code, use **Ctrl+Shift+P** to open the command palette, enter **IoT Plug and Play**, and select **Generate Device Code Stub**.
134
126
135
127
> [!NOTE]
136
128
> The first time you use the IoT Plug and Play CodeGen CLI, it takes a few seconds to download and install automatically.
137
129
138
-
1. Choose the DCM file you want to use to generate the device code stub.
130
+
1. Choose the **SampleDevice.capabilitymodel.json** file to use for generating the device code stub.
139
131
140
-
1. Enter the project name **sample_device**, it will be the name of your device application.
132
+
1. Enter the project name **sample_device**. This will be the name of your device application.
1. Choose **CMake Project on Windows** as project template.
138
+
1. Choose **CMake Project on Windows** as your project template.
147
139
148
140
1. Choose **Via Vcpkg** as way to include the device SDK.
149
141
150
142
1. A new folder called **sample_device** is created in the same location as the DCM file, and in it are the generated device code stub files. VS Code opens a new window to display these.
You build the generated device code stub together with the device SDK. The application you build simulates a device that connects to an IoT hub. The application sends telemetry and properties and receives commands.
147
+
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.
156
148
157
149
1. Create a `cmake` subdirectory in the `sample_device` folder, and navigate to that folder:
158
150
@@ -164,7 +156,7 @@ You build the generated device code stub together with the device SDK. The appli
164
156
1. Run the following commands to build the generated code stub (replacing the placeholder with the directory of your Vcpkg repo):
165
157
166
158
```cmd\sh
167
-
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"
159
+
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"
168
160
169
161
cmake --build .
170
162
```
@@ -184,7 +176,7 @@ You build the generated device code stub together with the device SDK. The appli
184
176
1. After the build completes successfully, run your application, passing the IoT hub device connection string as a parameter.
1. The device application starts sending data to IoT Hub.
@@ -197,7 +189,7 @@ You build the generated device code stub together with the device SDK. The appli
197
189
198
190
To validate the device code with **Azure IoT Explorer**, you need to publish the files to the model repository.
199
191
200
-
1. With the folder with DCM files open in VS Code, use **Ctrl+Shift+P** to open the command palette, type and select **IoT Plug & Play: Submit files to Model Repository**.
192
+
1. With the `pnp_app` folder open in VS Code, use **Ctrl+Shift+P** to open the command palette, type and select **IoT Plug & Play: Submit files to Model Repository**.
201
193
202
194
1. Select `SampleDevice.capabilitymodel.json` and `EnvironmentalSensor.interface.json` files.
203
195
@@ -213,9 +205,9 @@ To validate the device code with **Azure IoT Explorer**, you need to publish the
213
205
214
206
### Use the Azure IoT explorer to validate the code
215
207
216
-
1. Open Azure IoT explorer, you see the **App configurations** page.
208
+
1. Open Azure IoT explorer. You see the **App configurations** page.
217
209
218
-
1. Enter your IoT Hub connection string and click **Connect**.
210
+
1. Enter your _IoT Hub connection string_ and select **Connect**.
219
211
220
212
1. After you connect, you see the device overview page.
221
213
@@ -227,25 +219,25 @@ To validate the device code with **Azure IoT Explorer**, you need to publish the
227
219
228
220
1. Select the **Telemetry** page and hit _Start_ to view the telemetry data the device is sending.
229
221
230
-
1. Select the **Properties(non-writable)** page to view the non-writable properties reported by the device.
222
+
1. Select the **Properties(non-writable)** page to view the non-writable properties reported by the device.
231
223
232
-
1. Select the **Properties(writable)** page to view the writable properties you can update.
224
+
1. Select the **Properties(writable)** page to view the writable properties you can update.
233
225
234
226
1. Expand property **name**, update with a new name and select **Update writable property**.
235
227
236
-
1. To see the new name shows up in the **Reported Property** column, click the **Refresh** button on top of the page.
228
+
1. To see the new name show up in the **Reported Property** column, select the **Refresh** button on top of the page.
237
229
238
-
1. Select the **Command** page to view all the commands the device supports.
230
+
1. Select the **Commands** page to view all the commands the device supports.
239
231
240
232
1. Expand the **blink** command and set a new blink time interval. Select **Send command** to call the command on the device.
241
233
242
-
1. Go to the simulated device to verify that the command executed as expected.
234
+
1. Go to the simulated device command prompt and read through the printed confirmation messages, to verify that the commands have executed as expected.
243
235
244
236
## Next steps
245
237
246
238
In this quickstart, you learned how to create an IoT Plug and Play device using a DCM.
247
239
248
-
To learn more about IoT Plug and Play, continue to the tutorial:
240
+
To learn more about DCMs and how to create your own models, continue to the tutorial:
249
241
250
242
> [!div class="nextstepaction"]
251
-
> [Create and test a device capability model using Visual Studio Code](tutorial-pnp-visual-studio-code.md)
243
+
> [Tutorial: Create and test a device capability model using Visual Studio Code](tutorial-pnp-visual-studio-code.md)
0 commit comments