21 #ifndef MBED_ATCMDPARSER_H 22 #define MBED_ATCMDPARSER_H 26 #include "NonCopyable.h" 27 #include "FileHandle.h" 68 const char *_output_delimiter;
69 int _output_delim_size;
95 int buffer_size = 256,
int timeout = 8000,
bool debug =
false)
96 : _fh(fh), _buffer_size(buffer_size), _oob_cb_count(0), _in_prev(0), _oobs(NULL)
98 _buffer =
new char[buffer_size];
152 _output_delimiter = output_delimiter;
153 _output_delim_size = strlen(output_delimiter);
178 _dbg_on = (on) ? 1 : 0;
206 bool send(
const char *command, ...) MBED_PRINTF_METHOD(1, 2);
208 bool vsend(
const char *command, std::va_list args);
224 bool recv(
const char *response, ...) MBED_SCANF_METHOD(1, 2);
226 bool vrecv(
const char *response, std::va_list args);
250 int write(
const char *data,
int size);
259 int read(
char *data,
int size);
269 int printf(
const char *format, ...) MBED_PRINTF_METHOD(1, 2);
271 int vprintf(
const char *format, std::va_list args);
281 int scanf(
const char *format, ...) MBED_SCANF_METHOD(1, 2);
283 int vscanf(
const char *format, std::va_list args);
324 #endif //MBED_ATCMDPARSER_H void debug_on(uint8_t on)
Allows traces from modem to be turned on or off.
void setTimeout(int timeout)
For backward compatibility.
int getc()
Get a single byte from the underlying stream.
void set_timeout(int timeout)
Allows timeout to be changed between commands.
bool send(const char *command,...)
Sends an AT command.
int putc(char c)
Write a single byte to the underlying stream.
Prevents generation of copy constructor and copy assignment operator in derived classes.
int scanf(const char *format,...)
Direct scanf on underlying stream.
void abort()
Abort current recv.
ATCmdParser(FileHandle *fh, const char *output_delimiter="\r", int buffer_size=256, int timeout=8000, bool debug=false)
Constructor.
void oob(const char *prefix, mbed::Callback< void()> func)
Attach a callback for out-of-band data.
int printf(const char *format,...)
Direct printf to underlying stream.
void debugOn(uint8_t on)
For backward compatibility.
int write(const char *data, int size)
Write an array of bytes to the underlying stream.
void set_delimiter(const char *output_delimiter)
Sets string of characters to use as line delimiters.
~ATCmdParser()
Destructor.
void flush()
Flushes the underlying stream.
Parser class for parsing AT commands.
bool process_oob(void)
Process out-of-band data.
int read(char *data, int size)
Read an array of bytes from the underlying stream.
bool recv(const char *response,...)
Receive an AT response.
void setDelimiter(const char *output_delimiter)
For backwards compatibility.