Extending the application¶
You can extend the serial LTE modem application by adding your own AT commands and custom error handling.
If you want to implement custom AT commands and add them to the serial LTE modem application, see the parser implementation of the provided proprietary AT commands for reference.
The source files can be found in the
Complete the following steps to add a parser for your own AT commands:
Create a header file in
applications/nrf9160/serial_lte_modem/src/. The file must expose the following functions:
*_init()- Initialize the parser.
*_uninit()- Uninitialize the parser.
See the files for existing AT command parsers for reference.
Implement your AT strings and handlers in a corresponding
.cfile. See the files for existing AT command parsers for reference.
Pay attention to the following requirements:
The names of new AT commands should start with
Before entering idle state, the serial LTE modem application will call the uninit function. Make sure that the uninit function exits successfully. Otherwise, the application cannot enter idle state.
applications/nrf9160/serial_lte_modem/src/slm_at_commands.cand add calls to your functions:
slm_at_init(), add a call to your init function.
slm_at_uninit(), add a call to your uninit function.
Declare your command handler like those of other service modules.
slm_at_cmd_list, add the mapping of your AT command and its handler.
If you discover any bugs in the
slm_at_host.c files, report them on the DevZone.
The serial LTE modem application returns error codes that are defined in
See the comments in that file for information about a specific error.
If an error occurs during TCP/IP processing, the socket is usually closed. See the POSIX Programmer’s Manual for information about the errors returned by each API.