UvA NetCentric Computing listener

Dependencies:   AndroidAccessory Controls HBridge MotorController mbed

Fork of uva_nc by Jurgen Baas

Files at this revision

API Documentation at this revision

Comitter:
Sinterbaas
Date:
Sun Jan 10 23:46:34 2016 +0000
Parent:
5:fdb97d818cff
Child:
7:d9d30a2d8d9f
Commit message:
latest version;

Changed in this revision

Controls.lib Show annotated file Show diff for this revision Revisions of this file
MotorController.lib Show annotated file Show diff for this revision Revisions of this file
NetCentricApp.cpp Show annotated file Show diff for this revision Revisions of this file
NetCentricApp.h Show annotated file Show diff for this revision Revisions of this file
--- a/Controls.lib	Fri Jan 08 15:34:22 2016 +0000
+++ b/Controls.lib	Sun Jan 10 23:46:34 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/Sinterbaas/code/Controls/#178418dc887f
+https://developer.mbed.org/users/Sinterbaas/code/Controls/#7af8eda5d3b0
--- a/MotorController.lib	Fri Jan 08 15:34:22 2016 +0000
+++ b/MotorController.lib	Sun Jan 10 23:46:34 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/Netcentric-Computing/code/MotorController/#ed42d9035468
+https://developer.mbed.org/teams/Netcentric-Computing/code/MotorController/#70607c6dad36
--- 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");
--- a/NetCentricApp.h	Fri Jan 08 15:34:22 2016 +0000
+++ b/NetCentricApp.h	Sun Jan 10 23:46:34 2016 +0000
@@ -16,6 +16,7 @@
 #define COMMAND_AVG                 2
 #define COMMAND_LED                 3
 #define COMMAND_MOTOR               4
+#define COMMAND_STATUS              5
 
 class NetCentricApp : private AndroidAccessory {
     public:
@@ -47,6 +48,7 @@
         MbedResponse *avgCommand(MbedRequest *request);
         MbedResponse *ledCommand(MbedRequest *request);
         MbedResponse *motorCommand(MbedRequest *request);
+        MbedResponse *statusCommand(MbedRequest *request);
         
         MotorControlsPc &motorControlsPc;
 };