No idea
Diff: ATParser.h
- Revision:
- 8:91515b168c70
- Parent:
- 7:d1b193880af1
- Child:
- 9:9bcb87c27208
diff -r d1b193880af1 -r 91515b168c70 ATParser.h --- a/ATParser.h Mon Jul 20 18:23:54 2015 +0000 +++ b/ATParser.h Mon Jul 20 20:56:30 2015 +0000 @@ -25,8 +25,22 @@ /** -* The ATParser class wraps information about the serial in use -*/ + * Parser class for parsing AT commands + * + * Here are some examples: + * @code + * ATParser at = ATParser(serial, "\r\n"); + * int value; + * char buffer[100]; + * + * at.send("AT") && at.recv("OK"); + * at.send("AT+CWMODE=%d", 3) && at.recv("OK"); + * at.send("AT+CWMODE?") && at.recv("+CWMODE:%d\r\nOK", &value); + * at.recv("+IPD,%d:", &value); + * at.read(buffer, value); + * at.recv("OK"); + * @endcode + */ class ATParser { private: // Serial information @@ -48,8 +62,8 @@ * @param timeout timeout of the connection * @param delimiter string of characters to use as line delimiters */ - ATParser(BufferedSerial *serial, int buffer_size = 256, int timeout = 8000, - const char *delimiter = "\r\n") : + ATParser(BufferedSerial *serial, const char *delimiter = "\r\n", + int buffer_size = 256, int timeout = 8000) : _serial(serial), _buffer_size(buffer_size) { _buffer = new char[buffer_size]; @@ -113,29 +127,6 @@ */ bool recv(const char *response, ...); bool vrecv(const char *response, va_list args); - - /** - * Issue AT commands - * - * Issues formatted commands and parses formatted responses. - * A command call is identical to a send call followed by a recv call. - * @see send, recv - * - * Here are some examples: - * @code - * at.command("AT", "OK"); - * at.command("AT+CWMODE=%d", "OK", 3); - * at.command("AT+CWMODE?", "+CWMODE:%d\r\nOK", &result); - * @endcode - * - * @param command printf-like format string of command to send - * @param response scanf-like format string of response to expect - * @param ... all printf-like arguments to insert into command followed by - * all scanf-like arguments to extract from response - * @return true only if response is successfully matched - */ - bool command(const char *command, const char *response, ...); - bool vcommand(const char *command, const char *response, va_list args); /** * Write a single byte to the underlying stream