mbedConnectorInterface sample endpoint utilizing 3g cellular radio as the underlying connection transport.
Dependencies: LM75B mbed mbedConnectorInterface mbedEndpointNetwork_Ublox
SampleDynamicResource.h
00001 /** 00002 * @file SampleDynamicResource.h 00003 * @brief mbed CoAP Endpoint example dynamic resource supporting CoAP GET and PUT 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 __SAMPLE_DYNAMIC_RESOURCE_H__ 00024 #define __SAMPLE_DYNAMIC_RESOURCE_H__ 00025 00026 // Base class 00027 #include "DynamicResource.h" 00028 00029 // Put any physical abstractions here (i.e. DigitalOut, etc...). For this sample, its simply a string... 00030 string my_physical_resource("hello mbed"); 00031 00032 /** SampleDynamicResource class 00033 */ 00034 class SampleDynamicResource : public DynamicResource 00035 { 00036 00037 public: 00038 /** 00039 Default constructor 00040 @param logger input logger instance for this resource 00041 @param name input the sample resource name 00042 @param observable input the resource is Observable (default: FALSE) 00043 */ 00044 SampleDynamicResource(const Logger *logger,const char *name,const bool observable = false) : DynamicResource(logger,name,"SampleResource",SN_GRS_GET_ALLOWED|SN_GRS_PUT_ALLOWED,observable) { 00045 } 00046 00047 /** 00048 Get the value of the Sample Resource 00049 @returns string representing the current value of this resource 00050 */ 00051 virtual string get() { 00052 return my_physical_resource; 00053 } 00054 00055 /** 00056 Set the value of the Sample Resource 00057 @param string input the new string value for this resource 00058 */ 00059 virtual void put(const string value) { 00060 my_physical_resource = value; 00061 } 00062 }; 00063 00064 #endif // __SAMPLE_DYNAMIC_RESOURCE_H__
Generated on Sat Jul 30 2022 21:39:30 by 1.7.2