mbed Connector Interface simplification API on top of mbed-client

Fork of mbedConnectorInterfaceV3 by Doug Anson

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!

Committer:
ansond
Date:
Tue Sep 26 16:01:31 2017 +0000
Revision:
127:b4a661ff6fb9
Parent:
27:b8aaf7dc7023
minor re-ordering of FCC init

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 13:9edad7677211 1 /**
ansond 13:9edad7677211 2 * @file DeviceDeRegisterResource.h
ansond 13:9edad7677211 3 * @brief mbed CoAP Endpoint Device DeRegister Resource
ansond 13:9edad7677211 4 * @author Doug Anson
ansond 13:9edad7677211 5 * @version 1.0
ansond 13:9edad7677211 6 * @see
ansond 13:9edad7677211 7 *
ansond 13:9edad7677211 8 * Copyright (c) 2014
ansond 13:9edad7677211 9 *
ansond 13:9edad7677211 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 13:9edad7677211 11 * you may not use this file except in compliance with the License.
ansond 13:9edad7677211 12 * You may obtain a copy of the License at
ansond 13:9edad7677211 13 *
ansond 13:9edad7677211 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 13:9edad7677211 15 *
ansond 13:9edad7677211 16 * Unless required by applicable law or agreed to in writing, software
ansond 13:9edad7677211 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 13:9edad7677211 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 13:9edad7677211 19 * See the License for the specific language governing permissions and
ansond 13:9edad7677211 20 * limitations under the License.
ansond 13:9edad7677211 21 */
ansond 13:9edad7677211 22
ansond 13:9edad7677211 23 #ifndef __DEVICE_DEREGISTER_RESOURCE_H__
ansond 13:9edad7677211 24 #define __DEVICE_DEREGISTER_RESOURCE_H__
ansond 13:9edad7677211 25
ansond 13:9edad7677211 26 // Base class
ansond 27:b8aaf7dc7023 27 #include "mbed-connector-interface/DynamicResource.h"
ansond 27:b8aaf7dc7023 28
ansond 27:b8aaf7dc7023 29 // Device Management Responder
ansond 27:b8aaf7dc7023 30 #include "mbed-connector-interface/DeviceManagementResponder.h"
ansond 13:9edad7677211 31
ansond 13:9edad7677211 32 /** DeviceDeRegisterResource class
ansond 13:9edad7677211 33 */
ansond 27:b8aaf7dc7023 34 class DeviceDeRegisterResource : public DynamicResource
ansond 13:9edad7677211 35 {
ansond 13:9edad7677211 36 public:
ansond 13:9edad7677211 37 /**
ansond 13:9edad7677211 38 Default constructor
ansond 13:9edad7677211 39 @param logger input logger instance for this resource
ansond 13:9edad7677211 40 @param obj_name input the Light Object name
ansond 13:9edad7677211 41 @param res_name input the Light Resource name
ansond 13:9edad7677211 42 @param dm_responder input the DM responder instance
ansond 13:9edad7677211 43 */
ansond 13:9edad7677211 44 DeviceDeRegisterResource(const Logger *logger,const char *obj_name,const char *res_name,const void *dm_responder,bool observable = false) :
ansond 27:b8aaf7dc7023 45 DynamicResource(logger,obj_name,res_name,"deregistration",M2MBase::POST_ALLOWED,observable)
ansond 13:9edad7677211 46 {
ansond 27:b8aaf7dc7023 47 this->m_dm_responder = (DeviceManagementResponder *)dm_responder;
ansond 27:b8aaf7dc7023 48 this->m_value = string("OK");
ansond 13:9edad7677211 49 }
ansond 13:9edad7677211 50
ansond 13:9edad7677211 51 /**
ansond 27:b8aaf7dc7023 52 POST handler
ansond 13:9edad7677211 53 @param value input input value (DM authentication challenge)
ansond 13:9edad7677211 54 */
ansond 27:b8aaf7dc7023 55 virtual void post(void *args) {
ansond 27:b8aaf7dc7023 56 // perform our action
ansond 13:9edad7677211 57 this->m_dm_responder->deregisterDevice(args);
ansond 13:9edad7677211 58 }
ansond 27:b8aaf7dc7023 59
ansond 27:b8aaf7dc7023 60 protected:
ansond 27:b8aaf7dc7023 61 DeviceManagementResponder *m_dm_responder;
ansond 13:9edad7677211 62 };
ansond 13:9edad7677211 63
ansond 13:9edad7677211 64 #endif // __DEVICE_DEREGISTER_RESOURCE_H__