Parser for AT commands and similar protocols
Diff: ATParser.h
- Revision:
- 4:38acbd6f9d9e
- Parent:
- 3:32915b9467d2
- Child:
- 5:26bc9255b751
--- a/ATParser.h Fri Jul 17 16:31:58 2015 +0000 +++ b/ATParser.h Fri Jul 17 16:38:44 2015 +0000 @@ -37,14 +37,7 @@ // Parsing information const char *_delimiter; - int _delim_size; - - // Helper methods for putc/getc with timeout - int _putc(char c); - int _getc(); - - // Flush used to clear serial connection - void _flush(); + int _delim_size; // Helper methods for reading/writing lines with // timeout and buffer limitations @@ -126,5 +119,25 @@ * @return true only if response is successfully matched */ bool command(const char *command, const char *response, ...); + + /** + * Write a single byte to the underlying stream + * + * @param c The byte to write + * @return The byte that was written or -1 during a timeout + */ + int putc(char c); + + /** + * Get a single byte from the underlying stream + * + * @return The byte that was read or -1 during a timeout + */ + int getc(); + + /** + * Flushes the underlying stream + */ + void flush(); };