nth-eye / at

AT modem response parser in C++ as FSM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

at

The library provides a minimalistic and efficient solution for parsing and handling AT commands, commonly used in communication with modems and other network interfaces. The core is a finite state machine (FSM) that interprets the responses from AT command interfaces.

To use the library, simply instantiate a parser with the desired buffer size, feed input characters into the FSM via the process method, and retrieve parsed results through the get_result method. The FSM handles the complexities of AT command syntax, providing a straightforward interface for command response handling.

Example

at::parser<64> parser;

parser.setup("+TEST");
parser.clear();

while (1) {

    parser.process(getc()); // from UART for example

    if (parser.full()       ||
        parser.acquired()   ||
        parser.response()   != at::invalid) 
    {
        puts("+-------RAW_-------+");
        log_hex(parser.get_raw());
        puts("+-------LINE-------+");
        log_hex(parser.get_line());
        puts("+-------ARGS-------+");
        log_hex(parser.get_args());
        puts("+------------------+");
        parser.clear();
    }
}

TODO

  • source
  • tests
  • readme

About

AT modem response parser in C++ as FSM

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 95.0%Language:CMake 5.0%