Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ATParser by
Revision 11:fd406d4c4227, committed 2015-12-28
- Comitter:
- sam_grove
- Date:
- Mon Dec 28 05:37:44 2015 +0000
- Parent:
- 10:553f9ffaf657
- Child:
- 12:7d3c3f7ce928
- Commit message:
- rename echo to debug - uses debug calls.
Changed in this revision
| ATParser.cpp | Show annotated file Show diff for this revision Revisions of this file |
| ATParser.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ATParser.cpp Sun Jul 26 21:53:28 2015 +0000
+++ b/ATParser.cpp Mon Dec 28 05:37:44 2015 +0000
@@ -184,7 +184,7 @@
}
}
- debug_if(at_echo, "AT> %s\r\n", _buffer);
+ debug_if(dbg_on, "AT> %s\r\n", _buffer);
return true;
}
@@ -247,7 +247,7 @@
// We only succeed if all characters in the response are matched
if (count == j) {
- debug_if(at_echo, "AT= %s\r\n", _buffer+offset);
+ debug_if(dbg_on, "AT= %s\r\n", _buffer+offset);
// Reuse the front end of the buffer
memcpy(_buffer, response, i);
_buffer[i] = 0;
@@ -262,7 +262,7 @@
// Clear the buffer when we hit a newline
if (strcmp(&_buffer[offset + j-_delim_size], _delimiter) == 0) {
- debug_if(at_echo, "AT< %s", _buffer+offset);
+ debug_if(dbg_on, "AT< %s", _buffer+offset);
j = 0;
}
}
--- a/ATParser.h Sun Jul 26 21:53:28 2015 +0000
+++ b/ATParser.h Mon Dec 28 05:37:44 2015 +0000
@@ -52,7 +52,7 @@
// Parsing information
const char *_delimiter;
int _delim_size;
- uint8_t at_echo;
+ bool dbg_on;
public:
/**
@@ -63,13 +63,13 @@
* @param timeout timeout of the connection
* @param delimiter string of characters to use as line delimiters
*/
- ATParser(BufferedSerial &serial, const char *delimiter = "\r\n", int buffer_size = 256, int timeout = 8000, uint8_t echo = 0) :
+ ATParser(BufferedSerial &serial, const char *delimiter = "\r\n", int buffer_size = 256, int timeout = 8000, bool debug = false) :
_serial(&serial),
_buffer_size(buffer_size) {
_buffer = new char[buffer_size];
setTimeout(timeout);
setDelimiter(delimiter);
- setEcho(echo);
+ debugOn(debug);
}
/**
@@ -103,8 +103,8 @@
*
* @param echo 1 for echo and 0 turns it off
*/
- void setEcho(uint8_t echo) {
- at_echo = (echo) ? 1 : 0;
+ void debugOn(uint8_t on) {
+ dbg_on = (on) ? 1 : 0;
}
/**
