RAFW Flexible Software Package Documentation  Release v2.0.1

 
AWSIOT_W Application (rm_awsiot_w)

Functions

fsp_err_t RM_AWSIOT_W_Open (awsiot_w_ctrl_t *const p_ctrl, rm_awsiot_w_app_cfg_t const *const p_cfg)
 
fsp_err_t RM_AWSIOT_W_Close (awsiot_w_ctrl_t *const p_ctrl)
 

Detailed Description

Application stack for the AWSIOT_W on RAFW. This module implements the AWSIOT_W Application (rm_awsiot_w).

Overview

The AWSIOT_W platform reference application provides a demonstration of an use case such as a door lock using the AWSIOT_W services provided by Amazon. AWSIOT_W is implemented using the MQTT protocol and utilizes the platform provided by Amazon. MQTT (Message Queue Telemetry Transport) is an ISO standard (ISO/IEC PRF 20922) publish-subscribe-based messaging protocol. It works on top of the TCP/IP protocol. The publisher sends (PUBLISH) messages to the subscriber through the broker. The subscriber needs to keep the connection with the broker by TCP session while the publisher can disconnect the session with the broker after sending a message. Once the broker receives a message with a specific topic the message is sent to subscribers that already registered with the topic. A subscriber can register with more than one topic. There can be many or no subscribers which registered with a specific topic. The exchange of MQTT messages supports QoS (Quality of Service). Various applications can be implemented for the AWSIOT_W platform by following this reference applicaiton.

Features

The MQTT Port module has the following key features:

Configuration

Build Time Configurations for rm_awsiot_w

The following build time configurations are defined in fsp_cfg/rm_awsiot_w_cfg.h:

ConfigurationOptionsDefaultDescription
Sleep3(DPM) Support
  • Enabled
  • Disabled
Enabled Enable when using the Sleep3(DPM) Mode.
AWSIOT_W MQTT Receive No Connected Maximum Timeout (ms)Timeout must be an integer greater than or equal to 2000 and less than 655352000 Timeout for the AWSIOT_W MQTT Receive function to check the buffer for incoming MQTT messages in milliseconds when not being connected.
AWSIOT_W MQTT Receive Connected Maximum Timeout (ms)Timeout must be an integer greater than or equal to 120 and less than 65535120 Timeout for the AWSIOT_W MQTT Receive function to check the buffer for incoming MQTT messages in milliseconds when being connected.
AWSIOT_W MQTT Receive Sleep Maximum Timeout (ms)Timeout must be an integer greater than or equal to 20 and less than 6553520 Timeout for the AWSIOT_W MQTT Receive function to check the buffer for incoming MQTT messages in milliseconds when going to sleep.
AWSIOT_W Clean Session
  • Enabled
  • Disabled
Enabled Enable when using the clean session.
AWSIOT_W Keep Alive (s)Must be an integer greater than 10 and less than 655351800 MQTT ping period to check if connection is still active.
AWSIOT_W Thing NameManual EntryRRQ61x00 Thing Name for AWSIOT_W Connection
AWSIOT_W Host NameManual Entrya1kzdt4nun8bnh-ats.iot.ap-northeast-2.amazonaws.com Host Name for AWSIOT_W Connection
AWSIOT_W ROOT CA CertificateManual Entry-----BEGIN CERTIFICATE-----/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC/G/wkjUu0yKGX9rbxenDI/msv0tadQ1wUs+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy
-----END CERTIFICATE-----
AWS root CA Certificate
AWSIOT_W Client CertificateManual Entry-----BEGIN CERTIFICATE-----/Qq2E9ZleQWN2Gk/iPw2GMA0GCSqGSIb3DQEB/AbN7xxXgAslyB14/MPUjrpgPSnrbHcLwhOpKILoHiLO6CTqfXv/pxcXyh0UCHpp1PF63m0vmYYuA+m09GLkqdxWGz2wgKokSa8pMO/otTA+uh8y/7q5fuASGywZR5WeutH8yjw4ui5Il+66S2yUifsCDrNgsmfTIZdta4cV+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0actt58g2U4C4m73A+lEZbxVCFZNyetXQIsjTMKJ8g5PesyR8+Q/Af4fBldkcZtHIxK9uqkCgYAaqpmQwac7Bx4Xdb9NSm/wI3MUFmdg7ZM2gqJ1/9Oa4ghAiZeplYYz0sNZVWjrF68/FVNypzpfjxj5X0X+4S5UNwxGHw4cZJwAvOkkeApV3WlBSZFbbGzIxrVy79O+2HZZVSXtgsCS/fzsFjMWYpeNRX3+9wtFfGCfxoygGW0JvOyY/m7JdyOcWdbf54nhzcEqjRv1DhCA==
-----END RSA PRIVATE KEY-----
AWS client's private key
AWSIOT_W MQTT PortMust be an integer greater than 0 and less than 65535443 AWSIOT_W HUB endpoint port
SSL MAX Content LengthMust be an integer greater than 0 and less than 655358192 Incoming and outgoing TLS buffer size
AWSIOT_W OTA RTOS NAMEManual Entryrm_awsiot_w_wifi_test_app.img RTOS Name for AWSIOT_W OTA

