observe updates
Fork of mbedConnectorInterface by
Embed:
(wiki syntax)
Show/hide line numbers
ThreadedResourceObserver.h
Go to the documentation of this file.
00001 /** 00002 * @file ThreadedResourceObserver.h 00003 * @brief mbed CoAP DynamicResource Thread-based 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 __THREADED_RESOURCE_OBSERVER_H__ 00024 #define __THREADED_RESOURCE_OBSERVER_H__ 00025 00026 // mbed support 00027 #include "mbed.h" 00028 00029 // switch for proper resource observer selection (from mbedEndpointNetwork) 00030 #include "configuration.h" 00031 00032 // mbedConnectorInterface configuration 00033 #include "mbedConnectorInterface.h" 00034 00035 // Thread support 00036 #ifdef CONNECTOR_USING_THREADS 00037 #include "rtos.h" 00038 #endif 00039 00040 // Base class support 00041 #include "ResourceObserver.h" 00042 00043 class ThreadedResourceObserver : public ResourceObserver { 00044 public: 00045 /** 00046 Default Constructor 00047 @param resource input the resource to observe 00048 @param sleep_time input the time for the observation thread to sleep (in ms) 00049 */ 00050 ThreadedResourceObserver(DynamicResource *resource,int sleep_time = NSP_DEFAULT_OBS_PERIOD); 00051 00052 /** 00053 Destructor 00054 */ 00055 virtual ~ThreadedResourceObserver(); 00056 00057 /** 00058 begin the observation 00059 */ 00060 virtual void beginObservation(); 00061 00062 /** 00063 stop the observation 00064 */ 00065 virtual void stopObservation(); 00066 00067 /** 00068 thread invoke function (static) 00069 */ 00070 static void _observation_notifier(void const *instance); 00071 00072 private: 00073 #ifdef CONNECTOR_USING_THREADS 00074 Thread m_observation_thread; 00075 #endif 00076 }; 00077 00078 #endif // __THREADED_RESOURCE_OBSERVER_H__
Generated on Wed Jul 13 2022 02:11:49 by 1.7.2