Skip to content

Commit 7667a95

Browse files
committed
update README.md
1 parent 5114769 commit 7667a95

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

README.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
# awsiotgg
22

3-
Establishes AWS GreenGrass Connections
3+
Wrapper for AWS Greengrass to perform Core Discovery and Connection Establishment
4+
5+
## Features
6+
7+
* Core Discovery
8+
* Core Connection Establishment
9+
* Discovery Information Cache (enables connecting to Core even connection to Discovery Endpoint is lost)
10+
* Automatic Retry during Discovery and Connection Establishment
411

512
## Usage
613

714
```python
8-
# Init AWSIoTMQTTShadowClient
9-
self._shadow_client = AWSIoTMQTTShadowClient(self._config.THING_NAME)
1015

11-
# AWSIoTShadowClient configuration
12-
...
16+
from AWSIoTGG import GGConnector
17+
18+
# Init AWSIoTMQTTShadowClient
19+
self._shadow_client = AWSIoTPyMQTT.AWSIoTMQTTShadowClient(<THING_NAME>)
1320

1421
# Init DiscoveryInfoProvider
15-
discovery_info_provider = DiscoveryInfoProvider()
22+
self._discovery_info_provider = DiscoveryInfoProvider()
23+
self._discovery_info_provider.configureEndpoint(<HOST>)
24+
self._discovery_info_provider.configureCredentials(<ROOT_CA_PATH>, <CERTIFICATE_PATH>, <PRIVATE_KEY_PATH>)
1625

17-
# DiscoveryInfoProvider configuration
18-
...
26+
gg_connector = GGConnector(
27+
self._shadow_client, self._discovery_info_provider)
1928

20-
discovery_info = discovery_info_provider.discover(
21-
self._config.THING_NAME)
29+
try:
30+
core_info, group_ca_path = gg_connector.discover(<THING_NAME>)
2231

23-
# Connect to GGC
24-
self._connection_manager = GGConnectionManager(
25-
self._shadow_client, discovery_info)
26-
# Connect ShadowClient
27-
logger.info('Connecting MQTT Shadow Client')
28-
self._connection_manager.connect(
29-
self._config.PRIVATE_KEY_PATH, self._config.CERTIFICATE_PATH)
32+
gg_connector.connect(
33+
core_info, group_ca_path, <CERTIFICATE_PATH>, <PRIVATE_KEY_PATH>)
34+
except BaseException as err:
35+
logger.error(err)
36+
sys.exit(1)
3037

31-
```
38+
# Here comes the actual device implementation
3239

40+
```

0 commit comments

Comments
 (0)