mbedConnectorInterface back port from mbedOS v3 using mbed-client C++ call interface
Embed:
(wiki syntax)
Show/hide line numbers
StaticResource.h
Go to the documentation of this file.
00001 /** 00002 * @file StaticResource.h 00003 * @brief mbed CoAP Endpoint Static 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 __STATIC_RESOURCE_H__ 00024 #define __STATIC_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 /** StaticResource is a static (GET only) resource with a value type pinned as a string type 00036 */ 00037 class StaticResource : public Resource<string> 00038 { 00039 public: 00040 /** 00041 Default constructor 00042 @param logger input logger instance for this resource 00043 @param obj_name input the Object 00044 @param res_name input the Resource URI/Name 00045 @param value input the Resource value (a string) 00046 */ 00047 StaticResource(const Logger *logger,const char *obj_name,const char *res_name,const char *value); 00048 00049 /** 00050 string value constructor 00051 @param logger input logger instance for this resource 00052 @param obj_name input the Object 00053 @param name input the Resource URI/Name 00054 @param value input the Resource value (a string) 00055 */ 00056 StaticResource(const Logger *logger,const char *obj_name,const char *res_name,const string value); 00057 00058 /** 00059 constructor with buffer lengths 00060 @param logger input logger instance for this resource 00061 @param obj_name input the Object 00062 @param name input the Resource URI/Name 00063 #param name_length input the length of the Resource URI/Name 00064 @param value input the Resource value (or NULL) 00065 */ 00066 StaticResource(const Logger *logger,const string obj_name,const string res_name,const string value); 00067 00068 /** 00069 Copy constructor 00070 @param resource input the StaticResource that is to be deep copied 00071 */ 00072 StaticResource(const StaticResource &resource); 00073 00074 /** 00075 Destructor 00076 */ 00077 virtual ~StaticResource(); 00078 00079 /** 00080 Bind resource to endpoint 00081 @param p input pointer to the endpoint resources necessary for binding 00082 */ 00083 virtual M2MObject *bind(void *p); 00084 00085 /** 00086 Set the data wrapper 00087 @param data_wrapper input the data wrapper instance 00088 */ 00089 void setDataWrapper(DataWrapper *data_wrapper) { this->m_data_wrapper = data_wrapper; } 00090 00091 protected: 00092 DataWrapper *getDataWrapper() { return this->m_data_wrapper; } 00093 00094 private: 00095 DataWrapper *m_data_wrapper; 00096 M2MObject *m_object; 00097 }; 00098 00099 #endif // __STATIC_RESOURCE_H__ 00100
Generated on Wed Jul 13 2022 21:59:32 by
1.7.2