endpoint including temperature and distance sensors

Dependencies:   mbed mbedConnectorInterface mbedEndpointNetwork TrashSensors

Fork of TempAndDistTest by Tim Ambrose

Revision:
10:338191178cbf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/resource/MaxDistanceResource.h	Mon May 18 00:44:59 2015 +0000
@@ -0,0 +1,23 @@
+#ifndef MAX_DISTANCE_RESOURCE_H
+#define MAX_DISTANCE_RESOURCE_H
+
+#include "DynamicResource.h"
+#include "hcsr04.h"
+
+class MaxDistanceResource : public DynamicResource {
+public:
+    MaxDistanceResource(const Logger *logger, const char *name, HCSR04 *sensor, const bool observable = false)
+     : DynamicResource(logger, name, "MaxDistanceResource", SN_GRS_GET_ALLOWED, observable), sensor(sensor)
+    {}
+    
+    virtual string get()
+    {
+        char buf[10];
+        snprintf(buf, 10, "%0.2f", sensor->get_max_dist_cm());
+        return string(buf);
+    }
+private:
+    HCSR04 *sensor;
+};
+
+#endif
\ No newline at end of file