MT2523 API Reference  LinkIt SDK v4
ATCI

This section introduces the ATCI driver APIs including terms and acronyms, software architecture, supported features, details on how to use this driver, ATCI function groups, enums, structures and functions. More...

Overview

This section introduces the ATCI driver APIs including terms and acronyms, software architecture, supported features, details on how to use this driver, ATCI function groups, enums, structures and functions.

The ATCI header file provides the interface for target communication using AT commands though UART. The ATCI module APIs to register the AT command handler, send and receive UART data, and a parser to search for the registered AT command handler. The command handler gets and parses the input AT command data, then performs corresponding operation according to the specified behavior and parameters.

ATCI acronyms definition

Acronyms Definition
ATCI AT command interface. For more details about the AT command, please refer to Hayes command set in Wikipedia.
CMD Command.
URC Unsolicited result code. For the details of URC, please refer to Data communication over the telephone network.
UART Universal Asynchronous Receiver/Transmitter is usually an individual (or part of an) integrated circuit (IC) used for serial communications over a micro-controller unit(MCU) or peripheral device serial port. For an introduction to UART, please refer to UART in Wikipedia.

Supported features

ATCI architecture

The software architecture is shown in the figure below.

atci_architecture.png

The ATCI module contains the data transfer and parser sub-modules. The data transfer sub-module can receive UART data, then send to parser sub-module to find the right registered command handler. When the command handler is called to handle input command data, the command handler needs to give a response, then the ATCI data transfer module will send the response data through the UART. If the modules want provide some AT commands, they could use ATCI module register the command handlers to add more AT commands in the target. Also the command handler can send the URC data actively without receiving one input command data.

Folder structure

The folder structure of ATCI module is shown in the figure below.

atci_folder_structure.png

How to use this module

Functions

atci_status_t atci_register_handler (atci_cmd_hdlr_item_t *table, int32_t hdlr_number)
 This function registers the AT command handler. More...
 
atci_status_t atci_send_response (atci_response_t *response)
 This function sends the AT command response data or the URC data. More...
 
atci_status_t atci_init (uint16_t port)
 This function initializes the ATCI module. More...
 
void atci_processing (void)
 This function parses the input command to find the corresponding command handler and handle the response data. More...
 

Modules

 Define
 
 Enums
 
 Structures
 
 Typedef
 

Function Documentation

atci_status_t atci_init ( uint16_t  port)

This function initializes the ATCI module.

It is used to set the port configuration for data transmission.

Parameters
[in]portis the serial port number used to data transmission for ATCI. For more details about this parameter, please refer to hal_uart_port_t or serial_port_dev_t.
Returns
ATCI_STATUS_OK the ATCI initialized successfully.
ATCI_STATUS_ERROR the UART initialization or the ATCI local initialization failed due to the ATCI initialization failure.
Note
The atci_init() can select the UART through HAL UART port directly, or select UART, USB or BT SPP server/client port through port service for data transmission.
Example
1 ret = atci_init(port);
2 if (ret == ATCI_STATUS_OK) {
3  // The ATCI initialized successfully.
4  atci_register_handler(table, hdlr_number);
5  // Create an ATCI task.
6 } else {
7  // The ATCI initialization failed.
8 }
void atci_processing ( void  )

This function parses the input command to find the corresponding command handler and handle the response data.

Returns
void.
atci_status_t atci_register_handler ( atci_cmd_hdlr_item_t table,
int32_t  hdlr_number 
)

This function registers the AT command handler.

It is used to receive, parse and handle the registered input command data.

Parameters
[in]tableis the registered handler parameter. For more details about this parameter, please refer to atci_cmd_hdlr_item_t.
[in]hdlr_numberis the registered table handler size.
Returns
ATCI_STATUS_OK the ATCI command handler is successfully registered.
ATCI_STATUS_REGISTRATION_FAILURE duplicate registration of the AT command or an unused registration table will cause failure.
Example
1 ret = atci_register_handler(table, hdlr_number);
2 if (ret == ATCI_STATUS_OK) {
3  // AT CMD handler is successfully registered.
4 } else {
5  // AT CMD handler is failed to register because the duplcated registed AT command or none unused register table.
6 }
atci_status_t atci_send_response ( atci_response_t response)

This function sends the AT command response data or the URC data.

Parameters
[in]responseis the response data. For more details about this parameter, please refer to atci_response_t.
Returns
ATCI_STATUS_OK the ATCI module sent data to the UART successfully.