Parser for AT commands and similar protocols

Dependencies:   BufferedSerial

Revision:
11:fd406d4c4227
Parent:
10:553f9ffaf657
Child:
12:7d3c3f7ce928
diff -r 553f9ffaf657 -r fd406d4c4227 ATParser.h
--- 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;
     }
 
     /**