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:
Thu Jun 09 19:05:18 2016 +0000
Revision:
14:d9ce4e56684e
Parent:
13:9edad7677211
Child:
30:db367366b1f5
updates for DM functions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 13:9edad7677211 1 /**
ansond 13:9edad7677211 2 * @file DeviceManagementResponder.h
ansond 13:9edad7677211 3 * @brief mbed CoAP Endpoint Device Management Responder class
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) 2016
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_MANAGEMENT_RESPONDER_H__
ansond 13:9edad7677211 24 #define __DEVICE_MANAGEMENT_RESPONDER_H__
ansond 13:9edad7677211 25
ansond 13:9edad7677211 26 // Logger
ansond 13:9edad7677211 27 #include "mbed-connector-interface/Logger.h"
ansond 13:9edad7677211 28
ansond 13:9edad7677211 29 // Authenticator Support
ansond 13:9edad7677211 30 #include "mbed-connector-interface/Authenticator.h"
ansond 13:9edad7677211 31
ansond 13:9edad7677211 32 // invocation handler signature
ansond 13:9edad7677211 33 typedef bool (*responder_fn)(const void *ep,const void *logger,const void *data);
ansond 13:9edad7677211 34
ansond 13:9edad7677211 35 class DeviceManagementResponder {
ansond 13:9edad7677211 36 public:
ansond 13:9edad7677211 37 /**
ansond 13:9edad7677211 38 Default constructor
ansond 13:9edad7677211 39 @param logger input logger instance
ansond 13:9edad7677211 40 @param authenticator input authentication instance
ansond 13:9edad7677211 41 */
ansond 13:9edad7677211 42 DeviceManagementResponder(const Logger *logger,const Authenticator *authenticator);
ansond 13:9edad7677211 43
ansond 13:9edad7677211 44 /**
ansond 13:9edad7677211 45 Copy constructor
ansond 13:9edad7677211 46 @param resource input the DeviceManagementResponder that is to be deep copied
ansond 13:9edad7677211 47 */
ansond 13:9edad7677211 48 DeviceManagementResponder(const DeviceManagementResponder &manager);
ansond 13:9edad7677211 49
ansond 13:9edad7677211 50 /**
ansond 13:9edad7677211 51 Destructor
ansond 13:9edad7677211 52 */
ansond 13:9edad7677211 53 virtual ~DeviceManagementResponder();
ansond 13:9edad7677211 54
ansond 13:9edad7677211 55 /**
ansond 13:9edad7677211 56 Set the Endpoint instance
ansond 13:9edad7677211 57 @param ep input the endpoint instance pointer
ansond 13:9edad7677211 58 */
ansond 13:9edad7677211 59 void setEndpoint(const void *ep);
ansond 13:9edad7677211 60
ansond 13:9edad7677211 61 /**
ansond 13:9edad7677211 62 Set our Reboot Responder handler function
ansond 13:9edad7677211 63 @param reboot_responder_fn input the device reboot responder function pointer
ansond 13:9edad7677211 64 */
ansond 13:9edad7677211 65 void setRebootResponderHandler(responder_fn reboot_responder_fn);
ansond 13:9edad7677211 66
ansond 13:9edad7677211 67 /**
ansond 13:9edad7677211 68 Set our Reset Responder handler function
ansond 13:9edad7677211 69 @param reset_responder_fn input the device reset responder function pointer
ansond 13:9edad7677211 70 */
ansond 13:9edad7677211 71 void setResetResponderHandler(responder_fn reset_responder_fn);
ansond 13:9edad7677211 72
ansond 13:9edad7677211 73 /**
ansond 13:9edad7677211 74 Set our FOTA invocation handler function
ansond 13:9edad7677211 75 @param fota_invocation_fn input the FOTA invocation handler function pointer
ansond 13:9edad7677211 76 */
ansond 13:9edad7677211 77 void setFOTAInvocationHandler(responder_fn fota_invocation_fn);
ansond 13:9edad7677211 78
ansond 13:9edad7677211 79 /**
ansond 13:9edad7677211 80 Set our FOTA manifest
ansond 13:9edad7677211 81 @param fota_manifest input the input FOTA manifest
ansond 13:9edad7677211 82 */
ansond 13:9edad7677211 83 virtual void setFOTAManifest(const char *fota_manifest);
ansond 13:9edad7677211 84
ansond 13:9edad7677211 85 /**
ansond 14:d9ce4e56684e 86 Get our FOTA manifest
ansond 14:d9ce4e56684e 87 @return the FOTA manifest
ansond 14:d9ce4e56684e 88 */
ansond 14:d9ce4e56684e 89 virtual char *getFOTAManifest();
ansond 14:d9ce4e56684e 90
ansond 14:d9ce4e56684e 91 /**
ansond 13:9edad7677211 92 ACTION: Deregister device
ansond 13:9edad7677211 93 @param challenge input the input authentication challenge
ansond 13:9edad7677211 94 */
ansond 13:9edad7677211 95 virtual void deregisterDevice(const void *challenge);
ansond 13:9edad7677211 96
ansond 13:9edad7677211 97 /**
ansond 13:9edad7677211 98 ACTION: Reboot device
ansond 13:9edad7677211 99 @param challenge input the input authentication challenge
ansond 13:9edad7677211 100 */
ansond 13:9edad7677211 101 virtual void rebootDevice(const void *challenge);
ansond 13:9edad7677211 102
ansond 13:9edad7677211 103 /**
ansond 13:9edad7677211 104 ACTION: Reset device
ansond 13:9edad7677211 105 @param challenge input the input authentication challenge
ansond 13:9edad7677211 106 */
ansond 13:9edad7677211 107 virtual void resetDevice(const void *challenge);
ansond 13:9edad7677211 108
ansond 13:9edad7677211 109 /**
ansond 13:9edad7677211 110 ACTION: Invoke FOTA (default: empty action)
ansond 13:9edad7677211 111 @param challenge input the input authentication challenge
ansond 13:9edad7677211 112 */
ansond 13:9edad7677211 113 virtual void invokeFOTA(const void *challenge);
ansond 13:9edad7677211 114
ansond 13:9edad7677211 115 /**
ansond 14:d9ce4e56684e 116 Set the FirmwareComposite Resource
ansond 14:d9ce4e56684e 117 @param firmware_composite_resource input the Firmware composite resource instance
ansond 13:9edad7677211 118 */
ansond 14:d9ce4e56684e 119 void setFirmwareCompositeResource(const void *firmware_composite_resource);
ansond 13:9edad7677211 120
ansond 13:9edad7677211 121 /**
ansond 14:d9ce4e56684e 122 Get the FirmwareComposite Resource
ansond 14:d9ce4e56684e 123 @return the Firmware composite resource or NULL
ansond 13:9edad7677211 124 */
ansond 14:d9ce4e56684e 125 void *getFirmwareCompositeResource();
ansond 13:9edad7677211 126
ansond 13:9edad7677211 127 private:
ansond 13:9edad7677211 128 Logger *m_logger;
ansond 13:9edad7677211 129 Authenticator *m_authenticator;
ansond 13:9edad7677211 130 void *m_endpoint;
ansond 13:9edad7677211 131 char *m_fota_manifest;
ansond 13:9edad7677211 132
ansond 13:9edad7677211 133 responder_fn m_reboot_responder_fn;
ansond 13:9edad7677211 134 responder_fn m_reset_responder_fn;
ansond 13:9edad7677211 135 responder_fn m_fota_invocation_fn;
ansond 13:9edad7677211 136
ansond 13:9edad7677211 137 bool authenticate(const void *challenge);
ansond 13:9edad7677211 138
ansond 14:d9ce4e56684e 139 void *m_firmware_composite_resource;
ansond 13:9edad7677211 140 };
ansond 13:9edad7677211 141
ansond 13:9edad7677211 142 #endif // __DEVICE_MANAGEMENT_RESPONDER_H__