Configurations for Networking > AWS IoT port layer (rm_awsiot_w)

This module can be added to the Stacks tab via New Stack > Networking > AWS IoT port layer (rm_awsiot_w).

ConfigurationOptionsDefaultDescription
General
NameName must be a valid C symbolg_awsiot_w0 Module name

Clock Configuration

This module has no required clock configurations.

Pin Configuration

This module does not use I/O pins.

Usage Notes

Refer to WIFI (rm_wifi).

Limitations

Refer to WIFI (rm_wifi).

Examples

Basic Example

This is a basic example of minimal use of the AWSIOT_W application.

void rm_awsiot_w_example(void) {
rm_wifi_open(&g_wifi_cfg);
vTaskDelay(portCONVERT_MS_2_TICKS(200));
RM_AWSIOT_W_Open(&g_rm_awsiot_w_app_ctrl, &g_rm_awsiot_w_app_cfg);
while (1)
{
vTaskDelay(portCONVERT_MS_2_TICKS(100));
}
}

Data Structures

struct  rm_awsiot_w_app_instance_ctrl_t
 

Data Structure Documentation

◆ rm_awsiot_w_app_instance_ctrl_t

struct rm_awsiot_w_app_instance_ctrl_t

AWSIOT_W control structure. DO NOT INITIALIZE.

Data Fields
rm_awsiot_w_app_cfg_t const * p_cfg Pointer to initial configurations.
uint32_t open Indicates whether the open() API has been successfully called.
void const * p_context Placeholder for user data.

Function Documentation

◆ RM_AWSIOT_W_Open()

fsp_err_t RM_AWSIOT_W_Open ( awsiot_w_ctrl_t *const  p_ctrl,
rm_awsiot_w_app_cfg_t const *const  p_cfg 
)

Initialize the AWSIOT_W service.

Parameters
[in]p_ctrlPointer to AWSIOT_W instance control structure.
[in]p_cfgPointer to AWSIOT_W configuration structure.
Return values
FSP_SUCCESSFunction completed successfully.
FSP_ERR_ALREADY_OPENAWSIOT_W instance is already opened.
FSP_ERR_WIFI_FAILEDError occurred with command to Wifi module.
FSP_ERR_ASSERTIONThe p_cfg instance is NULL.
FSP_ERR_OUT_OF_MEMORYHeap is too small or NULL to create a AWSIOT_W task.

◆ RM_AWSIOT_W_Close()

fsp_err_t RM_AWSIOT_W_Close ( awsiot_w_ctrl_t *const  p_ctrl)

Close the AWSIOT_W service.

Parameters
[in]p_ctrlPointer to AWSIOT_W instance control structure.
Return values
FSP_SUCCESSFunction completed successfully.
FSP_ERR_ASSERTIONThe p_cfg instance is NULL.