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 Activity by
Diff: Activity.cpp
- Revision:
- 0:f8b83c4ca41c
- Child:
- 1:c30afef67c43
diff -r 000000000000 -r f8b83c4ca41c Activity.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Activity.cpp	Wed Mar 07 12:44:56 2018 +0000
@@ -0,0 +1,40 @@
+#include "Activity.h"
+#include <iostream>
+using namespace std;
+
+Activity::Activity () {
+    trasmitido=false;
+}
+
+void Activity::set_values (float a,float b,uint16_t c,float d,float e,float f,float g) {
+    startAct = a;
+    tAct = b;
+    pasos = c;
+    cad = d;
+    medS = e;
+    medNS = f;
+    sim = g;
+}
+
+void Activity::trasmision (){
+    trasmitido = true;
+}
+
+bool Activity::get_trasmitido(){
+    return trasmitido;
+}
+
+void Activity::serial(char* ch){    
+
+    const unsigned char header[]={0xFF,0xFF,0xFF,0xFF};
+    
+    memcpy(ch, &header, sizeof(header));
+    memcpy(&ch[sizeof(header)], &startAct, sizeof(startAct));
+    memcpy(&ch[sizeof(header)+sizeof(startAct)], &tAct, sizeof(tAct));
+    memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)], &pasos, sizeof(pasos));
+    memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)+sizeof(pasos)], &cad, sizeof(cad));
+    memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)+sizeof(pasos)+sizeof(cad)], &medS, sizeof(medS));
+    memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)+sizeof(pasos)+sizeof(cad)+sizeof(medS)], &medNS, sizeof(medNS));
+    memcpy(&ch[sizeof(header)+sizeof(tAct)+sizeof(startAct)+sizeof(pasos)+sizeof(cad)+sizeof(medS)+sizeof(medNS)], &sim, sizeof(sim));  
+    trasmitido=false;
+}
\ No newline at end of file
    