You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[mbedTLS from ARM](https://s3.amazonaws.com/aws-iot-device-sdk-embedded-c/linux_mqtt_mbedtls-1.1.0.tar)
11
11
12
12
The C-code files of this SDK are delivered via the following directory structure (see comment behind folder name for an explanation of its content).
13
13
@@ -52,57 +52,56 @@ A timer implementation is necessary to handle request timeouts (sending MQTT con
52
52
53
53
Define the `Timer` Struct as in `timer_linux.h`
54
54
55
-
```
56
-
void InitTimer(Timer*);
55
+
`void InitTimer(Timer*);`
57
56
InitTimer - A timer structure is initialized to a clean state.
58
57
59
-
char expired(Timer*);
58
+
`char expired(Timer*);`
60
59
expired - a poling function to determine if the timer has expired.
61
60
62
-
void countdown_ms(Timer*, unsigned int);
61
+
`void countdown_ms(Timer*, unsigned int);`
63
62
countdown_ms - set the timer to expire in x milliseconds and start the timer.
64
63
65
-
void countdown(Timer*, unsigned int);
64
+
`void countdown(Timer*, unsigned int);`
66
65
countdown - set the timer to expire in x seconds and start the timer.
67
66
68
-
int left_ms(Timer*);
67
+
`int left_ms(Timer*);`
69
68
left_ms - query time in milliseconds left on the timer.
70
-
```
69
+
71
70
72
71
###Network Functions
73
72
74
73
In order for the MQTT client stack to be able to communicate via the TCP/IP network protocol stack using a mutually authenticated TLS connection, the following API calls need to be implemented for your platform.
75
74
76
75
For additional details about API parameters refer to the [API documentation](http://aws-iot-device-sdk-embedded-c-docs.s3-website-us-east-1.amazonaws.com/index.html).
77
76
78
-
```
79
-
int iot_tls_init(Network *pNetwork);
77
+
78
+
`int iot_tls_init(Network *pNetwork);`
80
79
Initialize the network client / structure.
81
80
82
-
int iot_tls_connect(Network *pNetwork, TLSConnectParams TLSParams);
Create a TLS TCP socket to the configure address using the credentials provided via the NewNetwork API call. This will include setting up certificate locations / arrays.
84
83
85
84
86
-
int iot_tls_read(Network*, unsigned char*, int, int);
The TLS library generally provides the API for the underlying TCP socket.
99
98
100
99
##Time source for certificate validation
101
100
As part of the TLS handshake the device (client) needs to validate the server certificate which includes validation of the certificate lifetime requiring that the device is aware of the actual time. Devices should be equipped with a real time clock or should be able to obtain the current time via NTP. Bypassing validation of the lifetime of a certificate is not recommended as it exposes the device to a security vulnerability, as it will still accept server certificates even when they have already expired.
102
101
103
102
##Integration into operating system
104
103
###Single-Threaded implementation
105
-
The single threaded implementation implies that the sample application code (SDK + MQTT client) is called periodically by the firmware application running on the main thread. This is done by calling the function `iot_mqtt_yield` (in the simple pub-sub example) and by calling `iot_shadow_yield` (in the device shadow example). In both cases the keep-alive time is set to 10 seconds. This means that the yield functions need to be called at a minimum frequency of once every 10 seconds. Note however that the `iot_mqtt_yield` function takes care of reading incoming MQTT messages from the IoT service as well and hence should be called more frequently depending on the timing requirements of an application. All incoming messages can only be processed at the frequency at which `yield` is called.
104
+
The single threaded implementation implies that the sample application code (SDK + MQTT client) is called periodically by the firmware application running on the main thread. This is done by calling the function `iot_mqtt_yield` (in the simple pub-sub example) and by calling `iot_shadow_yield()` (in the device shadow example). In both cases the keep-alive time is set to 10 seconds. This means that the yield functions need to be called at a minimum frequency of once every 10 seconds. Note however that the `iot_mqtt_yield()` function takes care of reading incoming MQTT messages from the IoT service as well and hence should be called more frequently depending on the timing requirements of an application. All incoming messages can only be processed at the frequency at which `yield` is called.
106
105
107
106
###Multi-Threaded implementation
108
107
In the simple multithreaded case the yield() function can be moved to a background thread. Ensure this task runs at the frequency described above. In this case, depending on the OS mechanism, a message queue or mailbox could be used to proxy incoming MQTT messages from the callback to the worker task responsible for responding to or dispatching messages. A similar mechanism could be employed to queue publish messages from threads into a publish queue that are processed by a publishing task.
Copy file name to clipboardExpand all lines: README.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,6 @@
1
-
#AWS IoT Embedded-C SDK
2
-
3
1
##Overview
4
2
5
-
The AWS IoT device SDK for embedded C is a collection of C source files which can be used in embedded applications to securely connect to the [AWS IoT platform](http://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html). It includes transport clients **(MQTT)**, **TLS** implementations and examples for their use. It also supports AWS IoT specific features such as **Thing Shadow**. It is distributed in source form and intended to be built into customer firmware along with application code, other libraries and RTOS. For additional information about porting the Device SDK for embedded C onto additional platforms please refer to the [Porting Guide](https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/master/PortingGuide.md).
3
+
The AWS IoT device SDK for embedded C is a collection of C source files which can be used in embedded applications to securely connect to the [AWS IoT platform](http://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html). It includes transport clients **MQTT**, **TLS** implementations and examples for their use. It also supports AWS IoT specific features such as **Thing Shadow**. It is distributed in source form and intended to be built into customer firmware along with application code, other libraries and RTOS. For additional information about porting the Device SDK for embedded C onto additional platforms please refer to the [PortingGuide](https://github.com/aws/aws-iot-device-sdk-embedded-c/blob/master/PortingGuide.md/).
6
4
7
5
##Features
8
6
The Device SDK simplifies access to the Pub/Sub functionality of the AWS IoT broker via MQTT and provide APIs to interact with Thing Shadows. The SDK has been tested to work with the AWS IoT platform to ensure best interoperability of a device with the AWS IoT platform.
@@ -29,8 +27,8 @@ Ensure you understand the AWS IoT platform and create the necessary certificates
29
27
30
28
In order to quickly get started with the AWS IoT platform, we have ported the SDK for POSIX type Operating Systems like Ubuntu, OS X and RHEL. The porting of the SDK happens at the TLS layer, and for the MQTT protocol. The SDK is configured for two TLS libraries and can be built out of the box with *GCC* using *make utility*. The tarballs can be downloaded from the below links.
*[mbedTLS from ARM](https://s3.amazonaws.com/aws-iot-device-sdk-embedded-c/linux_mqtt_mbedtls-1.1.0.tar)
34
32
35
33
##Installation
36
34
This section explains the individual steps to retrieve the necessary files and be able to build your first application using the AWS IoT device SDK for embedded C.
@@ -60,7 +58,7 @@ Steps:
60
58
Also, for a guided example on getting started with the Thing Shadow, visit the AWS IoT Console's [Interactive Guide](https://console.aws.amazon.com/iot).
61
59
62
60
##Porting to different platforms
63
-
As Embedded devices run on different Real Time Operating Systems and TCP/IP stacks, it is one of the important design goals for the Device SDK to keep it portable. Please refer to the [porting guide](https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/master/PortingGuide.md) to get more information on how to make this SDK run on your devices (i.e. micro-controllers).
61
+
As Embedded devices run on different Real Time Operating Systems and TCP/IP stacks, it is one of the important design goals for the Device SDK to keep it portable. Please refer to the [porting guide](https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/master/PortingGuide.md/) to get more information on how to make this SDK run on your devices (i.e. micro-controllers).
0 commit comments