mbedConnectorInterface back port from mbedOS v3 using mbed-client C++ call interface
Embed:
(wiki syntax)
Show/hide line numbers
DeviceFirmwareCompositeResource.h
Go to the documentation of this file.
00001 /** 00002 * @file DeviceFirmwareCompositeResource.h 00003 * @brief mbed CoAP Endpoint Device Firmware Composited Resource 00004 * @author Doug Anson 00005 * @version 1.0 00006 * @see 00007 * 00008 * Copyright (c) 2014 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); 00011 * you may not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, 00018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 */ 00022 00023 #ifndef __DEVICE_FIRMWARE_COMPOSITE_RESOURCE_H__ 00024 #define __DEVICE_FIRMWARE_COMPOSITE_RESOURCE_H__ 00025 00026 // Dynamic Resource Support 00027 #include "mbed-connector-interface/DynamicResource.h" 00028 00029 // LWM2M Device Firmware Package Resource ID 00030 #define LWM2M_DEV_FIRMWARE_PACKAGE_ID "0" 00031 00032 // LWM2M Device Firmware Package Resource ID 00033 #define LWM2M_DEV_FIRMWARE_PACKAGE_URI_ID "1" 00034 00035 // LWM2M Device Firmware Update Resource ID 00036 #define LWM2M_DEV_FIRMWARE_UPDATE_ID "2" 00037 00038 // LWM2M Device Firmware State Resource ID 00039 #define LWM2M_DEV_FIRMWARE_STATE_ID "3" 00040 00041 // LWM2M Device Firmware Result Resource ID 00042 #define LWM2M_DEV_FIRMWARE_RESULT_ID "5" 00043 00044 // LWM2M Device Firmware Package Name Resource ID 00045 #define LWM2M_DEV_FIRMWARE_PKG_NAME_ID "6" 00046 00047 // LWM2M Device Firmware Package Version Resource ID 00048 #define LWM2M_DEV_FIRMWARE_PKG_VERSION_ID "7" 00049 00050 // LWM2M: Firmware Resource IDs 00051 typedef enum { 00052 LWM2M_PAYLOAD_ID = 0, // /5/0/0 - Direct Firmware Payload 00053 LWM2M_MANIFEST_ID = 1, // /5/0/1 - Firmware Payload URL 00054 LWM2M_UPDATE_ID = 2, // /5/0/2 - FOTA Update 00055 LWM2M_STATE_ID = 3, // /5/0/3 - State 00056 LWM2M_RESULT_ID = 5, // /5/0/4 - Result 00057 LWM2M_PKGNAME_ID = 6, // /5/0/6 - PkgName 00058 LWM2M_PKGVERSION_ID = 7, // /5/0/7 - PkgVersion 00059 NUM_FIRMWARE_RESOURCE_IDS = 8 // max number of Firmware resources 00060 } FirmwareResourceIDs; 00061 00062 /** DeviceFirmwareCompositeResource class 00063 */ 00064 class DeviceFirmwareCompositeResource 00065 { 00066 public: 00067 /** 00068 Default constructor 00069 @param logger input logger instance for this resource 00070 @param obj_name input the Light Object name 00071 @param dm_responder input the DM responder instance 00072 */ 00073 DeviceFirmwareCompositeResource(const Logger *logger,const char *obj_name,const void *dm_responder); 00074 00075 /** 00076 Copy Constructor 00077 @param res input DeviceFirmwareCompositeResource instance to shallow copy 00078 */ 00079 DeviceFirmwareCompositeResource(const DeviceFirmwareCompositeResource &res); 00080 00081 // Destructor 00082 virtual ~DeviceFirmwareCompositeResource(); 00083 00084 // Build Internal Resources 00085 void buildResources(); 00086 00087 /** 00088 Add Resources 00089 @param cfg input pointer to Connector::OptionsBuilder configuration instance for our endpoint 00090 */ 00091 void addResources(void *cfg); 00092 00093 /** 00094 Get Resource 00095 @param index input the resource ID of the firmware resource to retrieve 00096 */ 00097 void *getResource(FirmwareResourceIDs id); 00098 00099 private: 00100 Logger *m_logger; 00101 void *m_dm_responder; 00102 char *m_obj_name; 00103 DynamicResource *m_firmware_resource[NUM_FIRMWARE_RESOURCE_IDS]; 00104 00105 }; 00106 00107 #endif // __DEVICE_FIRMWARE_COMPOSITE_RESOURCE_H__
Generated on Wed Jul 13 2022 21:59:32 by
1.7.2