1
1
# AWS IoT SDK for C++ v2
2
+ This document provides information about the AWS IoT device SDK for C++ V2.
2
3
3
- Next generation AWS IoT Client SDK for C++.
4
-
5
- This project is in ** GENERAL AVAILABILITY** . If you have any issues or feature
6
- requests, please file an issue or pull request.
4
+ If you have any issues or feature requests, please file an issue or pull request.
7
5
8
6
This SDK is built on the AWS Common Runtime, a collection of libraries
9
7
([ aws-c-common] ( https://github.com/awslabs/aws-c-common ) ,
@@ -16,20 +14,27 @@ This SDK is built on the AWS Common Runtime, a collection of libraries
16
14
cross-platform, high-performance, secure, and reliable. The libraries are bound
17
15
to C++ by the [ aws-crt-cpp] ( https://github.com/awslabs/aws-crt-cpp ) package.
18
16
19
- Integration with AWS IoT Services such as
20
- [ Device Shadow] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html )
21
- and [ Jobs] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html )
22
- is provided by code that been generated from a model of the service.
23
17
24
- # Installation
25
- ## Minimum Requirements
18
+ * __ Jump To:__ *
19
+ * [ Installation] ( #Installation )
20
+ * [ Samples] ( samples )
21
+ * [ Getting Help] ( #Getting-Help )
22
+ * [ Giving Feedback and Contributions] ( #Giving-Feedback-and-Contributions )
23
+ * [ More Resources] ( #More-Resources )
24
+
25
+
26
+
27
+ ## Installation
28
+
29
+ ### Minimum Requirements
26
30
* C++ 11 or higher
27
31
* CMake 3.1+
28
32
* Clang 3.9+ or GCC 4.4+ or MSVC 2015+
29
33
30
- ## Build from source
31
- ### Automatically Build and Install AWS Dependencies
32
- ```
34
+
35
+ ### Build from source
36
+ #### Automatically Build and Install AWS Dependencies
37
+ ``` sh
33
38
mkdir sdk-cpp-workspace
34
39
cd sdk-cpp-workspace
35
40
git clone --recursive https://github.com/aws/aws-iot-device-sdk-cpp-v2.git
@@ -38,297 +43,64 @@ cd aws-iot-device-sdk-cpp-v2-build
38
43
cmake -DCMAKE_INSTALL_PREFIX=" <absolute path sdk-cpp-workspace dir>" -DBUILD_DEPS=ON ../aws-iot-device-sdk-cpp-v2
39
44
cmake --build . --target install
40
45
```
41
- ### Using a Pre-Built aws-crt-cpp (Most useful for development of this package)
46
+ #### Using a Pre-Built aws-crt-cpp (Most useful for development of this package)
42
47
43
- ```
48
+ ``` sh
44
49
mkdir aws-iot-device-sdk-cpp-v2-build
45
50
cd aws-iot-device-sdk-cpp-v2-build
46
51
cmake -DCMAKE_INSTALL_PREFIX=" <absolute path sdk-cpp-workspace dir>" -DCMAKE_PREFIX_PATH=" <absolute path sdk-cpp-workspace dir>" -DBUILD_DEPS=OFF ../aws-iot-device-sdk-cpp-v2
47
52
cmake --build . --target install
48
53
```
49
54
50
- # Mac-Only TLS Behavior
55
+ ### Mac-Only TLS Behavior
51
56
52
57
Please note that on Mac, once a private key is used with a certificate, that certificate-key pair is imported into the Mac Keychain. All subsequent uses of that certificate will use the stored private key and ignore anything passed in programmatically. Beginning in v1.7.3, when a stored private key from the Keychain is used, the following will be logged at the "info" log level:
53
58
54
59
```
55
60
static: certificate has an existing certificate-key pair that was previously imported into the Keychain. Using key from Keychain instead of the one provided.
56
61
```
57
62
58
- # Samples
63
+ ## Samples
59
64
60
- ## fleet provisioning
65
+ [ Samples README ] ( samples )
61
66
62
- This sample uses the AWS IoT
63
- [ Fleet provisioning] ( https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html )
64
- to provision devices using either a CSR or KeysAndcertificate and subsequently calls RegisterThing.
65
67
66
- On startup, the script subscribes to topics based on the request type of either CSR or Keys topics,
67
- publishes the request to corresponding topic and calls RegisterThing.
68
68
69
- Source: ` samples/identity/fleet_provisioning `
69
+ ## Getting Help
70
70
71
- cd ~ /aws-iot-device-sdk-cpp-v2-build/samples/identity/fleet_provisioning
71
+ Use the following sources for information :
72
72
73
- Run the sample like this to provision using CreateKeysAndCertificate:
74
-
75
- ```
76
- ./fleet-provisioning --endpoint <endpoint> --ca_file <path to root CA>
77
- --cert <path to the certificate> --key <path to the private key>
78
- --template_name <template name> --template_parameters <template parameters json>
79
- ```
73
+ * Check api and developer guides.
74
+ * Check for similar issues already opened.
80
75
81
- Run the sample like this to provision using Csr:
82
-
83
- ```
84
- ./fleet-provisioning --endpoint <endpoint> --ca_file <path to root CA>
85
- --cert <path to the certificate> --key <path to the private key>
86
- --template_name <template name> --template_parameters <template parameters json> --csr <path to the CSR in PEM format>
87
- ```
76
+ If you still can’t find a solution to your problem open an [ issue] ( https://github.com/aws/aws-iot-device-sdk-cpp-v2/issues )
88
77
89
- Your Thing's
90
- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
91
- must provide privileges for this sample to connect, subscribe, publish,
92
- and receive.
93
-
94
- ``` json
95
- {
96
- "Version" : " 2012-10-17" ,
97
- "Statement" : [
98
- {
99
- "Effect" : " Allow" ,
100
- "Action" : [
101
- " iot:Publish"
102
- ],
103
- "Resource" : [
104
- " arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/certificates/create/json" ,
105
- " arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/certificates/create-from-csr/json" ,
106
- " arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/provisioning-templates/<b>templatename<b>/provision/json"
107
- ]
108
- },
109
- {
110
- "Effect" : " Allow" ,
111
- "Action" : [
112
- " iot:Receive" ,
113
- " iot:Subscribe"
114
- ],
115
- "Resource" : [
116
- " arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/certificates/create/json/accepted" ,
117
- " arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/certificates/create/json/rejected" ,
118
- " arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/certificates/create-from-csr/json/accepted" ,
119
- " arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/certificates/create-from-csr/json/rejected" ,
120
- " arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/provisioning-templates/<b>templatename<b>/provision/json/accepted" ,
121
- " arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/provisioning-templates/<b>templatename<b>/provision/json/rejected"
122
- ]
123
- },
124
- {
125
- "Effect" : " Allow" ,
126
- "Action" : " iot:Connect" ,
127
- "Resource" : " arn:aws:iot:<b>region</b>:<b>account</b>:client/samples-client-id"
128
- }
129
- ]
130
- }
131
- ```
132
78
133
- ## Basic MQTT Pub-Sub
134
-
135
- This sample uses the
136
- [ Message Broker] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-message-broker.html )
137
- for AWS IoT to send and receive messages through an MQTT connection.
138
- On startup, the device connects to the server and subscribes to a topic.
139
-
140
- The terminal prompts the user for input. Type something and press enter to publish a message to the topic.
141
- Since the sample is subscribed to the same topic, it will also receive the message back from the server.
142
- Type ` quit ` and press enter to end the sample.
143
-
144
- Source: ` samples/mqtt/basic_pub_sub `
145
-
146
- Your Thing's
147
- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
148
- must provide privileges for this sample to connect, subscribe, publish,
149
- and receive.
150
-
151
- ``` json
152
- {
153
- "Effect" : " Allow" ,
154
- "Action" : [
155
- " iot:Receive" ,
156
- " iot:Publish"
157
- ],
158
- "Resource" : [
159
- " arn:aws:iot:<your-region>:<your-id>:topic/a/b"
160
- ],
161
- },
162
- {
163
- "Effect" : " Allow" ,
164
- "Action" : [
165
- " iot:Subscribe"
166
- ],
167
- "Resource" : [
168
- " arn:aws:iot:<your-region>:<your-id>:topicfilter/a/b"
169
- ]
170
- }
171
- ```
172
79
173
- ## Raw MQTT Pub-Sub
174
- This sample is similar to the Basic Pub-Sub, but the connection setup is more manual.
175
- This is a starting point for using custom
176
- [ Configurable Endpoints] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-custom-endpoints-configurable.html ) .
80
+ ## Giving Feedback and Contributions
81
+
82
+ We need your help in making this SDK great. Please participate in the community and contribute to this effort by submitting issues, participating in discussion forums and submitting pull requests through the following channels.
83
+
84
+ * [ Contributions Guidelines] ( CONTRIBUTING.md )
85
+ * Articulate your feature request or upvote existing ones on our [ Issues] ( https://github.com/aws/aws-iot-device-sdk-cpp-v2/issues?q=is%3Aissue+is%3Aopen+label%3Afeature-request ) page.
86
+ * Submit [ Issues] ( https://github.com/aws/aws-iot-device-sdk-cpp-v2/issues )
87
+
177
88
178
- source: ` samples/mqtt/raw_pub_sub `
179
89
90
+ ## More Resources
180
91
181
- ## Shadow
92
+ * [ AWS IoT Core Documentation] ( https://docs.aws.amazon.com/iot/ )
93
+ * [ Developer Guide] ( https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html ) ([ source] ( https://github.com/awsdocs/aws-iot-docs ) )
94
+ * [ Issues] ( https://github.com/aws/aws-iot-device-sdk-cpp-v2/issues )
95
+ * [ Dev Blog] ( https://aws.amazon.com/blogs/?awsf.blog-master-iot=category-internet-of-things%23amazon-freertos%7Ccategory-internet-of-things%23aws-greengrass%7Ccategory-internet-of-things%23aws-iot-analytics%7Ccategory-internet-of-things%23aws-iot-button%7Ccategory-internet-of-things%23aws-iot-device-defender%7Ccategory-internet-of-things%23aws-iot-device-management%7Ccategory-internet-of-things%23aws-iot-platform )
182
96
183
- This sample uses the AWS IoT
97
+ Integration with AWS IoT Services such as
184
98
[ Device Shadow] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html )
185
- Service to keep a property in
186
- sync between device and server. Imagine a light whose color may be changed
187
- through an app, or set by a local user.
188
-
189
- Once connected, type a value in the terminal and press Enter to update
190
- the property's "reported" value. The sample also responds when the "desired"
191
- value changes on the server. To observe this, edit the Shadow document in
192
- the AWS Console and set a new "desired" value.
193
-
194
- On startup, the sample requests the shadow document to learn the property's
195
- initial state. The sample also subscribes to "delta" events from the server,
196
- which are sent when a property's "desired" value differs from its "reported"
197
- value. When the sample learns of a new desired value, that value is changed
198
- on the device and an update is sent to the server with the new "reported"
199
- value.
200
-
201
- Source: ` samples/shadow/shadow_sync `
202
-
203
- Your Thing's
204
- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
205
- must provide privileges for this sample to connect, subscribe, publish,
206
- and receive.
207
-
208
- <details >
209
- <summary >(see sample policy)</summary >
210
- <pre >
211
- {
212
- "Version": "2012-10-17",
213
- "Statement": [
214
- {
215
- "Effect": "Allow",
216
- "Action": [
217
- "iot:Publish"
218
- ],
219
- "Resource": [
220
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/get",
221
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update"
222
- ]
223
- },
224
- {
225
- "Effect": "Allow",
226
- "Action": [
227
- "iot:Receive"
228
- ],
229
- "Resource": [
230
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/get/accepted",
231
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/get/rejected",
232
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update/accepted",
233
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update/rejected",
234
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update/delta"
235
- ]
236
- },
237
- {
238
- "Effect": "Allow",
239
- "Action": [
240
- "iot:Subscribe"
241
- ],
242
- "Resource": [
243
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/get/accepted",
244
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/get/rejected",
245
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/update/accepted",
246
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/update/rejected",
247
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/update/delta"
248
- ]
249
- },
250
- {
251
- "Effect": "Allow",
252
- "Action": "iot:Connect",
253
- "Resource": "arn:aws:iot:<b >region</b >:<b >account</b >:client/samples-client-id"
254
- }
255
- ]
256
- }
257
- </pre >
258
- </details >
259
-
260
- ## Jobs
261
-
262
- This sample uses the AWS IoT
263
- [ Jobs] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html )
264
- Service to describe jobs to execute.
265
-
266
- This sample requires you to create jobs for your device to execute. See
267
- [ instructions here] ( https://docs.aws.amazon.com/iot/latest/developerguide/create-manage-jobs.html ) .
268
-
269
- On startup, the sample describes a job that is pending execution.
270
-
271
- Source: ` samples/jobs/describe_job_execution `
272
-
273
- Your Thing's
274
- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
275
- must provide privileges for this sample to connect, subscribe, publish,
276
- and receive.
277
- <details >
278
- <summary >(see sample policy)</summary >
279
- <pre >
280
- {
281
- "Version": "2012-10-17",
282
- "Statement": [
283
- {
284
- "Effect": "Allow",
285
- "Action": [
286
- "iot:Publish"
287
- ],
288
- "Resource": [
289
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/start-next",
290
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/*/update"
291
- ]
292
- },
293
- {
294
- "Effect": "Allow",
295
- "Action": [
296
- "iot:Receive"
297
- ],
298
- "Resource": [
299
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/notify-next",
300
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/start-next/accepted",
301
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/start-next/rejected",
302
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/*/update/accepted",
303
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/*/update/rejected"
304
- ]
305
- },
306
- {
307
- "Effect": "Allow",
308
- "Action": [
309
- "iot:Subscribe"
310
- ],
311
- "Resource": [
312
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/notify-next",
313
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/start-next/accepted",
314
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/start-next/rejected",
315
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/*/update/accepted",
316
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/*/update/rejected"
317
- ]
318
- },
319
- {
320
- "Effect": "Allow",
321
- "Action": "iot:Connect",
322
- "Resource": "arn:aws:iot:<b >region</b >:<b >account</b >:client/samples-client-id"
323
- }
324
- ]
325
- }
326
- </pre >
327
- </details >
328
-
329
- ## Greengrass Discovery
330
- This sample is intended for direct usage with the Greengrass tutorial found [ here] ( https://docs.aws.amazon.com/greengrass/latest/developerguide/gg-gs.html ) .
331
-
332
- # License
333
-
334
- This library is licensed under the Apache 2.0 License.
99
+ and [ Jobs] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html )
100
+ is provided by code that been generated from a model of the service.
101
+
102
+
103
+
104
+ ## License
105
+
106
+ This library is licensed under the [ Apache 2.0 License] ( LICENSE ) .
0 commit comments