lteiot6 2.0.0.0
main.c File Reference

LTE IoT 6 Click Example. More...

#include "board.h"
#include "log.h"
#include "lteiot6.h"

Macros

#define SIM_APN   ""
 
#define PHONE_NUMBER_TO_MESSAGE   "+381659999999"
 
#define MESSAGE_CONTENT   "LTE IoT 6 Click"
 
#define SMSC_ADDRESS_CSCA   "\"+381999999\",145"
 
#define SMSC_ADDRESS_PDU   "+381999999"
 
#define PROCESS_BUFFER_SIZE   300
 
#define DISCONNECT   "2"
 
#define AIRPLANE_MODE   "4"
 
#define FULL_FUNCTIONALITY   "1"
 
#define AUTOMATIC   "0"
 
#define ENABLE_REG   "2"
 
#define CONNECTED   "+CREG: 1"
 
#define PDU_MESSAGE_MODE   "0"
 
#define TXT_MESSAGE_MODE   "1"
 
#define CMGF_PDU   "+CMGF: 0"
 
#define CMGF_TXT   "+CMGF: 1"
 

Enumerations

enum  lteiot6_example_state_t {
  LTEIOT6_CONFIGURE_FOR_CONNECTION = 1 , LTEIOT6_WAIT_FOR_CONNECTION , LTEIOT6_CHECK_CONNECTION , LTEIOT6_CONFIGURE_FOR_MESSAGES ,
  LTEIOT6_MESSAGES
}
 Example states. More...
 

Functions

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

Detailed Description

LTE IoT 6 Click Example.

Description

Application example shows device capability to connect network and send SMS messages using standard "AT" commands.

The demo application is composed of two sections :

Application Init

Initializes driver and wake-up module and test communication.

Application Task

Application taks is split in few stages:

  • LTEIOT6_CONFIGURE_FOR_CONNECTION: Sets configuration to device to be able to connect to newtork.
  • LTEIOT6_WAIT_FOR_CONNECTION: Checks device response untill device sends information that it is connected to network.
  • LTEIOT6_CHECK_CONNECTION: Checks device connection status parameters.
  • LTEIOT6_CONFIGURE_FOR_MESSAGES: Sets configuration to device to send SMS messages.
  • LTEIOT6_MESSAGES: Sends message in selected mode (PDU/TXT).

Additional Function

  • static void lteiot6_clear_app_buf ( void )
  • static err_t lteiot6_process ( void )
  • static void lteiot6_error_check( err_t error_flag )
  • static void lteiot6_log_app_buf ( void )
  • static err_t lteiot6_rsp_check ( void )
  • static err_t lteiot6_configure_for_connection( void )
  • static err_t lteiot6_check_connection( void )
  • static err_t lteiot6_check_connection_parameters( void )
  • static err_t lteiot6_configure_for_meesages( void )
  • static err_t lteiot6_send_meesage( void )
Note
In order for the example to work, user needs to set the phone number to which he wants to send an SMS, and also will need to set an APN and SMSC of entered SIM card. Enter valid data for the following macros: SIM_APN, SIM_SMSC and PHONE_NUMBER_TO_MESSAGE. E.g. SIM_APN "vip.iot" SMSC_ADDRESS_CSCA "\"+381999999\",145" SMSC_ADDRESS_PDU "+381999999\" PHONE_NUMBER_TO_MESSAGE "+381659999999"
Author
Luka Filipovic

Macro Definition Documentation

◆ AIRPLANE_MODE

#define AIRPLANE_MODE   "4"

◆ AUTOMATIC

#define AUTOMATIC   "0"

◆ CMGF_PDU

#define CMGF_PDU   "+CMGF: 0"

◆ CMGF_TXT

#define CMGF_TXT   "+CMGF: 1"

◆ CONNECTED

#define CONNECTED   "+CREG: 1"

◆ DISCONNECT

#define DISCONNECT   "2"

◆ ENABLE_REG

#define ENABLE_REG   "2"

◆ FULL_FUNCTIONALITY

#define FULL_FUNCTIONALITY   "1"

◆ MESSAGE_CONTENT

#define MESSAGE_CONTENT   "LTE IoT 6 Click"

◆ PDU_MESSAGE_MODE

#define PDU_MESSAGE_MODE   "0"

◆ PHONE_NUMBER_TO_MESSAGE

#define PHONE_NUMBER_TO_MESSAGE   "+381659999999"

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   300

◆ SIM_APN

#define SIM_APN   ""

◆ SMSC_ADDRESS_CSCA

#define SMSC_ADDRESS_CSCA   "\"+381999999\",145"

◆ SMSC_ADDRESS_PDU

#define SMSC_ADDRESS_PDU   "+381999999"

◆ TXT_MESSAGE_MODE

#define TXT_MESSAGE_MODE   "1"

Enumeration Type Documentation

◆ lteiot6_example_state_t

Example states.

Predefined enum values for application example state.

Enumerator
LTEIOT6_CONFIGURE_FOR_CONNECTION 
LTEIOT6_WAIT_FOR_CONNECTION 
LTEIOT6_CHECK_CONNECTION 
LTEIOT6_CONFIGURE_FOR_MESSAGES 
LTEIOT6_MESSAGES 

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 )