AT (Hayes) library interface. More...

Detailed Description

AT (Hayes) library interface.

Author
Kaspar Schleiser kaspa.nosp@m.r@sc.nosp@m.hleis.nosp@m.er.d.nosp@m.e

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"
+ Include dependency graph for at.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...
 

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_SEND_ECHO   1
 Enable/disable the expected echo after an AT command is sent. More...
 
#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 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 CONFIG_AT_BUF_SIZE_EXP   (7U)
 Default buffer size used to process unsolicited result code data. More...
 
#define AT_BUF_SIZE   (1 << CONFIG_AT_BUF_SIZE_EXP)
 Size of buffer used to process unsolicited result code data.
 
#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. More...
 

Functions

int at_dev_init (at_dev_t *dev, uart_t uart, uint32_t baudrate, char *buf, size_t bufsize)
 Initialize AT device struct. More...
 
int at_send_cmd_wait_ok (at_dev_t *dev, const char *command, uint32_t timeout)
 Simple command helper. More...
 
int at_send_cmd_wait_prompt (at_dev_t *dev, const char *command, uint32_t timeout)
 Send AT command, wait for a prompt. More...
 
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. More...
 
ssize_t at_send_cmd_get_lines (at_dev_t *dev, const char *command, char *resp_buf, size_t len, bool keep_eol, uint32_t timeout)
 Send AT command, wait for multiline response. More...
 
int at_expect_bytes (at_dev_t *dev, const char *bytes, uint32_t timeout)
 Expect bytes from device. More...
 
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. More...
 
void at_send_bytes (at_dev_t *dev, const char *bytes, size_t len)
 Send raw bytes to a device. More...
 
ssize_t at_recv_bytes (at_dev_t *dev, char *bytes, size_t len, uint32_t timeout)
 Receive raw bytes from a device. More...
 
int at_send_cmd (at_dev_t *dev, const char *command, uint32_t timeout)
 Send command to device. More...
 
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. More...
 
void at_drain (at_dev_t *dev)
 Drain device input buffer. More...
 
void at_dev_poweron (at_dev_t *dev)
 Power device on. More...
 
void at_dev_poweroff (at_dev_t *dev)
 Power device off. More...
 
void at_add_urc (at_dev_t *dev, at_urc_t *urc)
 Add a callback for an unsolicited response code. More...
 
void at_remove_urc (at_dev_t *dev, at_urc_t *urc)
 Remove an unsolicited response code from the list. More...
 
void at_process_urc (at_dev_t *dev, uint32_t timeout)
 Process out-of-band data received from the device. More...