UvA NetCentric Computing listener

Dependencies:   AndroidAccessory Controls HBridge MotorController mbed

Fork of uva_nc by Jurgen Baas

Revision:
6:b5072fb695f2
Parent:
4:eabd917e3353
Child:
7:d9d30a2d8d9f
--- a/NetCentricApp.cpp	Fri Jan 08 15:34:22 2016 +0000
+++ b/NetCentricApp.cpp	Sun Jan 10 23:46:34 2016 +0000
@@ -42,6 +42,8 @@
         return ledCommand(request);
     } else if (request->commandId == COMMAND_MOTOR) {
         return motorCommand(request);
+    } else if (request->commandId == COMMAND_STATUS) {
+        return statusCommand(request);
     }
     
     MbedResponse *commandNotFound = new MbedResponse();
@@ -143,6 +145,19 @@
     return r;
 }
 
+MbedResponse *NetCentricApp::statusCommand(MbedRequest *request) {
+    MbedResponse *r = new MbedResponse();
+    r->requestId = request->id;
+    r->commandId = request->commandId;
+    r->error = NO_ERROR;
+    r->n = 1;
+    
+    r->values = new float[r->n];
+    r->values[0] = (float) this->motorControlsPc.getMotorController().getCurrentStatus();
+    
+    return r;
+}
+
 // Setup once a device is connected.
 void NetCentricApp::setupDevice() {
     printf("Connected to Android!\r\n");