
CYW954907AEVAL1F Evaluation Kit User Guide, Doc. No. 002-22338 Rev. **
55
Code Examples
Figure 5-8. Webpage
5.5
Publish_subscribe_aws
5.5.1
Project Description
This project demonstrates publishing a message to a
Thing
in the Amazon Web Services (AWS)
cloud and subscribing to the same messages. A
Thing
is a representation of a specific device or log-
ical entity. For more information, refer to the
AWS Documentation
. This example is based on existing
code example (
apps/aws_iot/publish and apps/aws_ iot/subscribe
.) available in WICED Studio 6.0
(or later). On startup, the publish_subscribe_aws code example joins a Wi-Fi access point specified
in the
wifi_config_dct.h file
, connects to AWS, subscribes to the specified topic and then alternately
tries to publish LIGHT ON and LIGHT OFF messages.
The project consists of the following files:
■
publish_subscribe.c
: This file contains the main application function
application_start()
which is the entry point and execution of the firmware application. It also contains the function
definitions for initializing, publishing and subscribing to AWS.
■
publish_subscribe_aws.mk
: This is the makefile which adds the sources, protocols, compo-
nents (in this application, the MQTT component is used) and the name of the application. It also
adds the required resources for the web page which are available in the
resources/apps
direc-
tory. Note that this project uses certificates from
apps/aws_iot
directory.
■
wifi_config_dct.h:
This file contains the Wi-Fi access point credentials (SSID and pass
phrase key) and soft AP credentials. The user should enter the client access point name and
password credentials prior to building the application. These are specified as CLIENT_AP_SSID
and CLIENT_AP_PASSPHRASE. Note that the security type may also have to be changed if the
access point does not use WPA2 security. The Wi-Fi access point must have access to the inter-
net to connect with AWS.