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.
Fork of mbedConnectorInterfaceWithDM by
ResourceObserver.h
00001 /** 00002 * @file ResourceObserver.h 00003 * @brief mbed CoAP DynamicResource observer (header) 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 __RESOURCE_OBSERVER_H__ 00024 #define __RESOURCE_OBSERVER_H__ 00025 00026 // DynamicResource 00027 #include "mbed-connector-interface/DynamicResource.h" 00028 00029 class ResourceObserver { 00030 public: 00031 /** 00032 Default Constructor 00033 @param resource input the resource to observe 00034 @param sleep_time input the amount of time to sleep between observations 00035 */ 00036 ResourceObserver(DynamicResource *resource,int sleep_time); 00037 00038 /** 00039 Copy Constructor 00040 */ 00041 ResourceObserver(const ResourceObserver &observer); 00042 00043 /** 00044 Destructor 00045 */ 00046 virtual ~ResourceObserver(); 00047 00048 /** 00049 begin the observation (ABSTRACT) 00050 */ 00051 virtual void beginObservation() = 0; 00052 00053 /** 00054 stop the observation (ABSTRACT) 00055 */ 00056 virtual void stopObservation() = 0; 00057 00058 /** 00059 we are observing? 00060 */ 00061 bool isObserving(); 00062 00063 /** 00064 get our sleep time 00065 */ 00066 int getSleepTime(); 00067 00068 /** 00069 halt the underlying observer mechanism 00070 */ 00071 virtual void halt(); 00072 00073 protected: 00074 DynamicResource *getResource(); 00075 void setObserving(bool observing); 00076 Logger *logger(); 00077 00078 private: 00079 DynamicResource *m_resource; 00080 bool m_is_observing; 00081 int m_sleep_time; 00082 }; 00083 00084 #endif // __RESOURCE_OBSERVER_H__
Generated on Wed Jul 13 2022 01:24:02 by
