iotexpresslink2 2.1.0.0
main.c File Reference

IoT ExpressLink 2 Click Example. More...

#include "board.h"
#include "log.h"
#include "iotexpresslink2.h"

Macros

#define SIM_APN   "internet"
 
#define DEVICE_ENDPOINT   ""
 
#define TOPIC_NUM   "1"
 
#define TOPIC_NAME   "IoT_ExpressLink_2"
 
#define TEXT_MESSAGE   "IoT ExpressLink 2 click board - demo message"
 
#define APP_BUFFER_SIZE   900
 
#define PROCESS_BUFFER_SIZE   100
 

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

IoT ExpressLink 2 Click Example.

Description

This example demonstrates the use of IoT ExpressLink 2 click board by connecting to the selected AWS account's data endpoint and showcasing the messaging topic model through sending and receiving messages to/from AWS IoT console.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger, powers up the device, reads and displays the vendor model, thing name, and the PEM certificate of the device. It then sets the SIM APN and device endpoint, and attempts to connect to AWS network. Finally, it configures the topic name and number and subscribes to it.

Application Task

Sends a desired message on the configured topic and retrieves the next two pending messages from the same topic approximately every 10 seconds. The sent message is also added to the receive queue because the same topic is used for both sending and receiving.

Additional Function

  • static void iotexpresslink2_clear_app_buf ( void )
  • static err_t iotexpresslink2_process ( iotexpresslink2_t *ctx )
  • static err_t iotexpresslink2_read_response ( iotexpresslink2_t *ctx, uint32_t timeout )
Note
Steps for the very first connection attempt:
  1. During the initial connection attempt, the device responds with: "ERR14 UNABLE TO CONNECT Certificate generation completed. Proceed to register device with AWS cloud and then try to connect again".
  2. At this point, you should restart the system and proceed with registering the device with the AWS Cloud using device's thing name and PEM certificate displayed in the logger. Detailed steps for registering device are described in the module's application development guide.
  3. After registering the device with your AWS account, restart the system, and it should now successfully connect to the cloud.
Author
Stefan Filipovic

Macro Definition Documentation

◆ APP_BUFFER_SIZE

#define APP_BUFFER_SIZE   900

◆ DEVICE_ENDPOINT

#define DEVICE_ENDPOINT   ""

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   100

◆ SIM_APN

#define SIM_APN   "internet"

◆ TEXT_MESSAGE

#define TEXT_MESSAGE   "IoT ExpressLink 2 click board - demo message"

◆ TOPIC_NAME

#define TOPIC_NAME   "IoT_ExpressLink_2"

◆ TOPIC_NUM

#define TOPIC_NUM   "1"

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )