use TCP to connect to mbed connector
Fork of mbedConnectorInterfaceWithDM by
mbed-connector-interface/DeviceManagementResponder.h
- Committer:
- ansond
- Date:
- 2016-06-14
- Revision:
- 30:db367366b1f5
- Parent:
- 14:d9ce4e56684e
- Child:
- 48:c02f2665cf76
File content as of revision 30:db367366b1f5:
/** * @file DeviceManagementResponder.h * @brief mbed CoAP Endpoint Device Management Responder class * @author Doug Anson * @version 1.0 * @see * * Copyright (c) 2016 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __DEVICE_MANAGEMENT_RESPONDER_H__ #define __DEVICE_MANAGEMENT_RESPONDER_H__ // Logger #include "mbed-connector-interface/Logger.h" // Authenticator Support #include "mbed-connector-interface/Authenticator.h" // invocation handler signature typedef bool (*responder_fn)(const void *ep,const void *logger,const void *data); class DeviceManagementResponder { public: /** Default constructor @param logger input logger instance @param authenticator input authentication instance */ DeviceManagementResponder(const Logger *logger,const Authenticator *authenticator); /** Copy constructor @param resource input the DeviceManagementResponder that is to be deep copied */ DeviceManagementResponder(const DeviceManagementResponder &manager); /** Destructor */ virtual ~DeviceManagementResponder(); /** Set the Endpoint instance @param ep input the endpoint instance pointer */ void setEndpoint(const void *ep); /** Set our Reboot Responder handler function @param reboot_responder_fn input the device reboot responder function pointer */ void setRebootResponderHandler(responder_fn reboot_responder_fn); /** Set our Reset Responder handler function @param reset_responder_fn input the device reset responder function pointer */ void setResetResponderHandler(responder_fn reset_responder_fn); /** Set our FOTA invocation handler function @param fota_invocation_fn input the FOTA invocation handler function pointer */ void setFOTAInvocationHandler(responder_fn fota_invocation_fn); /** ACTION: Deregister device @param challenge input the input authentication challenge */ virtual void deregisterDevice(const void *challenge); /** ACTION: Reboot device @param challenge input the input authentication challenge */ virtual void rebootDevice(const void *challenge); /** ACTION: Reset device @param challenge input the input authentication challenge */ virtual void resetDevice(const void *challenge); /** Set our FOTA manifest @param manifest input the FOTA manifest */ virtual void setFOTAManifest(char *manifest); /** Get our FOTA manifest @return the FOTA manifest */ virtual char *getFOTAManifest(); /** Set our FOTA image @param fota_image input the FOTA image @param fota_image_length input the length of the fota image */ virtual void setFOTAImage(void *fota_image,uint32_t fota_image_length ); /** Get our FOTA image @return the FOTA image */ virtual void *getFOTAImage(); /** Get our FOTA image length @return the FOTA image length */ virtual uint32_t getFOTAImageLength(); /** ACTION: Invoke FOTA (default: empty action) @param challenge input the input authentication challenge */ virtual void invokeFOTA(const void *challenge); private: Logger *m_logger; Authenticator *m_authenticator; void *m_endpoint; char *m_manifest; void *m_fota_image; uint32_t m_fota_image_length; responder_fn m_reboot_responder_fn; responder_fn m_reset_responder_fn; responder_fn m_fota_invocation_fn; bool authenticate(const void *challenge); }; #endif // __DEVICE_MANAGEMENT_RESPONDER_H__