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
Microsoft Azure IoT Hub currently supports device streams as a [preview feature](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
19
+
Azure IoT Hub currently supports device streams as a [preview feature](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
20
20
21
-
[IoT Hub device streams](iot-hub-device-streams-overview.md) allow service and device applications to communicate in a secure and firewall-friendly manner. During public preview, the C SDK only supports device streams on the device side. As a result, this quickstart only covers instructions to run the device-side application. You should run an accompanying service-side application, which is available in the following quickstarts:
21
+
[IoT Hub device streams](iot-hub-device-streams-overview.md) allow service and device applications to communicate in a secure and firewall-friendly manner. During public preview, the C SDK supports device streams on the device side only. As a result, this quickstart covers instructions to run only the device-side application. To run an accompanying service-side application, see:
22
22
23
-
*[Communicating to device apps in C# via IoT Hub device streams](./quickstart-device-streams-echo-csharp.md)
24
-
25
-
*[Communicating to device apps in Nodejs via IoT Hub device streams](./quickstart-device-streams-echo-nodejs.md).
23
+
*[Communicate to device apps in C# via IoT Hub device streams](./quickstart-device-streams-echo-csharp.md)
24
+
*[Communicate to device apps in Node.js via IoT Hub device streams](./quickstart-device-streams-echo-nodejs.md)
26
25
27
26
The device-side C application in this quickstart has the following functionality:
28
27
29
28
* Establish a device stream to an IoT device.
29
+
* Receive data that's sent from the service-side application and echo it back.
30
30
31
-
* Receive data sent from the service-side and echo it back.
32
-
33
-
The code will demonstrate the initiation process of a device stream, as well as how to use it to send and receive data.
31
+
The code demonstrates the initiation process of a device stream, as well as how to use it to send and receive data.
If you don’t have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
38
36
39
37
## Prerequisites
40
38
41
-
* The preview of device streams is currently only supported for IoT Hubs created in the following regions:
42
-
43
-
***Central US**
39
+
* The preview of device streams is currently supported only for IoT hubs that are created in the following regions:
44
40
45
-
***Central US EUAP**
41
+
* Central US
42
+
* Central US EUAP
46
43
47
-
* Install [Visual Studio 2017](https://www.visualstudio.com/vs/) with the ['Desktop development with C++'](https://www.visualstudio.com/vs/support/selecting-workloads-visual-studio-2017/) workload enabled.
44
+
* Install [Visual Studio 2017](https://www.visualstudio.com/vs/) with the [Desktop development with C++](https://www.visualstudio.com/vs/support/selecting-workloads-visual-studio-2017/) workload enabled.
48
45
49
46
* Install the latest version of [Git](https://git-scm.com/download/).
50
47
51
-
* Run the following command to add the Microsoft Azure IoT Extension for Azure CLI to your Cloud Shell instance. The IOT Extension adds IoT Hub, IoT Edge, and IoT Device Provisioning Service (DPS)specific commands to Azure CLI.
48
+
* Run the following command to add the Azure IoT Extension for Azure CLI to your Cloud Shell instance. The IOT Extension adds IoT Hub, IoT Edge, and IoT Device Provisioning Service (DPS)-specific commands to the Azure CLI.
52
49
53
50
```azurecli-interactive
54
51
az extension add --name azure-cli-iot-ext
55
52
```
56
53
57
54
## Prepare the development environment
58
55
59
-
For this quickstart, you will be using the [Azure IoT device SDK for C](iot-hub-device-sdk-c-intro.md). You will prepare a development environment used to clone and build the [Azure IoT C SDK](https://github.com/Azure/azure-iot-sdk-c) from GitHub. The SDK on GitHub includes the sample code used in this quickstart.
56
+
For this quickstart, you use the [Azure IoT device SDK for C](iot-hub-device-sdk-c-intro.md). You prepare a development environment used to clone and build the [Azure IoT C SDK](https://github.com/Azure/azure-iot-sdk-c) from GitHub. The SDK on GitHub includes the sample code that's used in this quickstart.
60
57
61
58
1. Download the [CMake build system](https://cmake.org/download/).
62
59
63
-
It is important that the Visual Studio prerequisites (Visual Studio and the 'Desktop development with C++' workload) are installed on your machine, **before** starting the `CMake` installation. Once the prerequisites are in place, and the download is verified, install the CMake build system.
60
+
Before you start the CMake installation, it's important that the Visual Studio prerequisites (Visual Studio and the *Desktop development with C++* workload) are installed on your machine. After the prerequisites are in place and you've verified the download, you can install the CMake build system.
64
61
65
62
2. Open a command prompt or Git Bash shell. Execute the following command to clone the [Azure IoT C SDK](https://github.com/Azure/azure-iot-sdk-c) GitHub repository:
You should expect this operation to take a few minutes.
68
+
This operation should take a few minutes.
72
69
73
-
3. Create a `cmake` subdirectory in the root directory of the git repository, and navigate to that folder.
70
+
3. Create a *cmake* subdirectory in the root directory of the Git repository, as shown in the following command, and then go to that folder.
74
71
75
72
```
76
73
cd azure-iot-sdk-c
77
74
mkdir cmake
78
75
cd cmake
79
76
```
80
77
81
-
4. Run the following commands from the `cmake` directory to build a version of the SDK specific to your development client platform.
78
+
4. Run the following commands from the *cmake* directory to build a version of the SDK that's specific to your development client platform.
82
79
83
80
* In Linux:
84
81
@@ -87,7 +84,7 @@ For this quickstart, you will be using the [Azure IoT device SDK for C](iot-hub-
87
84
make -j
88
85
```
89
86
90
-
* In Windows, run the following commands in Developer Command Prompt for Visual Studio 2015 or 2017. A Visual Studio solution for the simulated device will be generated in the `cmake` directory.
87
+
* In Windows, run the following commands in Developer Command Prompt for Visual Studio 2015 or 2017. A Visual Studio solution for the simulated device will be generated in the *cmake* directory.
91
88
92
89
```cmd
93
90
rem For VS2015
@@ -106,41 +103,40 @@ For this quickstart, you will be using the [Azure IoT device SDK for C](iot-hub-
106
103
107
104
## Register a device
108
105
109
-
A device must be registered with your IoT hub before it can connect. In this section, you will use the Azure Cloud Shell with the [IoT extension](https://docs.microsoft.com/cli/azure/ext/azure-cli-iot-ext/iot?view=azure-cli-latest) to register a simulated device.
106
+
You must register a device with your IoT hub before it can connect. In this section, you use Azure Cloud Shell with the [IoT Extension](https://docs.microsoft.com/cli/azure/ext/azure-cli-iot-ext/iot?view=azure-cli-latest) to register a simulated device.
110
107
111
-
1. Run the following command in Azure Cloud Shell to create the device identity.
108
+
1. To create the device identity, run the following command in Cloud Shell:
112
109
113
-
**YourIoTHubName**: Replace this placeholder below with the name you choose for your IoT hub.
114
-
115
-
**MyDevice**: This is the name given for the registered device. Use MyDevice as shown. If you choose a different name for your device, you will also need to use that name throughout this article, and update the device name in the sample applications before you run them.
110
+
> [!NOTE]
111
+
> * Replace the *YourIoTHubName* placeholder with the name you choose for your IoT hub.
112
+
> * Use *MyDevice*, as shown. It's the name given for the registered device. If you choose a different name for your device, use that name throughout this article, and update the device name in the sample applications before you run them.
116
113
117
114
```azurecli-interactive
118
115
az iot hub device-identity create --hub-name YourIoTHubName --device-id MyDevice
119
116
```
120
117
121
-
2. Run the following commands in Azure Cloud Shell to get the *device connection string* for the device you just registered:
118
+
2. To get the *device connection string* for the device that you just registered, run the following commands in Cloud Shell:
122
119
123
-
**YourIoTHubName**: Replace this placeholder below with the name you choose for your IoT hub.
120
+
> [!NOTE]
121
+
> Replace the *YourIoTHubName* placeholder with the name you choose for your IoT hub.
## Communicate between device and service via device streams
131
+
## Communicate between the device and the service via device streams
136
132
137
133
In this section, you run both the device-side application and the service-side application and communicate between the two.
138
134
139
135
### Run the device-side application
140
136
141
-
To run the device-side application, you need to perform the following steps:
137
+
To run the device-side application, do the following:
142
138
143
-
1. Provide your device credentials by editing the source file `iothub_client_c2d_streaming_sample.c` in the folder `iothub_client/samples/iothub_client_c2d_streaming_sample` and providing your device connection string.
139
+
1. Provide your device credentials by editing the *iothub_client_c2d_streaming_sample.c* source file in the *iothub_client/samples/iothub_client_c2d_streaming_sample* folder and then providing your device connection string.
144
140
145
141
```C
146
142
/* Paste in your iothub connection string */
@@ -177,21 +173,20 @@ To run the device-side application, you need to perform the following steps:
177
173
178
174
### Run the service-side application
179
175
180
-
As mentioned previously, the IoT Hub C SDK only supports device streams on the device side. To build and run the service-side application, follow the steps available in one of the following quickstarts:
176
+
As mentioned previously, the IoT Hub C SDK supports device streams on the device side only. To build and run the service-side application, follow the instructions in one of the following quickstarts:
181
177
182
178
*[Communicate to a device app in C# via IoT Hub device streams](./quickstart-device-streams-echo-csharp.md)
183
-
184
-
*[Communicate to a device app in Node.js via IoT Hub device streams](./quickstart-device-streams-echo-nodejs.md).
179
+
*[Communicate to a device app in Node.js via IoT Hub device streams](./quickstart-device-streams-echo-nodejs.md)
In this quickstart, you have set up an IoT hub, registered a device, established a device stream between a C application on the device and another application on the service side, and used the stream to send data back and forth between the applications.
187
+
In this quickstart, you've set up an IoT hub, registered a device, established a device stream between a C application on the device and another application on the service side, and used the stream to send data back and forth between the applications.
193
188
194
-
Use the links below to learn more about device streams:
0 commit comments