Skip to content

Commit 4339fb1

Browse files
authored
Merge pull request #42613 from dominicbetts/suite-retire-part-1
Revert "Retire old content"
2 parents 1498425 + 811c0df commit 4339fb1

File tree

68 files changed

+2055
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2055
-50
lines changed

.openpublishing.redirection.json

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8765,56 +8765,6 @@
87658765
"redirect_url": "/azure/cognitive-services/video-indexer/video-indexer-get-started",
87668766
"redirect_document_id": false
87678767
},
8768-
{
8769-
"source_path": "articles/iot-suite/iot-suite-v1-connecting-devices.md",
8770-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-connecting-devices.md",
8771-
"redirect_document_id": false
8772-
},
8773-
{
8774-
"source_path": "articles/iot-suite/iot-suite-v1-connecting-devices-linux.md",
8775-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-connecting-devices-linux.md",
8776-
"redirect_document_id": false
8777-
},
8778-
{
8779-
"source_path": "articles/iot-suite/iot-suite-v1-connecting-devices-node.md",
8780-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-connecting-devices-node.md",
8781-
"redirect_document_id": false
8782-
},
8783-
{
8784-
"source_path": "articles/iot-suite/iot-suite-v1-custom-rule.md",
8785-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-custom-rule.md",
8786-
"redirect_document_id": false
8787-
},
8788-
{
8789-
"source_path": "articles/iot-suite/iot-suite-v1-dynamic-telemetry.md",
8790-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-dynamic-telemetry.md",
8791-
"redirect_document_id": false
8792-
},
8793-
{
8794-
"source_path": "articles/iot-suite/iot-suite-v1-faq.md",
8795-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-faq.md",
8796-
"redirect_document_id": false
8797-
},
8798-
{
8799-
"source_path": "articles/iot-suite/iot-suite-v1-getstarted-preconfigured-solutions.md",
8800-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-getstarted-preconfigured-solutions.md",
8801-
"redirect_document_id": false
8802-
},
8803-
{
8804-
"source_path": "articles/iot-suite/iot-suite-v1-guidance-on-customizing-preconfigured-solutions.md",
8805-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-guidance-on-customizing-preconfigured-solutions.md",
8806-
"redirect_document_id": false
8807-
},
8808-
{
8809-
"source_path": "articles/iot-suite/iot-suite-v1-logic-apps-tutorial.md",
8810-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-logic-apps-tutorial.md",
8811-
"redirect_document_id": false
8812-
},
8813-
{
8814-
"source_path": "articles/iot-suite/iot-suite-v1-permissions.md",
8815-
"redirect_url": "https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Tutorials/iot-suite-v1-permissions.md",
8816-
"redirect_document_id": false
8817-
},
88188768
{
88198769
"source_path": "articles/iot-suite/iot-solution-build-system.md",
88208770
"redirect_url": "https://github.com/Azure-Samples/MyDriving/blob/master/docs/iot-solution-build-system.md",
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
title: Connect a device using C on Linux | Microsoft Docs
3+
description: Describes how to connect a device to the Azure IoT Suite preconfigured remote monitoring solution using an application written in C running on Linux.
4+
services: ''
5+
suite: iot-suite
6+
documentationcenter: na
7+
author: dominicbetts
8+
manager: timlt
9+
editor: ''
10+
11+
ms.assetid: 0c7c8039-0bbf-4bb5-9e79-ed8cff433629
12+
ms.service: iot-suite
13+
ms.devlang: na
14+
ms.topic: article
15+
ms.tgt_pltfrm: na
16+
ms.workload: na
17+
ms.date: 11/02/2017
18+
ms.author: dobett
19+
20+
---
21+
# Connect your device to the remote monitoring preconfigured solution (Linux)
22+
[!INCLUDE [iot-suite-v1-selector-connecting](../../includes/iot-suite-v1-selector-connecting.md)]
23+
24+
## Build and run a sample C client Linux
25+
The following steps show you how to create a client application that communicates with the remote monitoring preconfigured solution. This application is written in C and built and run on Ubuntu Linux.
26+
27+
To complete these steps, you need a device running Ubuntu version 15.04 or 15.10. Before proceeding, install the prerequisite packages on your Ubuntu device using the following command:
28+
29+
```
30+
sudo apt-get install cmake gcc g++
31+
```
32+
33+
## Install the client libraries on your device
34+
The Azure IoT Hub client libraries are available as a package you can install on your Ubuntu device using the **apt-get** command. Complete the following steps to install the package that contains the IoT Hub client library and header files on your Ubuntu computer:
35+
36+
1. In a shell, add the AzureIoT repository to your computer:
37+
38+
```
39+
sudo add-apt-repository ppa:aziotsdklinux/ppa-azureiot
40+
sudo apt-get update
41+
```
42+
2. Install the azure-iot-sdk-c-dev package
43+
44+
```
45+
sudo apt-get install -y azure-iot-sdk-c-dev
46+
```
47+
48+
## Install the Parson JSON parser
49+
The IoT Hub client libraries use the Parson JSON parser to parse message payloads. In a suitable folder on your computer, clone the Parson GitHub repository using the following command:
50+
51+
```
52+
git clone https://github.com/kgabis/parson.git
53+
```
54+
55+
## Prepare your project
56+
On your Ubuntu machine, create a folder called **remote\_monitoring**. In the **remote\_monitoring** folder:
57+
58+
- Create the four files **main.c**, **remote\_monitoring.c**, **remote\_monitoring.h**, and **CMakeLists.txt**.
59+
- Create folder called **parson**.
60+
61+
Copy the files **parson.c** and **parson.h** from your local copy of the Parson repository into the **remote\_monitoring/parson** folder.
62+
63+
In a text editor, open the **remote\_monitoring.c** file. Add the following `#include` statements:
64+
65+
```
66+
#include "iothubtransportmqtt.h"
67+
#include "schemalib.h"
68+
#include "iothub_client.h"
69+
#include "serializer_devicetwin.h"
70+
#include "schemaserializer.h"
71+
#include "azure_c_shared_utility/threadapi.h"
72+
#include "azure_c_shared_utility/platform.h"
73+
#include "parson.h"
74+
```
75+
76+
[!INCLUDE [iot-suite-v1-connecting-code](../../includes/iot-suite-v1-connecting-code.md)]
77+
78+
## Call the remote\_monitoring\_run function
79+
In a text editor, open the **remote_monitoring.h** file. Add the following code:
80+
81+
```
82+
void remote_monitoring_run(void);
83+
```
84+
85+
In a text editor, open the **main.c** file. Add the following code:
86+
87+
```
88+
#include "remote_monitoring.h"
89+
90+
int main(void)
91+
{
92+
remote_monitoring_run();
93+
94+
return 0;
95+
}
96+
```
97+
98+
## Build and run the application
99+
The following steps describe how to use *CMake* to build your client application.
100+
101+
1. In a text editor, open the **CMakeLists.txt** file in the **remote_monitoring** folder.
102+
103+
1. Add the following instructions to define how to build your client application:
104+
105+
```
106+
macro(compileAsC99)
107+
if (CMAKE_VERSION VERSION_LESS "3.1")
108+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
109+
set (CMAKE_C_FLAGS "--std=c99 ${CMAKE_C_FLAGS}")
110+
set (CMAKE_CXX_FLAGS "--std=c++11 ${CMAKE_CXX_FLAGS}")
111+
endif()
112+
else()
113+
set (CMAKE_C_STANDARD 99)
114+
set (CMAKE_CXX_STANDARD 11)
115+
endif()
116+
endmacro(compileAsC99)
117+
118+
cmake_minimum_required(VERSION 2.8.11)
119+
compileAsC99()
120+
121+
set(AZUREIOT_INC_FOLDER "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/parson" "/usr/include/azureiot" "/usr/include/azureiot/inc")
122+
123+
include_directories(${AZUREIOT_INC_FOLDER})
124+
125+
set(sample_application_c_files
126+
./parson/parson.c
127+
./remote_monitoring.c
128+
./main.c
129+
)
130+
131+
set(sample_application_h_files
132+
./parson/parson.h
133+
./remote_monitoring.h
134+
)
135+
136+
add_executable(sample_app ${sample_application_c_files} ${sample_application_h_files})
137+
138+
target_link_libraries(sample_app
139+
serializer
140+
iothub_client
141+
iothub_client_mqtt_transport
142+
aziotsharedutil
143+
umqtt
144+
pthread
145+
curl
146+
ssl
147+
crypto
148+
m
149+
)
150+
```
151+
1. In the **remote_monitoring** folder, create a folder to store the *make* files that CMake generates and then run the **cmake** and **make** commands as follows:
152+
153+
```
154+
mkdir cmake
155+
cd cmake
156+
cmake ../
157+
make
158+
```
159+
160+
1. Run the client application and send telemetry to IoT Hub:
161+
162+
```
163+
./sample_app
164+
```
165+
166+
[!INCLUDE [iot-suite-v1-visualize-connecting](../../includes/iot-suite-v1-visualize-connecting.md)]
167+

0 commit comments

Comments
 (0)