lteiot9 2.0.0.0
main.c File Reference

LTE IoT 9 Click Example. More...

#include "board.h"
#include "log.h"
#include "lteiot9.h"

Macros

#define SIM_APN   ""
 
#define PHONE_NUMBER_TO_MESSAGE   ""
 
#define MESSAGE_CONTENT   "LTE IoT 9 Click"
 
#define PROCESS_BUFFER_SIZE   500
 
#define CONFIGURATION_FOR_NETWORK   0
 
#define CHECK_NETWORK_CONNECTION   1
 
#define SENDING_SMS   2
 
#define CONFIGURATION_FOR_GNSS   3
 
#define GNSS_DATA   4
 
#define CONNECTED   "+CGATT: 1"
 
#define GNNS_START_MODE_EN   "AT^SGPSC=\"Engine/StartMode\",0"
 
#define GNNS_START_GPS   "AT^SGPSC=\"Nmea/GPS\",\"on\""
 
#define GNSS_POWER_UP   "AT^SGPSC=\"Engine\",3"
 

Functions

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

Detailed Description

LTE IoT 9 Click Example.

Description

This application shows capability of LTE IoT 9 click board. It connects to network with standard "AT" commands, then sends SMS whit SIM card, and then logs GNNS data.

The demo application is composed of two sections :

Application Init

Initializes driver and wake-up module and checks communication and device version.

Application Task

Application taks is split in few stages:

  • CONFIGURATION_FOR_NETWORK : Sets configuration to device to be able to connect to newtork.
  • CHECK_NETWORK_CONNECTION : Checks device connection status till device is connected to network.
  • SENDING_SMS : Sends SMS message to desired number in text mode.
  • CONFIGURATION_FOR_GNSS : Sets configuration to device to enable GNSS data.
  • GNSS_DATA : Reads and parses data from device to get latitude, longitude and altitude from device

Additional Function

  • lteiot9_clear_app_buf : Function clears memory of app_buf.
  • lteiot9_process : Function collects data from module and concat that data to app_buf.
  • lteiot9_error_check : Function checks for different types of errors and logs them on UART.
  • lteiot9_log_app_buf : Function logs data from application buffer.
  • lteiot9_rsp_check : Function checks for response and returns the status of response.
  • lteiot9_check_connection : Function checks connection to the network and logs that status to UART.
  • lteiot9_cmd_parser : Function searches application buffer for command and logs data of that command.
  • lteiot9_element_parser : Function searches application buffer for command and its element and copies data to element_data buffer.
  • lteiot9_power_up_wait : Function loops process function untill device respond with "^SYSSTART" that device sends on power up/restart.
  • lteiot9_config_device_for_network : Function sends commands for enableing network.
  • lteiot9_check_connection_to_network : Function sends commands for checking connection to network.
  • lteiot9_send_sms : Function sends SMS via network in text mode.
  • lteiot9_config_device_for_gnss : Function sends commands for enableing GNSS.
  • lteiot9_gnss_data : Function reads data from device and parses data to find latitude, longitude and altitude.
Note
In order for the example to work, user needs to set the phone number and sim apn to which he wants to send an SMS Enter valid data for the following macros: SIM_APN and PHONE_NUMBER_TO_MESSAGE. E.g. SIM_APN "vipmobile" PHONE_NUMBER_TO_MESSAGE "+381659999999"
Author
Luka FIlipovic

Macro Definition Documentation

◆ CHECK_NETWORK_CONNECTION

#define CHECK_NETWORK_CONNECTION   1

◆ CONFIGURATION_FOR_GNSS

#define CONFIGURATION_FOR_GNSS   3

◆ CONFIGURATION_FOR_NETWORK

#define CONFIGURATION_FOR_NETWORK   0

◆ CONNECTED

#define CONNECTED   "+CGATT: 1"

◆ GNNS_START_GPS

#define GNNS_START_GPS   "AT^SGPSC=\"Nmea/GPS\",\"on\""

◆ GNNS_START_MODE_EN

#define GNNS_START_MODE_EN   "AT^SGPSC=\"Engine/StartMode\",0"

◆ GNSS_DATA

#define GNSS_DATA   4

◆ GNSS_POWER_UP

#define GNSS_POWER_UP   "AT^SGPSC=\"Engine\",3"

◆ MESSAGE_CONTENT

#define MESSAGE_CONTENT   "LTE IoT 9 Click"

◆ PHONE_NUMBER_TO_MESSAGE

#define PHONE_NUMBER_TO_MESSAGE   ""

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   500

◆ SENDING_SMS

#define SENDING_SMS   2

◆ SIM_APN

#define SIM_APN   ""

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 )