David Dollar / MachineCloud

Dependencies:   XBee mbed-rtos

Files at this revision

API Documentation at this revision

Comitter:
ddollar
Date:
Thu Aug 15 23:54:25 2013 +0000
Parent:
0:260d7796eb25
Child:
2:3fb7c06efa1e
Commit message:
models

Changed in this revision

MachineCloud.cpp Show annotated file Show diff for this revision Revisions of this file
MachineCloud.h Show annotated file Show diff for this revision Revisions of this file
--- a/MachineCloud.cpp	Fri Aug 09 19:29:51 2013 +0000
+++ b/MachineCloud.cpp	Thu Aug 15 23:54:25 2013 +0000
@@ -1,20 +1,22 @@
 #include <string.h>
 #include "MachineCloud.h"
 
-MachineCloud::MachineCloud() {
-    init(0x1000);
+MachineCloud::MachineCloud(char *model) {
+    init(model, 0x1000);
 }
 
-MachineCloud::MachineCloud(uint16_t router) {
-    init(router);
+MachineCloud::MachineCloud(char *model, uint16_t router) {
+    init(model, router);
 }
 
-void MachineCloud::init(uint16_t router) {
+void MachineCloud::init(char *model, uint16_t router) {
+    m_model = model;
     m_router = router;
 }
 
 int MachineCloud::connect() {
     m_xbee = new XBee(p9, p10);
+    send("model", m_model);
     return 0;
 }
 
@@ -53,6 +55,8 @@
     Tx16Request tx = Tx16Request(m_router, payload, sizeof(payload));
     m_xbee->send(tx);
     
+    m_lock.unlock();
+    
     return 0;
 }
 
--- a/MachineCloud.h	Fri Aug 09 19:29:51 2013 +0000
+++ b/MachineCloud.h	Thu Aug 15 23:54:25 2013 +0000
@@ -35,8 +35,8 @@
     public:
 
         // constructor
-        MachineCloud();
-        MachineCloud(uint16_t router);
+        MachineCloud(char *model);
+        MachineCloud(char *model, uint16_t router);
         
         // connect to the machine cloud
         int connect();
@@ -54,10 +54,11 @@
                 
     private:
         
-        void init(uint16_t router);
+        void init(char *model, uint16_t router);
         void receive(char *key, char *value);
         
         Mutex m_lock;
+        char *m_model;
         MachineCloudCallback *m_receiverFunction;
         MachineCloudReceiver *m_receiverObject;
         uint16_t m_router;