asdf

Dependencies:   Servo mbed mbedConnectorInterface mbedEndpointNetwork

Fork of TempAndDistTest by Tim Ambrose

Files at this revision

API Documentation at this revision

Comitter:
mnorris
Date:
Sat May 09 19:00:40 2015 +0000
Parent:
3:c17adf68862b
Commit message:
Bug fixes, uses PUT

Changed in this revision

nsp_configuration.h Show annotated file Show diff for this revision Revisions of this file
resource/ServoResource.cpp Show annotated file Show diff for this revision Revisions of this file
resource/ServoResource.h Show annotated file Show diff for this revision Revisions of this file
--- a/nsp_configuration.h	Sat May 09 18:40:08 2015 +0000
+++ b/nsp_configuration.h	Sat May 09 19:00:40 2015 +0000
@@ -25,7 +25,7 @@
  
  // NSP node name
  #define NODE_NAME_LENGTH         24
- #define NODE_NAME                "trashcan"
+ #define NODE_NAME                "servotest"
  
  // NSP Address (4 bytes for IPV4, 16 bytes for IPV6)
  #define NSP_IP_ADDRESS_LENGTH    4
@@ -37,6 +37,6 @@
  
  // NSP Domain used
  #define NSP_DOMAIN_LENGTH        24
- #define NSP_DOMAIN               "trash"
+ #define NSP_DOMAIN               "servo"
 
  #endif // __NSP_CONFIGURATION_H__
\ No newline at end of file
--- a/resource/ServoResource.cpp	Sat May 09 18:40:08 2015 +0000
+++ b/resource/ServoResource.cpp	Sat May 09 19:00:40 2015 +0000
@@ -20,4 +20,13 @@
 
 string ServoResource::get() {
     return "";
-}
\ No newline at end of file
+}
+
+void ServoResource::put(const string input) {
+    if (input == "on") {
+        on();
+    }
+    else {
+        off();
+    }
+}
--- a/resource/ServoResource.h	Sat May 09 18:40:08 2015 +0000
+++ b/resource/ServoResource.h	Sat May 09 19:00:40 2015 +0000
@@ -7,12 +7,13 @@
 class ServoResource : public DynamicResource {
 public:
     ServoResource(const Logger *logger, const char *name, Servo *servo, const bool observable = false)
-     : DynamicResource(logger, name, "ServoResource", SN_GRS_GET_ALLOWED, observable), servo(servo)
+     : DynamicResource(logger, name, "ServoResource", SN_GRS_PUT_ALLOWED, observable), servo(servo)
     {}
     
     void on();
     void off();
     
+    virtual void put(const string);
     virtual string get();
     
 private: