cc

Dependencies:   ATParser

Revision:
1:becf69a794fb
Parent:
0:9e5d98ceea74
Child:
2:40d183d7dc19
--- a/SPWFSA01.cpp	Thu Jun 30 06:04:46 2016 +0000
+++ b/SPWFSA01.cpp	Thu Jun 30 06:31:09 2016 +0000
@@ -157,7 +157,7 @@
                 break;
             }
             
-    printf("\r\nip address:%u.%u.%u.%u\n",n1, n2, n3, n4);
+    //printf("\r\nip address:%u.%u.%u.%u\n",n1, n2, n3, n4);
         
     return true;
 }
@@ -200,12 +200,12 @@
     uint32_t n1, n2, n3, n4;
     
     if (!(_parser.send("AT+S.STS=ip_ipaddr")
-        && _parser.recv("ip_ipaddr = %u.%u.%u.%u", &n1, &n2, &n3, &n4)
+        && _parser.recv("#  ip_ipaddr = %u.%u.%u.%u", &n1, &n2, &n3, &n4)
         && _parser.recv("OK"))) {
             printf("\r\ngetIPAddress error\n");
         return 0;
     }
-    printf("\r\nip address:%u.%u.%u.%u\n",n1, n2, n3, n4);
+    //printf("\r\nip address:%u.%u.%u.%u\n",n1, n2, n3, n4);
     sprintf((char*)_ip_buffer,"%u.%u.%u.%u", n1, n2, n3, n4);
 
     return _ip_buffer;
@@ -213,11 +213,17 @@
 
 const char *SPWFSA01::getMACAddress(void)
 {
-    if (!(_parser.send("AT+CIFSR")
-        && _parser.recv("+CIFSR:STAMAC,\"%[^\"]\"", _mac_buffer)
+    uint32_t n1, n2, n3, n4;
+    
+    if (!(_parser.send("AT+S.GCFG=nv_wifi_macaddr")
+        && _parser.recv("#  nv_wifi_macaddr = %u.%u.%u.%u", &n1, &n2, &n3, &n4)
         && _parser.recv("OK"))) {
+            printf("\r\ngetMACAddress error\n");
         return 0;
     }
+    
+    printf("\r\nip address:%u.%u.%u.%u\n",n1, n2, n3, n4);
+    sprintf((char*)_mac_buffer,"%u.%u.%u.%u", n1, n2, n3, n4);
 
     return _mac_buffer;
 }