Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
DeviceManager.h
00001 /** 00002 * @file DeviceManager.h 00003 * @brief mbed CoAP Endpoint Device Management class 00004 * @author Doug Anson 00005 * @version 1.0 00006 * @see 00007 * 00008 * Copyright (c) 2016 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_MANAGER_H__ 00024 #define __DEVICE_MANAGER_H__ 00025 00026 // mbed-client support 00027 #include "mbed-client/m2mconstants.h" 00028 00029 // Support for Device Resources 00030 #include "mbed-connector-interface/DeviceResource.h" 00031 00032 // Action Resource: Device DeRegistration 00033 #include "mbed-connector-interface/DeviceDeRegisterResource.h" 00034 00035 // Action Resource: Device Reboot 00036 #include "mbed-connector-interface/DeviceRebootResource.h" 00037 00038 // Action Resource: Device Reset 00039 #include "mbed-connector-interface/DeviceResetResource.h" 00040 00041 // Action Resource: Device Firmware 00042 #include "mbed-connector-interface/DeviceFirmwareCompositeResource.h" 00043 00044 // LWM2M Device Info: Mfg, DevType, Model, Serial, Firmware version, Hardware version, Software version 00045 #define NUM_DEVICE_RESOURCES 7 00046 00047 // LWM2M Device Object ID 00048 #define LWM2M_DEVICE_OBJ_ID "3" 00049 00050 // LWM2M Firmware Object ID 00051 #define LWM2M_FIRMWARE_OBJ_ID "5" 00052 00053 // TEMP: Device DeRegistration Resource ID 00054 #define LWM2M_DEV_DEREGISTER_ID "86" 00055 00056 /** DeviceManager is the endpoint management class 00057 */ 00058 class DeviceManager 00059 { 00060 public: 00061 /** 00062 Default constructor 00063 @param logger input logger instance 00064 @param dm_responder input data management responder/processor 00065 @param mfg input endpoint manufacturer 00066 @param dev_type input the endpoint type 00067 @param model input the model of the endpoint 00068 @param serial input the serial of the endpoint 00069 @param fw_vers input the current firmware version 00070 @param hw_vers input the current hardware version 00071 @param sw_vers input the current software version 00072 */ 00073 DeviceManager(const Logger *logger,const void *dm_responder=NULL,const char *mfg="ARM",const char *dev_type="mbed",const char *model="ARM" ,const char *serial="000000",const char *fw_ver="0.0.0",const char *hw_ver="0.0.0",const char *sw_ver="0.0.0"); 00074 00075 /** 00076 Copy constructor 00077 @param resource input the DeviceManager that is to be deep copied 00078 */ 00079 DeviceManager(const DeviceManager &manager); 00080 00081 /** 00082 Destructor 00083 */ 00084 virtual ~DeviceManager(); 00085 00086 /** 00087 install the device manager into the endpoint 00088 @param endpoint input the endpoint instance 00089 @param config input the endpoint configuration instance 00090 */ 00091 void install(const void *endpoint,const void *config); 00092 00093 /** 00094 get the DeviceManagementResponder 00095 @return the DeviceManagementResponder or NULL 00096 */ 00097 void *getResponder(); 00098 00099 private: 00100 Logger *m_logger; 00101 void *m_endpoint; 00102 void *m_config; 00103 char *m_dev_type; 00104 void *m_dm_responder; 00105 00106 // Static LWM2M Device Info Resources 00107 DeviceResource *m_dev[NUM_DEVICE_RESOURCES]; 00108 00109 // DM Action-able Resources 00110 DeviceDeRegisterResource *m_deregister_resource; 00111 DeviceRebootResource *m_reboot_resource; 00112 DeviceResetResource *m_reset_resource; 00113 DeviceFirmwareCompositeResource *m_firmware_composite_resource; 00114 00115 // convenience method to convert enum (int) type to string 00116 string createResName(M2MDevice::DeviceResource res); 00117 }; 00118 00119 #endif // __DEVICE_MANAGER_H__
Generated on Wed Jul 13 2022 21:59:32 by
1.7.2