1- ## AWS IoT SDK for Java v2
1+ # AWS IoT SDK for Java v2
2+ This document provides information about the AWS IoT device SDK for Java V2.
23
3-
4- Next generation AWS IoT Client SDK for Java using the AWS Common Runtime
5-
6- This project is in ** GENERAL AVAILABILITY** . If you have any issues or feature
7- requests, please file an issue or pull request.
4+ If you have any issues or feature requests, please file an issue or pull request.
85
96This SDK is built on the AWS Common Runtime, a collection of libraries
107([ aws-c-common] ( https://github.com/awslabs/aws-c-common ) ,
@@ -17,35 +14,36 @@ This SDK is built on the AWS Common Runtime, a collection of libraries
1714cross-platform, high-performance, secure, and reliable. The libraries are bound
1815to Java by the [ aws-crt-java] ( https://github.com/awslabs/aws-crt-java ) package.
1916
20- Integration with AWS IoT Services such as
21- [ Device Shadow] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html )
22- [ Jobs] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html )
23- [ Fleet Provisioning] ( https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html )
24- is provided by code that been generated from a model of the service.
2517
26- # Installation
27- ## Minimum Requirements
28- * Java 8 or above
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 )
2924
30- ** Set JAVA_HOME first
3125
32- * Install Maven
3326
34- brew install maven
27+ ## Installation
3528
36- ## Requirements to build the AWS CRT locally
29+ ### Minimum Requirements
30+ * Java 8 or above
31+
32+ ** Set JAVA_HOME first
33+
34+ ### Requirements to build the AWS CRT locally
3735* CMake 3.1+
3836* Clang 3.9+ or GCC 4.4+ or MSVC 2015+
3937
40- ## Build IoT Device SDK from source
38+ ### Build IoT Device SDK from source
4139```
4240git clone https://github.com/awslabs/aws-iot-device-sdk-java-v2.git
4341# update the version of the CRT being used
4442mvn versions:use-latest-versions -Dincludes="software.amazon.awssdk.crt*"
4543mvn clean install
4644```
4745
48- ## Build CRT from source
46+ ### Build CRT from source
4947``` sh
5048# NOTE: use the latest version of the CRT here
5149
@@ -58,7 +56,7 @@ cd ../aws-iot-device-sdk-java-v2
5856mvn clean install
5957```
6058
61- ### Android
59+ #### Android
6260Supports API 26 or newer.
6361NOTE: The shadow sample does not currently complete on android due to its dependence on stdin keyboard input.
6462``` sh
@@ -86,241 +84,50 @@ dependencies {
8684}
8785```
8886
89- # Samples
9087
91- ## Shadow
9288
93- This sample uses the AWS IoT
94- [ Device Shadow] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html )
95- Service to keep a property in
96- sync between device and server. Imagine a light whose color may be changed
97- through an app, or set by a local user.
89+ ## Samples
9890
99- Once connected, type a value in the terminal and press Enter to update
100- the property's "reported" value. The sample also responds when the "desired"
101- value changes on the server. To observe this, edit the Shadow document in
102- the AWS Console and set a new "desired" value.
91+ [ Samples README] ( samples )
10392
104- On startup, the sample requests the shadow document to learn the property's
105- initial state. The sample also subscribes to "delta" events from the server,
106- which are sent when a property's "desired" value differs from its "reported"
107- value. When the sample learns of a new desired value, that value is changed
108- on the device and an update is sent to the server with the new "reported"
109- value.
11093
111- Source: ` samples/Shadow `
11294
113- To Run:
114- ```
115- > mvn exec:java -pl samples/Shadow -Dexec.mainClass=shadow.ShadowSample -Dexec.args='--endpoint <endpoint> --rootca /path/to/AmazonRootCA1.pem --cert <cert path> --key <key path> --thingName <thing name>'
116- ```
95+ ## Getting Help
11796
118- Your Thing's
119- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
120- must provide privileges for this sample to connect, subscribe, publish,
121- and receive.
122-
123- <details >
124- <summary >Sample Policy</summary >
125- <pre >
126- {
127- "Version": "2012-10-17",
128- "Statement": [
129- {
130- "Effect": "Allow",
131- "Action": [
132- "iot:Publish"
133- ],
134- "Resource": [
135- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/get",
136- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update"
137- ]
138- },
139- {
140- "Effect": "Allow",
141- "Action": [
142- "iot:Receive"
143- ],
144- "Resource": [
145- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/get/accepted",
146- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/get/rejected",
147- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update/accepted",
148- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update/rejected",
149- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update/delta"
150- ]
151- },
152- {
153- "Effect": "Allow",
154- "Action": [
155- "iot:Subscribe"
156- ],
157- "Resource": [
158- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/get/accepted",
159- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/get/rejected",
160- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/update/accepted",
161- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/update/rejected",
162- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/update/delta"
163- ]
164- },
165- {
166- "Effect": "Allow",
167- "Action": "iot:Connect",
168- "Resource": "arn:aws:iot:<b >region</b >:<b >account</b >:client/samples-client-id"
169- }
170- ]
171- }
172- </pre >
173- </details >
97+ Use the following sources for information :
17498
175- ## Jobs
99+ * Check api and developer guides.
100+ * Check for similar issues already opened.
176101
177- This sample uses the AWS IoT
178- [ Jobs] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html )
179- Service to describe jobs to execute.
102+ If you still can’t find a solution to your problem open an [ issue] ( https://github.com/aws/aws-iot-device-sdk-java-v2/issues )
180103
181- This sample requires you to create jobs for your device to execute. See
182- [ instructions here] ( https://docs.aws.amazon.com/iot/latest/developerguide/create-manage-jobs.html ) .
183104
184- On startup, the sample describes a job that is pending execution.
185105
186- Source: ` samples/Jobs `
106+ ## Giving Feedback and Contributions
187107
188- To Run:
189- ```
190- > mvn exec:java -pl samples/Jobs -Dexec.mainClass=jobs.JobsSample -Dexec.args='--endpoint <endpoint> --rootca /path/to/AmazonRootCA1.pem --cert <cert path> --key <key path> --thingName <thing name>'
191- ```
108+ 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.
192109
193- Your Thing's
194- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
195- must provide privileges for this sample to connect, subscribe, publish,
196- and receive.
197-
198- <details >
199- <summary >Sample Policy</summary >
200- <pre >
201- {
202- "Version": "2012-10-17",
203- "Statement": [
204- {
205- "Effect": "Allow",
206- "Action": [
207- "iot:Publish"
208- ],
209- "Resource": [
210- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/start-next",
211- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/*/update"
212- ]
213- },
214- {
215- "Effect": "Allow",
216- "Action": [
217- "iot:Receive"
218- ],
219- "Resource": [
220- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/notify-next",
221- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/start-next/accepted",
222- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/start-next/rejected",
223- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/*/update/accepted",
224- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/*/update/rejected"
225- ]
226- },
227- {
228- "Effect": "Allow",
229- "Action": [
230- "iot:Subscribe"
231- ],
232- "Resource": [
233- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/notify-next",
234- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/start-next/accepted",
235- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/start-next/rejected",
236- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/*/update/accepted",
237- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/*/update/rejected"
238- ]
239- },
240- {
241- "Effect": "Allow",
242- "Action": "iot:Connect",
243- "Resource": "arn:aws:iot:<b >region</b >:<b >account</b >:client/samples-client-id"
244- }
245- ]
246- }
247- </pre >
248- </details >
110+ * [ Contributions Guidelines] ( master/CONTRIBUTING.md )
111+ * Articulate your feature request or upvote existing ones on our [ Issues] ( https://github.com/aws/aws-iot-device-sdk-java-v2/issues?q=is%3Aissue+is%3Aopen+label%3Afeature-request ) page.
112+ * Submit [ Issues] ( https://github.com/aws/aws-iot-device-sdk-java-v2/issues )
249113
250- ## fleet provisioning
251114
252- This sample uses the AWS IoT
253- [ Fleet provisioning] ( https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html )
254- to provision devices using either a CSR or KeysAndcertificate and subsequently calls RegisterThing.
255115
256- On startup, the script subscribes to topics based on the request type of either CSR or Keys topics,
257- publishes the request to corresponding topic and calls RegisterThing.
116+ ## More Resources
258117
259- Source: ` samples/Identity `
118+ * [ AWS IoT Core Documentation] ( https://docs.aws.amazon.com/iot/ )
119+ * [ Developer Guide] ( https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html ) ([ source] ( https://github.com/awsdocs/aws-iot-docs ) )
120+ * [ Issues] ( https://github.com/aws/aws-iot-device-sdk-java-v2/issues )
121+ * [ 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 )
260122
261- cd ~ /samples/Identity
262-
263- Run the sample using CreateKeysAndCertificate:
264-
265- ```
266- mvn exec:java -Dexec.mainClass="identity.FleetProvisioningSample" -Dexec.args="--endpoint <endpoint> --rootca <root ca path>
267- --cert <cert path> --key <private key path> --templateName <templatename> --templateParameters <templateParams>"
268- ```
123+ Integration with AWS IoT Services such as
124+ [ Device Shadow] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html )
125+ [ Jobs] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html )
126+ [ Fleet Provisioning] ( https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html )
127+ is provided by code that been generated from a model of the service.
269128
270- Run the sample using CreateCertificateFromCsr:
271-
272- ```
273- mvn exec:java -Dexec.mainClass="identity.FleetProvisioningSample" -Dexec.args="--endpoint <endpoint> --rootca <root ca path>
274- --cert <cert path> --key <private key path> --templateName <templatename> --templateParameters <templateParams> --csr <csr path>"
275- ```
276129
277- Your Thing's
278- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
279- must provide privileges for this sample to connect, subscribe, publish,
280- and receive.
281-
282- <details >
283- <summary >(see sample policy)</summary >
284- <pre >
285- {
286- "Version": "2012-10-17",
287- "Statement": [
288- {
289- "Effect": "Allow",
290- "Action": [
291- "iot:Publish"
292- ],
293- "Resource": [
294- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create/json",
295- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create-from-csr/json",
296- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/provisioning-templates/<b >templatename<b >/provision/json"
297- ]
298- },
299- {
300- "Effect": "Allow",
301- "Action": [
302- "iot:Receive",
303- "iot:Subscribe"
304- ],
305- "Resource": [
306- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create/json/accepted",
307- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create/json/rejected",
308- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create-from-csr/json/accepted",
309- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create-from-csr/json/rejected",
310- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/provisioning-templates/<b >templatename<b >/provision/json/accepted",
311- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/provisioning-templates/<b >templatename<b >/provision/json/rejected"
312- ]
313- },
314- {
315- "Effect": "Allow",
316- "Action": "iot:Connect",
317- "Resource": "arn:aws:iot:<b >region</b >:<b >account</b >:client/samples-client-id"
318- }
319- ]
320- }
321- </pre >
322- </details >
323130
324131# License
325132
326- This library is licensed under the Apache 2.0 License.
133+ This library is licensed under the Apache 2.0 License.
0 commit comments