c4gltegnss  2.1.0.0
Macros | Enumerations | Functions
main.c File Reference

4G LTE GNSS Click Example. More...

#include "board.h"
#include "log.h"
#include "c4gltegnss.h"
#include "conversions.h"

Macros

#define EXAMPLE_TCP_UDP   0
 
#define EXAMPLE_SMS   1
 
#define EXAMPLE_GNSS   2
 
#define DEMO_EXAMPLE   EXAMPLE_TCP_UDP
 
#define SIM_APN   "internet"
 
#define SIM_SMSC   ""
 
#define PHONE_NUMBER_TO_MESSAGE   ""
 
#define SMS_MODE   "1"
 
#define REMOTE_IP   "77.46.162.162"
 
#define REMOTE_PORT   "51111"
 
#define MESSAGE_CONTENT   "4G LTE GNSS click board - demo example."
 
#define APP_BUFFER_SIZE   256
 
#define PROCESS_BUFFER_SIZE   256
 
#define FULL_FUNCTIONALITY   "1"
 
#define ENABLE_REG   "2"
 
#define AUTOMATIC_REGISTRATION   "0"
 
#define CONNECTED   "+CREG: 1"
 
#define ACTIVATE_PDP_CONTEXT   "1,1"
 
#define RSP_USOCR   "+USOCR:"
 
#define TCP_PROTOCOL   "6"
 
#define UDP_PROTOCOL   "17"
 
#define ASYNC_CONNECT   "1"
 
#define URC_READ_SOCKET_DATA_TCP   "+UUSORD:"
 
#define URC_READ_SOCKET_DATA_UDP   "+UUSORF:"
 

Enumerations

enum  c4gltegnss_example_state_t { C4GLTEGNSS_CONFIGURE_FOR_NETWORK = 1, C4GLTEGNSS_WAIT_FOR_CONNECTION, C4GLTEGNSS_CONFIGURE_FOR_EXAMPLE, C4GLTEGNSS_EXAMPLE }
 Example states. More...
 

Functions

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

Detailed Description

4G LTE GNSS Click Example.

Description

Application example shows device capability of connecting to the network and sending SMS or TCP/UDP messages, or retrieving data from GNSS using standard "AT" commands.

The demo application is composed of two sections :

Application Init

Initializes the driver, restarts the device, and after that tests the communication by sending "AT" command.

Application Task

Application task is split in few stages:

By default, the TCP/UDP example is selected.

Additional Function

Note
In order for the examples to work (except GNSS example), user needs to set the APN and SMSC (SMS PDU mode only) of entered SIM card as well as the phone number (SMS mode only) to which he wants to send an SMS. Enter valid values for the following macros: SIM_APN, SIM_SMSC and PHONE_NUMBER_TO_MESSAGE. Example: SIM_APN "internet" SIM_SMSC "+381610401" PHONE_NUMBER_TO_MESSAGE "+381659999999"
Author
Stefan Filipovic

Macro Definition Documentation

◆ ACTIVATE_PDP_CONTEXT

#define ACTIVATE_PDP_CONTEXT   "1,1"

◆ APP_BUFFER_SIZE

#define APP_BUFFER_SIZE   256

◆ ASYNC_CONNECT

#define ASYNC_CONNECT   "1"

◆ AUTOMATIC_REGISTRATION

#define AUTOMATIC_REGISTRATION   "0"

◆ CONNECTED

#define CONNECTED   "+CREG: 1"

◆ DEMO_EXAMPLE

#define DEMO_EXAMPLE   EXAMPLE_TCP_UDP

◆ ENABLE_REG

#define ENABLE_REG   "2"

◆ EXAMPLE_GNSS

#define EXAMPLE_GNSS   2

◆ EXAMPLE_SMS

#define EXAMPLE_SMS   1

◆ EXAMPLE_TCP_UDP

#define EXAMPLE_TCP_UDP   0

◆ FULL_FUNCTIONALITY

#define FULL_FUNCTIONALITY   "1"

◆ MESSAGE_CONTENT

#define MESSAGE_CONTENT   "4G LTE GNSS click board - demo example."

◆ PHONE_NUMBER_TO_MESSAGE

#define PHONE_NUMBER_TO_MESSAGE   ""

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   256

◆ REMOTE_IP

#define REMOTE_IP   "77.46.162.162"

◆ REMOTE_PORT

#define REMOTE_PORT   "51111"

◆ RSP_USOCR

#define RSP_USOCR   "+USOCR:"

◆ SIM_APN

#define SIM_APN   "internet"

◆ SIM_SMSC

#define SIM_SMSC   ""

◆ SMS_MODE

#define SMS_MODE   "1"

◆ TCP_PROTOCOL

#define TCP_PROTOCOL   "6"

◆ UDP_PROTOCOL

#define UDP_PROTOCOL   "17"

◆ URC_READ_SOCKET_DATA_TCP

#define URC_READ_SOCKET_DATA_TCP   "+UUSORD:"

◆ URC_READ_SOCKET_DATA_UDP

#define URC_READ_SOCKET_DATA_UDP   "+UUSORF:"

Enumeration Type Documentation

◆ c4gltegnss_example_state_t

Example states.

Predefined enum values for application example state.

Enumerator
C4GLTEGNSS_CONFIGURE_FOR_NETWORK 
C4GLTEGNSS_WAIT_FOR_CONNECTION 
C4GLTEGNSS_CONFIGURE_FOR_EXAMPLE 
C4GLTEGNSS_EXAMPLE 

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  )