Doug Anson / mbedConnectorInterfaceV3
Committer:
ansond
Date:
Thu Jun 09 19:05:18 2016 +0000
Revision:
14:d9ce4e56684e
Parent:
13:9edad7677211
updates for DM functions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 13:9edad7677211 1 /**
ansond 13:9edad7677211 2 * @file DeviceFirmwareCompositeResource.h
ansond 13:9edad7677211 3 * @brief mbed CoAP Endpoint Device Firmware Composited 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_FIRMWARE_COMPOSITE_RESOURCE_H__
ansond 13:9edad7677211 24 #define __DEVICE_FIRMWARE_COMPOSITE_RESOURCE_H__
ansond 13:9edad7677211 25
ansond 13:9edad7677211 26 // Dynamic Resource Support
ansond 13:9edad7677211 27 #include "mbed-connector-interface/DynamicResource.h"
ansond 13:9edad7677211 28
ansond 13:9edad7677211 29 // LWM2M Device Firmware Package Resource ID
ansond 13:9edad7677211 30 #define LWM2M_DEV_FIRMWARE_PACKAGE_ID "0"
ansond 13:9edad7677211 31
ansond 13:9edad7677211 32 // LWM2M Device Firmware Package Resource ID
ansond 13:9edad7677211 33 #define LWM2M_DEV_FIRMWARE_PACKAGE_URI_ID "1"
ansond 13:9edad7677211 34
ansond 13:9edad7677211 35 // LWM2M Device Firmware Update Resource ID
ansond 13:9edad7677211 36 #define LWM2M_DEV_FIRMWARE_UPDATE_ID "2"
ansond 13:9edad7677211 37
ansond 13:9edad7677211 38 // LWM2M Device Firmware State Resource ID
ansond 13:9edad7677211 39 #define LWM2M_DEV_FIRMWARE_STATE_ID "3"
ansond 13:9edad7677211 40
ansond 13:9edad7677211 41 // LWM2M Device Firmware Result Resource ID
ansond 13:9edad7677211 42 #define LWM2M_DEV_FIRMWARE_RESULT_ID "5"
ansond 13:9edad7677211 43
ansond 13:9edad7677211 44 // LWM2M Device Firmware Package Name Resource ID
ansond 13:9edad7677211 45 #define LWM2M_DEV_FIRMWARE_PKG_NAME_ID "6"
ansond 13:9edad7677211 46
ansond 13:9edad7677211 47 // LWM2M Device Firmware Package Version Resource ID
ansond 13:9edad7677211 48 #define LWM2M_DEV_FIRMWARE_PKG_VERSION_ID "7"
ansond 13:9edad7677211 49
ansond 14:d9ce4e56684e 50 // LWM2M: Firmware Resource IDs
ansond 14:d9ce4e56684e 51 typedef enum {
ansond 14:d9ce4e56684e 52 LWM2M_PAYLOAD_ID = 0, // /5/0/0 - Direct Firmware Payload
ansond 14:d9ce4e56684e 53 LWM2M_MANIFEST_ID = 1, // /5/0/1 - Firmware Payload URL
ansond 14:d9ce4e56684e 54 LWM2M_UPDATE_ID = 2, // /5/0/2 - FOTA Update
ansond 14:d9ce4e56684e 55 LWM2M_STATE_ID = 3, // /5/0/3 - State
ansond 14:d9ce4e56684e 56 LWM2M_RESULT_ID = 5, // /5/0/4 - Result
ansond 14:d9ce4e56684e 57 LWM2M_PKGNAME_ID = 6, // /5/0/6 - PkgName
ansond 14:d9ce4e56684e 58 LWM2M_PKGVERSION_ID = 7, // /5/0/7 - PkgVersion
ansond 14:d9ce4e56684e 59 NUM_FIRMWARE_RESOURCE_IDS = 8 // max number of Firmware resources
ansond 14:d9ce4e56684e 60 } FirmwareResourceIDs;
ansond 14:d9ce4e56684e 61
ansond 13:9edad7677211 62 /** DeviceFirmwareCompositeResource class
ansond 13:9edad7677211 63 */
ansond 13:9edad7677211 64 class DeviceFirmwareCompositeResource
ansond 13:9edad7677211 65 {
ansond 13:9edad7677211 66 public:
ansond 13:9edad7677211 67 /**
ansond 13:9edad7677211 68 Default constructor
ansond 13:9edad7677211 69 @param logger input logger instance for this resource
ansond 13:9edad7677211 70 @param obj_name input the Light Object name
ansond 13:9edad7677211 71 @param dm_responder input the DM responder instance
ansond 13:9edad7677211 72 */
ansond 13:9edad7677211 73 DeviceFirmwareCompositeResource(const Logger *logger,const char *obj_name,const void *dm_responder);
ansond 13:9edad7677211 74
ansond 13:9edad7677211 75 /**
ansond 13:9edad7677211 76 Copy Constructor
ansond 13:9edad7677211 77 @param res input DeviceFirmwareCompositeResource instance to shallow copy
ansond 13:9edad7677211 78 */
ansond 13:9edad7677211 79 DeviceFirmwareCompositeResource(const DeviceFirmwareCompositeResource &res);
ansond 13:9edad7677211 80
ansond 13:9edad7677211 81 // Destructor
ansond 13:9edad7677211 82 virtual ~DeviceFirmwareCompositeResource();
ansond 13:9edad7677211 83
ansond 13:9edad7677211 84 // Build Internal Resources
ansond 13:9edad7677211 85 void buildResources();
ansond 13:9edad7677211 86
ansond 13:9edad7677211 87 /**
ansond 13:9edad7677211 88 Add Resources
ansond 13:9edad7677211 89 @param cfg input pointer to Connector::OptionsBuilder configuration instance for our endpoint
ansond 13:9edad7677211 90 */
ansond 13:9edad7677211 91 void addResources(void *cfg);
ansond 13:9edad7677211 92
ansond 14:d9ce4e56684e 93 /**
ansond 14:d9ce4e56684e 94 Get Resource
ansond 14:d9ce4e56684e 95 @param index input the resource ID of the firmware resource to retrieve
ansond 14:d9ce4e56684e 96 */
ansond 14:d9ce4e56684e 97 void *getResource(FirmwareResourceIDs id);
ansond 14:d9ce4e56684e 98
ansond 13:9edad7677211 99 private:
ansond 13:9edad7677211 100 Logger *m_logger;
ansond 13:9edad7677211 101 void *m_dm_responder;
ansond 13:9edad7677211 102 char *m_obj_name;
ansond 14:d9ce4e56684e 103 DynamicResource *m_firmware_resource[NUM_FIRMWARE_RESOURCE_IDS];
ansond 13:9edad7677211 104
ansond 13:9edad7677211 105 };
ansond 13:9edad7677211 106
ansond 13:9edad7677211 107 #endif // __DEVICE_FIRMWARE_COMPOSITE_RESOURCE_H__