custom for >5 resources
Fork of mbedConnectorInterface by
Diff: api/StaticResource.cpp
- Revision:
- 2:853f9ecc12df
- Parent:
- 0:b438482ebbfc
- Child:
- 5:a929d65eb385
--- a/api/StaticResource.cpp Tue Jan 27 22:52:25 2015 +0000 +++ b/api/StaticResource.cpp Tue Jan 27 23:41:34 2015 +0000 @@ -3,7 +3,7 @@ * @brief mbed CoAP Endpoint Static Resource class * @author Doug Anson/Chris Paola * @version 1.0 - * @see + * @see * * Copyright (c) 2014 * @@ -19,34 +19,40 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - #include "StaticResource.h" - - // NSDL libraries - #include "nsdl_support.h" - - // Constructor - StaticResource::StaticResource(const Logger *logger,const char *name, const char *value) : Resource<string>(logger,string(name),string(value)) { - } - - // Constructor - StaticResource::StaticResource(const Logger *logger,const char *name,const string value) : Resource<string>(logger,string(name),string(value)) { - } - - // Constructor with buffer lengths - StaticResource::StaticResource(const Logger *logger,const string name,const string value) : Resource<string>(logger,string(name),string(value)) { - } - - // Copy constructor - StaticResource::StaticResource(const StaticResource &resource) : Resource<string>((const Resource<string> &)resource) { - } - - // Destructor - StaticResource::~StaticResource() { - } - - // Bind resource to Endpoint - void StaticResource::bind(void *p) { + +#include "StaticResource.h" + +// NSDL libraries +#include "nsdl_support.h" + +// Constructor +StaticResource::StaticResource(const Logger *logger,const char *name, const char *value) : Resource<string>(logger,string(name),string(value)) +{ +} + +// Constructor +StaticResource::StaticResource(const Logger *logger,const char *name,const string value) : Resource<string>(logger,string(name),string(value)) +{ +} + +// Constructor with buffer lengths +StaticResource::StaticResource(const Logger *logger,const string name,const string value) : Resource<string>(logger,string(name),string(value)) +{ +} + +// Copy constructor +StaticResource::StaticResource(const StaticResource &resource) : Resource<string>((const Resource<string> &)resource) +{ +} + +// Destructor +StaticResource::~StaticResource() +{ +} + +// Bind resource to Endpoint +void StaticResource::bind(void *p) +{ if (p != NULL) { sn_nsdl_resource_info_s *resource_ptr = (sn_nsdl_resource_info_s *)p; std::printf("StaticResource: name[%s] value:[%s]\r\n",this->getName().c_str(),this->getValue().c_str()); @@ -56,8 +62,7 @@ int value_length = this->getValue().size(); nsdl_create_static_resource(resource_ptr,name_length,(uint8_t *)name,0,0,(uint8_t *)value,value_length); std::printf("StaticResource[%s(%d)] value: %s(%d) bound\r\n",name,name_length,value,value_length); - } - else { + } else { std::printf("StaticResource: NULL parameter in bind()\r\n"); } - } \ No newline at end of file +}