Sigfox library with integration of ATParser

Revision:
6:799a482a7024
Parent:
5:66e05787ad5c
Child:
8:b10abac6a42e
--- a/Sigfox.cpp	Sat May 27 10:55:06 2017 +0000
+++ b/Sigfox.cpp	Mon May 29 19:42:14 2017 +0000
@@ -64,7 +64,7 @@
     char buff[8+2];
     _at->send("AT$I=10");
     _at->read(buff, 8+2);
-    memcpy(&ID[0],&buff[2],8);
+    memcpy(&ID[0],&buff[2],8-2);
     return &ID[0];
 }
 
@@ -72,6 +72,21 @@
     char buff[16+2];
     _at->send("AT$I=11");
     _at->read(buff, 16+2);
-    memcpy(&PAC[0],&buff[2],16);
+    memcpy(&PAC[0],&buff[2],16-2);
     return &PAC[0];
+}
+
+sigfoxvoltage_t Sigfox::getVoltages() {
+    sigfoxvoltage_t volt;
+    char buff[12];
+    _at->send("AT$V?");
+    _at->read(buff, 12);
+    char buff2[5];
+    memset(buff2,0,5);
+    memcpy(buff2, &buff[0], 4);
+    volt.current = ((double)atoi(buff2))/1000;
+    memset(buff2,0,5);
+    memcpy(buff2, &buff[6], 4);
+    volt.last = ((double)atoi(buff2))/1000;
+    return volt;
 }
\ No newline at end of file