Skip to content

Commit 8a4a4e4

Browse files
authored
Merge pull request #78860 from itechedit/six-iot-hub-quickstarts-2
edit pass: six IoT Hub quickstarts
2 parents 289d984 + ace706d commit 8a4a4e4

9 files changed

+303
-312
lines changed

articles/iot-hub/quickstart-device-streams-echo-c.md

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Communicate to a device app in C via Azure IoT Hub device streams (preview) | Microsoft Docs
3-
description: In this quickstart, you will run a C service-side application that communicates with an IoT device via a device stream.
3+
description: In this quickstart, you run a C device-side application that communicates with an IoT device via a device stream.
44
author: rezasherafat
55
manager: briz
66
ms.service: iot-hub
@@ -16,69 +16,66 @@ ms.author: rezas
1616

1717
[!INCLUDE [iot-hub-quickstarts-3-selector](../../includes/iot-hub-quickstarts-3-selector.md)]
1818

19-
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/).
2020

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:
2222

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)
2625

2726
The device-side C application in this quickstart has the following functionality:
2827

2928
* Establish a device stream to an IoT device.
29+
* Receive data that's sent from the service-side application and echo it back.
3030

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.
3432

3533
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
3634

3735
If you don’t have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
3836

3937
## Prerequisites
4038

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:
4440

45-
* **Central US EUAP**
41+
* Central US
42+
* Central US EUAP
4643

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.
4845

4946
* Install the latest version of [Git](https://git-scm.com/download/).
5047

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.
5249

5350
```azurecli-interactive
5451
az extension add --name azure-cli-iot-ext
5552
```
5653

5754
## Prepare the development environment
5855

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.
6057

6158
1. Download the [CMake build system](https://cmake.org/download/).
6259

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.
6461

6562
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:
6663

6764
```
6865
git clone https://github.com/Azure/azure-iot-sdk-c.git --recursive -b public-preview
6966
```
7067
71-
You should expect this operation to take a few minutes.
68+
This operation should take a few minutes.
7269
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.
7471
7572
```
7673
cd azure-iot-sdk-c
7774
mkdir cmake
7875
cd cmake
7976
```
8077
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.
8279
8380
* In Linux:
8481
@@ -87,7 +84,7 @@ For this quickstart, you will be using the [Azure IoT device SDK for C](iot-hub-
8784
make -j
8885
```
8986
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.
9188
9289
```cmd
9390
rem For VS2015
@@ -106,41 +103,40 @@ For this quickstart, you will be using the [Azure IoT device SDK for C](iot-hub-
106103
107104
## Register a device
108105
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.
110107
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:
112109
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.
116113
117114
```azurecli-interactive
118115
az iot hub device-identity create --hub-name YourIoTHubName --device-id MyDevice
119116
```
120117
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:
122119
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.
124122
125123
```azurecli-interactive
126124
az iot hub device-identity show-connection-string --hub-name YourIoTHubName --device-id MyDevice --output table
127125
```
128126
129-
Make a note of the device connection string, which looks like the following example:
127+
Note the device connection string for later use in this quickstart. It looks like the following example:
130128
131129
`HostName={YourIoTHubName}.azure-devices.net;DeviceId=MyDevice;SharedAccessKey={YourSharedAccessKey}`
132130
133-
You use this value later in the quickstart.
134-
135-
## Communicate between device and service via device streams
131+
## Communicate between the device and the service via device streams
136132
137133
In this section, you run both the device-side application and the service-side application and communicate between the two.
138134
139135
### Run the device-side application
140136
141-
To run the device-side application, you need to perform the following steps:
137+
To run the device-side application, do the following:
142138
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.
144140
145141
```C
146142
/* Paste in your iothub connection string */
@@ -177,21 +173,20 @@ To run the device-side application, you need to perform the following steps:
177173

178174
### Run the service-side application
179175

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:
181177

182178
* [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)
185180

186181
## Clean up resources
187182

188183
[!INCLUDE [iot-hub-quickstarts-clean-up-resources-device-streams](../../includes/iot-hub-quickstarts-clean-up-resources-device-streams.md)]
189184

190185
## Next steps
191186

192-
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.
193188

194-
Use the links below to learn more about device streams:
189+
To learn more about device streams, see:
195190

196191
> [!div class="nextstepaction"]
197-
> [Device streams overview](./iot-hub-device-streams-overview.md)
192+
> [Device streams overview](./iot-hub-device-streams-overview.md)

0 commit comments

Comments
 (0)