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.
DeviceResource.h
00001 /** 00002 * @file DeviceResource.h 00003 * @brief mbed CoAP Endpoint Device Resource class 00004 * @author Doug Anson/Chris Paola 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_RESOURCE_H__ 00024 #define __DEVICE_RESOURCE_H__ 00025 00026 // Base Class 00027 #include "mbed-connector-interface/Resource.h" 00028 00029 // String class support 00030 #include <string> 00031 00032 // DataWrapper support 00033 #include "mbed-connector-interface/DataWrapper.h" 00034 00035 /** DeviceResource is a static (GET only) resource with a value type pinned as a string type 00036 */ 00037 class DeviceResource : public Resource<string> 00038 { 00039 public: 00040 /** 00041 Default constructor 00042 @param logger input logger instance for this resource 00043 @param name input the Resource URI/Name 00044 @param value input the Resource value (a string) 00045 */ 00046 DeviceResource(const Logger *logger,M2MDevice::DeviceResource name,const char *value); 00047 00048 /** 00049 string value constructor 00050 @param logger input logger instance for this resource 00051 @param name input the Resource URI/Name 00052 @param value input the Resource value (a string) 00053 */ 00054 DeviceResource(const Logger *logger,M2MDevice::DeviceResource name,const string value); 00055 00056 /** 00057 Copy constructor 00058 @param resource input the DeviceResource that is to be deep copied 00059 */ 00060 DeviceResource(const DeviceResource &resource); 00061 00062 /** 00063 Destructor 00064 */ 00065 virtual ~DeviceResource(); 00066 00067 /** 00068 Bind resource to endpoint 00069 @param p input pointer to the endpoint resources necessary for binding 00070 */ 00071 virtual M2MObject *bind(void *p); 00072 00073 /** 00074 Set the data wrapper 00075 @param data_wrapper input the data wrapper instance 00076 */ 00077 void setDataWrapper(DataWrapper *data_wrapper) { this->m_data_wrapper = data_wrapper; } 00078 00079 protected: 00080 DataWrapper *getDataWrapper() { return this->m_data_wrapper; } 00081 string resource_name(M2MDevice::DeviceResource name) const; 00082 00083 private: 00084 DataWrapper *m_data_wrapper; 00085 M2MObject *m_object; 00086 M2MDevice::DeviceResource m_dev_name; 00087 }; 00088 00089 #endif // __DEVICE_RESOURCE_H__
Generated on Wed Jul 13 2022 21:59:32 by
1.7.2