ltecat12 2.1.0.0
main.c File Reference

LTE Cat.1 2 Click Example. More...

#include "board.h"
#include "log.h"
#include "ltecat12.h"
#include "generic_pointer.h"
#include "conversions.h"

Macros

#define EXAMPLE_TCP_UDP   0
 
#define EXAMPLE_SMS   1
 
#define EXAMPLE_CALL   2
 
#define DEMO_EXAMPLE   EXAMPLE_TCP_UDP
 
#define SIM_APN   "internet"
 
#define SIM_SMSC   ""
 
#define PHONE_NUMBER   ""
 
#define SMS_MODE   "1"
 
#define REMOTE_IP   "77.46.162.162"
 
#define REMOTE_PORT   "51111"
 
#define MESSAGE_CONTENT   "LTE Cat.1 2 click board - demo example."
 
#define APP_BUFFER_SIZE   256
 
#define PROCESS_BUFFER_SIZE   256
 
#define RESTART_DEVICE   "1,1"
 
#define DEREGISTER_FROM_NETWORK   "2"
 
#define FULL_FUNCTIONALITY   "1"
 
#define ENABLE_REG   "2"
 
#define AUTOMATIC_REGISTRATION   "0"
 
#define CONNECTED   "+CREG: 1"
 
#define ACTIVATE_PDP_CONTEXT   "1,1"
 
#define REQ_DYNAMIC_IP   "1"
 
#define SRVTYPE_SOCKET   ",srvtype,\"socket\""
 
#define CONN_PROFILE   ",conid,\"1\""
 
#define ASCII_ALPHABET   ",alphabet,1"
 
#define ADDRESS_TCP   ",address,\"socktcp://"
 
#define ADDRESS_UDP   ",address,\"sockudp://"
 

Enumerations

enum  ltecat12_example_state_t { LTECAT12_CONFIGURE_FOR_NETWORK = 1 , LTECAT12_WAIT_FOR_CONNECTION , LTECAT12_CONFIGURE_FOR_EXAMPLE , LTECAT12_EXAMPLE }
 Example states. More...
 

Functions

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

Detailed Description

LTE Cat.1 2 Click Example.

Description

Application example shows device capability of connecting to the network and sending SMS, TCP/UDP messages or calling the selected number using standard "AT" commands.

The demo application is composed of two sections :

Application Init

Sets the device configuration for sending SMS, TCP/UDP messages or calling the selected number.

Application Task

Depending on the selected demo example, it sends an SMS message (in PDU or TXT mode) or a TCP/UDP message or calls the selected number.

Additional Function

  • static void ltecat12_clear_app_buf ( void )
  • static err_t ltecat12_process ( void )
  • static void ltecat12_error_check( err_t error_flag )
  • static void ltecat12_log_app_buf ( void )
  • static err_t ltecat12_rsp_check ( uint8_t *rsp )
  • static err_t ltecat12_cfg_for_network ( void )
  • static err_t ltecat12_check_connection ( void )
  • static err_t ltecat12_cfg_for_example ( void )
  • static err_t ltecat12_example ( void )
Note
In order for the examples to work, 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 Ilic

Macro Definition Documentation

◆ ACTIVATE_PDP_CONTEXT

#define ACTIVATE_PDP_CONTEXT   "1,1"

◆ ADDRESS_TCP

#define ADDRESS_TCP   ",address,\"socktcp://"

◆ ADDRESS_UDP

#define ADDRESS_UDP   ",address,\"sockudp://"

◆ APP_BUFFER_SIZE

#define APP_BUFFER_SIZE   256

◆ ASCII_ALPHABET

#define ASCII_ALPHABET   ",alphabet,1"

◆ AUTOMATIC_REGISTRATION

#define AUTOMATIC_REGISTRATION   "0"

◆ CONN_PROFILE

#define CONN_PROFILE   ",conid,\"1\""

◆ CONNECTED

#define CONNECTED   "+CREG: 1"

◆ DEMO_EXAMPLE

#define DEMO_EXAMPLE   EXAMPLE_TCP_UDP

◆ DEREGISTER_FROM_NETWORK

#define DEREGISTER_FROM_NETWORK   "2"

◆ ENABLE_REG

#define ENABLE_REG   "2"

◆ EXAMPLE_CALL

#define EXAMPLE_CALL   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   "LTE Cat.1 2 click board - demo example."

◆ PHONE_NUMBER

#define PHONE_NUMBER   ""

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   256

◆ REMOTE_IP

#define REMOTE_IP   "77.46.162.162"

◆ REMOTE_PORT

#define REMOTE_PORT   "51111"

◆ REQ_DYNAMIC_IP

#define REQ_DYNAMIC_IP   "1"

◆ RESTART_DEVICE

#define RESTART_DEVICE   "1,1"

◆ SIM_APN

#define SIM_APN   "internet"

◆ SIM_SMSC

#define SIM_SMSC   ""

◆ SMS_MODE

#define SMS_MODE   "1"

◆ SRVTYPE_SOCKET

#define SRVTYPE_SOCKET   ",srvtype,\"socket\""

Enumeration Type Documentation

◆ ltecat12_example_state_t

Example states.

Predefined enum values for application example state.

Enumerator
LTECAT12_CONFIGURE_FOR_NETWORK 
LTECAT12_WAIT_FOR_CONNECTION 
LTECAT12_CONFIGURE_FOR_EXAMPLE 
LTECAT12_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 )