AT (Hayes) library interface. More...
AT (Hayes) library interface.
Definition in file at.h.
#include <stdint.h>
#include <unistd.h>
#include <stdbool.h>
#include "isrpipe.h"
#include "periph/uart.h"
#include "clist.h"
#include "kernel_defines.h"
#include "event.h"
Go to the source code of this file.
Data Structures | |
struct | at_urc_t |
Unsolicited result code data structure. More... | |
struct | at_dev_t |
AT device structure. More... | |
struct | at_dev_init_t |
AT device initialization parameters. More... | |
Macros | |
#define | CONFIG_AT_SEND_EOL "\r" |
End of line character to send after the AT command. | |
#define | CONFIG_AT_SEND_SKIP_ECHO |
Enable this to disable check for echo after an AT command is sent. | |
#define | AT_RECV_EOL_1 "\r" |
1st end of line character received (S3 aka CR character for a modem). | |
#define | AT_RECV_EOL_2 "\n" |
1st end of line character received (S4 aka LF character for a modem). | |
#define | AT_RECV_EOL AT_RECV_EOL_1 AT_RECV_EOL_2 |
convenience macro for the EOL sequence sent by the DCE | |
#define | CONFIG_AT_RECV_OK "OK" |
default OK reply of an AT device. | |
#define | CONFIG_AT_RECV_ERROR "ERROR" |
default ERROR reply of an AT device. | |
#define | AT_ERR_EXTENDED 200 |
Error cause can be further investigated. | |
#define | AT_SEND_EOL_LEN (sizeof(CONFIG_AT_SEND_EOL) - 1) |
Shortcut for getting send end of line length. | |
Typedefs | |
typedef void(* | at_urc_cb_t) (void *arg, const char *code) |
Unsolicited result code callback. | |
Functions | |
static char const * | at_get_err_info (at_dev_t const *dev) |
Get extended error information of the last command sent. | |
int | at_dev_init (at_dev_t *dev, at_dev_init_t const *init) |
Initialize AT device struct. | |
int | at_send_cmd_wait_ok (at_dev_t *dev, const char *command, uint32_t timeout) |
Simple command helper. | |
int | at_send_cmd_wait_prompt (at_dev_t *dev, const char *command, uint32_t timeout) |
Send AT command, wait for a prompt. | |
int | at_wait_prompt (at_dev_t *dev, uint32_t timeout) |
Waits for the prompt character (>). | |
ssize_t | at_send_cmd_get_resp (at_dev_t *dev, const char *command, char *resp_buf, size_t len, uint32_t timeout) |
Send AT command, wait for response. | |
ssize_t | at_get_resp_with_prefix (at_dev_t *dev, const char *resp_prefix, char *resp_buf, size_t len, uint32_t timeout) |
Wait for a response with a specific prefix. | |
ssize_t | at_send_cmd_get_resp_wait_ok (at_dev_t *dev, const char *command, const char *resp_prefix, char *resp_buf, size_t len, uint32_t timeout) |
Send AT command, wait for response plus OK. | |
ssize_t | at_send_cmd_get_lines (at_dev_t *dev, const char *command, char *resp_buf, size_t len, uint32_t timeout) |
Send AT command, wait for multiline response. | |
int | at_expect_bytes (at_dev_t *dev, const char *bytes, uint32_t timeout) |
Expect bytes from device. | |
int | at_wait_bytes (at_dev_t *dev, const char *bytes, uint32_t timeout) |
Repeatedly calls at_expect_bytes() until a match or timeout occurs. | |
int | at_recv_bytes_until_string (at_dev_t *dev, const char *string, char *bytes, size_t *bytes_len, uint32_t timeout) |
Receives bytes into bytes buffer until the string pattern string is received or the buffer is full. | |
void | at_send_bytes (at_dev_t *dev, const char *bytes, size_t len) |
Send raw bytes to a device. | |
ssize_t | at_recv_bytes (at_dev_t *dev, char *bytes, size_t len, uint32_t timeout) |
Receive raw bytes from a device. | |
int | at_send_cmd (at_dev_t *dev, const char *command, uint32_t timeout) |
Send command to device. | |
int | at_parse_resp (at_dev_t *dev, char const *resp) |
Parse a response from the device. | |
ssize_t | at_readline (at_dev_t *dev, char *resp_buf, size_t len, bool keep_eol, uint32_t timeout) |
Read a line from device. | |
ssize_t | at_readline_skip_empty (at_dev_t *dev, char *resp_buf, size_t len, bool keep_eol, uint32_t timeout) |
Read a line from device, skipping a possibly empty line. | |
int | at_wait_ok (at_dev_t *dev, uint32_t timeout) |
Wait for an OK response. | |
void | at_drain (at_dev_t *dev) |
Drain device input buffer. | |
void | at_dev_poweron (at_dev_t *dev) |
Power device on. | |
void | at_dev_poweroff (at_dev_t *dev) |
Power device off. | |
void | at_add_urc (at_dev_t *dev, at_urc_t *urc) |
Add a callback for an unsolicited response code. | |
void | at_remove_urc (at_dev_t *dev, at_urc_t *urc) |
Remove an unsolicited response code from the list. | |
void | at_process_urc (at_dev_t *dev, uint32_t timeout) |
Process out-of-band data received from the device. | |
void | at_postprocess_urc (at_dev_t *dev, char *buf) |
Process one URC from the provided buffer. | |
void | at_postprocess_urc_all (at_dev_t *dev, char *buf) |
Process all URCs from the provided buffer. | |