Show Contents

# AWS IoT device SDK for embedded C

The AWS IoT device SDK for embedded C is a collection of C source files to securely connect to the AWS IoT platform. It includes transport clients MQTT, TLS implementation and supports Thing Shadow:

- MQTT Connection. The device SDK creates and maintains a mutually authenticated TLS connection over which it runs MQTT. This connection is used for publish and subscriptions operations on MQTT topics.
- Thing Shadow. The device SDK implements the protocol to retrieve, update and delete Thing Shadows. It automatically subscribes to and unsubscribes from the Shadow reserved topics as needed.

## Using the library

To work with AWS IoT, you must:

1. Include the required AWS IoT header files in your application source code. For example:

    #include <aws_iot_config.h>
    #include <aws_iot_log.h>
    #include <aws_iot_shadow_interface.h>
    #include <aws_iot_version.h>

2. Link against the AWS IoT device SDK static library. The library provides a pkg-config file, awsiotsdk.pc. To configure the proper compilation flags and linked libraries, add the following lines in your makefile:

    [...]

    CFLAGS += $(shell pkg-config --cflags awsiotsdk)
    LDLIBS += $(shell pkg-config --libs --static awsiotsdk)

    [...]

Note Find the AWS IoT device SDK for embedded C API documentation at http://aws-iot-device-sdk-embedded-c-docs.s3-website-us-east-1.amazonaws.com/index.html.

## Build your AWS IoT application

You can build your own AWS IoT application:

- Using the pre-compiled toolchain. See Application development.

To run your application in the device, you must have in the device the mbedTLS shared libraries and the certificates in your device.

Note The resources available in the precompiled toolchain are built for the default settings at aws-iot bbclass.

If you need different values for the "MQTT PubSub" and "Auto Reconnect specific config" settings, you must re-generate the toolchain with your specific configuration from your Digi Embedded Yocto.

See http://www.yoctoproject.org/docs/2.2.1/mega-manual/mega-manual.html#sdk-building-an-sdk-installer for more information.

- As part of the Digi Embedded Yocto build. You must create a recipe similar to the awsiotsdk-demo recipe. Make sure that your recipe:
  - Depends on awsiotsdk-c
  - Inherits from the aws-iot bbclass

>     SUMMARY = "My AWS IoT device application"

>     [...]

>     DEPENDS = "awsiotsdk-c"

>     [...]

>     inherit aws-iot

>     [...]

Note To learn how to build an image with AWS IoT support, see Create an AWS IoT image.

© 2018 Digi International Inc. All rights reserved.
AWS IoT device SDK for embedded C updated on 22 January 2018 02:43:37 PM