mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
187:0387e8f68319
Parent:
184:08ed48f1de7f
Child:
188:bcfe06ba3d64
--- a/platform/ATCmdParser.cpp	Fri Jun 22 16:45:37 2018 +0100
+++ b/platform/ATCmdParser.cpp	Thu Sep 06 13:40:20 2018 +0100
@@ -79,7 +79,7 @@
 int ATCmdParser::write(const char *data, int size)
 {
     int i = 0;
-    for ( ; i < size; i++) {
+    for (; i < size; i++) {
         if (putc(data[i]) < 0) {
             return -1;
         }
@@ -90,7 +90,7 @@
 int ATCmdParser::read(char *data, int size)
 {
     int i = 0;
-    for ( ; i < size; i++) {
+    for (; i < size; i++) {
         int c = getc();
         if (c < 0) {
             return -1;
@@ -110,7 +110,7 @@
     }
 
     int i = 0;
-    for ( ; _buffer[i]; i++) {
+    for (; _buffer[i]; i++) {
         if (putc(_buffer[i]) < 0) {
             return -1;
         }
@@ -128,7 +128,7 @@
     int offset = 0;
 
     while (format[i]) {
-        if (format[i] == '%' && format[i+1] != '%' && format[i+1] != '*') {
+        if (format[i] == '%' && format[i + 1] != '%' && format[i + 1] != '*') {
             _buffer[offset++] = '%';
             _buffer[offset++] = '*';
             i++;
@@ -155,7 +155,7 @@
 
     while (true) {
         // Ran out of space
-        if (j+1 >= _buffer_size - offset) {
+        if (j + 1 >= _buffer_size - offset) {
             return false;
         }
         // Receive next character
@@ -168,12 +168,12 @@
 
         // Check for match
         int count = -1;
-        sscanf(_buffer+offset, _buffer, &count);
+        sscanf(_buffer + offset, _buffer, &count);
 
         // We only succeed if all characters in the response are matched
         if (count == j) {
             // Store the found results
-            vsscanf(_buffer+offset, format, args);
+            vsscanf(_buffer + offset, format, args);
             return j;
         }
     }
@@ -220,14 +220,14 @@
         bool whole_line_wanted = false;
 
         while (response[i]) {
-            if (response[i] == '%' && response[i+1] != '%' && response[i+1] != '*') {
+            if (response[i] == '%' && response[i + 1] != '%' && response[i + 1] != '*') {
                 _buffer[offset++] = '%';
                 _buffer[offset++] = '*';
                 i++;
             } else {
                 _buffer[offset++] = response[i++];
                 // Find linebreaks, taking care not to be fooled if they're in a %[^\n] conversion specification
-                if (response[i - 1] == '\n' && !(i >= 3 && response[i-3] == '[' && response[i-2] == '^')) {
+                if (response[i - 1] == '\n' && !(i >= 3 && response[i - 3] == '[' && response[i - 2] == '^')) {
                     whole_line_wanted = true;
                     break;
                 }
@@ -260,7 +260,7 @@
             }
             // Simplify newlines (borrowed from retarget.cpp)
             if ((c == CR && _in_prev != LF) ||
-                (c == LF && _in_prev != CR)) {
+                    (c == LF && _in_prev != CR)) {
                 _in_prev = c;
                 c = '\n';
             } else if ((c == CR && _in_prev == LF) ||
@@ -277,7 +277,7 @@
             // Check for oob data
             for (struct oob *oob = _oobs; oob; oob = oob->next) {
                 if ((unsigned)j == oob->len && memcmp(
-                        oob->prefix, _buffer+offset, oob->len) == 0) {
+                            oob->prefix, _buffer + offset, oob->len) == 0) {
                     debug_if(_dbg_on, "AT! %s\n", oob->prefix);
                     oob->cb();
 
@@ -298,18 +298,18 @@
                 // This allows recv("Foo: %s\n") to work, and not match with just the first character of a string
                 // (scanf does not itself match whitespace in its format string, so \n is not significant to it)
             } else {
-                sscanf(_buffer+offset, _buffer, &count);
+                sscanf(_buffer + offset, _buffer, &count);
             }
 
             // We only succeed if all characters in the response are matched
             if (count == j) {
-                debug_if(_dbg_on, "AT= %s\n", _buffer+offset);
+                debug_if(_dbg_on, "AT= %s\n", _buffer + offset);
                 // Reuse the front end of the buffer
                 memcpy(_buffer, response, i);
                 _buffer[i] = 0;
 
                 // Store the found results
-                vsscanf(_buffer+offset, _buffer, args);
+                vsscanf(_buffer + offset, _buffer, args);
 
                 // Jump to next line and continue parsing
                 response += i;
@@ -318,8 +318,8 @@
 
             // Clear the buffer when we hit a newline or ran out of space
             // running out of space usually means we ran into binary data
-            if (c == '\n' || j+1 >= _buffer_size - offset) {
-                debug_if(_dbg_on, "AT< %s", _buffer+offset);
+            if (c == '\n' || j + 1 >= _buffer_size - offset) {
+                debug_if(_dbg_on, "AT< %s", _buffer + offset);
                 j = 0;
             }
         }
@@ -396,7 +396,7 @@
         }
         // Simplify newlines (borrowed from retarget.cpp)
         if ((c == CR && _in_prev != LF) ||
-            (c == LF && _in_prev != CR)) {
+                (c == LF && _in_prev != CR)) {
             _in_prev = c;
             c = '\n';
         } else if ((c == CR && _in_prev == LF) ||
@@ -414,17 +414,17 @@
         struct oob *oob = _oobs;
         while (oob) {
             if (i == (int)oob->len && memcmp(
-                    oob->prefix, _buffer, oob->len) == 0) {
+                        oob->prefix, _buffer, oob->len) == 0) {
                 debug_if(_dbg_on, "AT! %s\r\n", oob->prefix);
                 oob->cb();
                 return true;
             }
             oob = oob->next;
         }
-        
+
         // Clear the buffer when we hit a newline or ran out of space
         // running out of space usually means we ran into binary data
-        if (((i+1) >= _buffer_size) || (c == '\n')) {
+        if (((i + 1) >= _buffer_size) || (c == '\n')) {
             debug_if(_dbg_on, "AT< %s", _buffer);
             i = 0;
         }