Parser for AT commands and similar protocols
Diff: ATParser.h
- Revision:
- 3:32915b9467d2
- Parent:
- 2:4d68f546861c
- Child:
- 4:38acbd6f9d9e
--- a/ATParser.h Thu Jul 16 22:50:43 2015 +0000 +++ b/ATParser.h Fri Jul 17 16:31:58 2015 +0000 @@ -37,6 +37,7 @@ // Parsing information const char *_delimiter; + int _delim_size; // Helper methods for putc/getc with timeout int _putc(char c); @@ -63,10 +64,10 @@ ATParser(BufferedSerial *serial, int buffer_size = 256, int timeout = 3000, const char *delimiter = "\r\n") : _serial(serial), - _buffer_size(buffer_size), - _timeout(timeout), - _delimiter(delimiter) { + _buffer_size(buffer_size) { _buffer = new char[buffer_size]; + setTimeout(timeout); + setDelimiter(delimiter); } /** @@ -92,6 +93,7 @@ */ void setDelimiter(const char *delimiter) { _delimiter = delimiter; + _delim_size = strlen(delimiter); } /**