mbed Connector Interface simplification API on top of mbed-client
Fork of mbedConnectorInterfaceV3 by
NOTE:
This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!
Diff: mbed-connector-interface/DeviceDeRegisterResource.h
- Revision:
- 27:b8aaf7dc7023
- Parent:
- 13:9edad7677211
--- a/mbed-connector-interface/DeviceDeRegisterResource.h Sun Jun 12 03:18:25 2016 +0000 +++ b/mbed-connector-interface/DeviceDeRegisterResource.h Tue Jun 14 04:01:34 2016 +0000 @@ -24,11 +24,14 @@ #define __DEVICE_DEREGISTER_RESOURCE_H__ // Base class -#include "mbed-connector-interface/DeviceActionResource.h" +#include "mbed-connector-interface/DynamicResource.h" + +// Device Management Responder +#include "mbed-connector-interface/DeviceManagementResponder.h" /** DeviceDeRegisterResource class */ -class DeviceDeRegisterResource : public DeviceActionResource +class DeviceDeRegisterResource : public DynamicResource { public: /** @@ -39,19 +42,23 @@ @param dm_responder input the DM responder instance */ DeviceDeRegisterResource(const Logger *logger,const char *obj_name,const char *res_name,const void *dm_responder,bool observable = false) : - DeviceActionResource(logger,obj_name,res_name,"deregister",dm_responder,observable) + DynamicResource(logger,obj_name,res_name,"deregistration",M2MBase::POST_ALLOWED,observable) { + this->m_dm_responder = (DeviceManagementResponder *)dm_responder; + this->m_value = string("OK"); } /** - do_action() + POST handler @param value input input value (DM authentication challenge) */ - virtual bool do_action(void *args) { - // reboot the device. Input value should the DM authentication challenge) + virtual void post(void *args) { + // perform our action this->m_dm_responder->deregisterDevice(args); - return true; } + +protected: + DeviceManagementResponder *m_dm_responder; }; #endif // __DEVICE_DEREGISTER_RESOURCE_H__ \ No newline at end of file