nbiot4  2.0.0.0
Macros | Enumerations | Functions
main.c File Reference

NB IoT 4 Click Example. More...

#include "board.h"
#include "log.h"
#include "nbiot4.h"

Macros

#define SIM_APN   "sim_apn"
 
#define PHONE_NUMBER_TO_MESSAGE   "+381659999999"
 
#define MESSAGE_CONTENT   "NB IoT 4 Click"
 
#define SMSC_ADDRESS   "+381999999"
 
#define PROCESS_BUFFER_SIZE   600
 
#define PDU_MESSAGE
 
#define EXTERN_SIM   "^SIMSWAP: 1"
 
#define SET_EXTERN_SIM   "1"
 
#define EN_FUNCTIONALITY   "1"
 
#define ENABLE_REG   "2"
 
#define HOME_NETWORK_CONNECTED   "+CEREG: 2,1"
 
#define MESSAGE_MODE   "0"
 
#define CMGF_PDU   "+CMGF: 0"
 
#define CMGF_TXT   "+CMGF: 1"
 

Enumerations

enum  nbiot4_example_state_t {
  NBIOT4_CONFIGURE_FOR_CONNECTION = 1, NBIOT4_WAIT_FOR_CONNECTION, NBIOT4_CHECK_CONNECTION, NBIOT4_CONFIGURE_FOR_SMS,
  NBIOT4_MESSAGES
}
 Example states. More...
 

Functions

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

Detailed Description

NB IoT 4 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 UART communication modules and additional pins wait for powerup or restarts device. Test communication and read information from device.

Application Task

First it confiures device for connection to network(sets extern sim, selected apn). It waits until device gets information that is connected to home network. Then checks connection parameters. After that it configures device for one type of sending message TEXT or PDU mode. In the end it sends SMS message to selected number.

Additional Function

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, SMSC_ADDRESS and PHONE_NUMBER_TO_MESSAGE. E.g. SIM_APN "vip.iot" SMSC_ADDRESS "+381610401" PHONE_NUMBER_TO_MESSAGE "+381659999999"
Author
Luka Filipovic

Macro Definition Documentation

◆ CMGF_PDU

#define CMGF_PDU   "+CMGF: 0"

◆ CMGF_TXT

#define CMGF_TXT   "+CMGF: 1"

◆ EN_FUNCTIONALITY

#define EN_FUNCTIONALITY   "1"

◆ ENABLE_REG

#define ENABLE_REG   "2"

◆ EXTERN_SIM

#define EXTERN_SIM   "^SIMSWAP: 1"

◆ HOME_NETWORK_CONNECTED

#define HOME_NETWORK_CONNECTED   "+CEREG: 2,1"

◆ MESSAGE_CONTENT

#define MESSAGE_CONTENT   "NB IoT 4 Click"

◆ MESSAGE_MODE

#define MESSAGE_MODE   "0"

◆ PDU_MESSAGE

#define PDU_MESSAGE

Select message type

◆ PHONE_NUMBER_TO_MESSAGE

#define PHONE_NUMBER_TO_MESSAGE   "+381659999999"

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   600

◆ SET_EXTERN_SIM

#define SET_EXTERN_SIM   "1"

◆ SIM_APN

#define SIM_APN   "sim_apn"

◆ SMSC_ADDRESS

#define SMSC_ADDRESS   "+381999999"

Enumeration Type Documentation

◆ nbiot4_example_state_t

Example states.

Predefined enum values for application example state.

Enumerator
NBIOT4_CONFIGURE_FOR_CONNECTION 
NBIOT4_WAIT_FOR_CONNECTION 
NBIOT4_CHECK_CONNECTION 
NBIOT4_CONFIGURE_FOR_SMS 
NBIOT4_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()

void main ( void  )