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
TickerResourceObserver.h
00001 /** 00002 * @file TickerResourceObserver.h 00003 * @brief mbed CoAP DynamicResource Ticker-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 __TICKER_RESOURCE_OBSERVER_H__ 00024 #define __TICKER_RESOURCE_OBSERVER_H__ 00025 00026 // mbedConnectorInterface configuration 00027 #include "mbed-connector-interface/mbedConnectorInterface.h" 00028 00029 #ifdef CONNECTOR_USING_TICKER 00030 00031 // mbed support 00032 #if defined(MCI_USE_YOTTA) 00033 // mbed support 00034 #include "mbed-drivers/mbed.h" 00035 #else 00036 // mbed support 00037 #include "mbed.h" 00038 #endif 00039 00040 // Base class support 00041 #include "mbed-connector-interface/ResourceObserver.h" 00042 00043 class TickerResourceObserver : public ResourceObserver { 00044 public: 00045 /** 00046 Default Constructor 00047 @param resource input the resource to observe 00048 @param timer_id input the id for our timer (can be index value of each resource that is observed...) 00049 @param sleep_time input the time for the observation tasklet to sleep (in whole seconds...) 00050 */ 00051 TickerResourceObserver(DynamicResource *resource,int sleep_time = DEFAULT_OBS_PERIOD); 00052 00053 /** 00054 Copy Constructor 00055 */ 00056 TickerResourceObserver(const TickerResourceObserver &observer); 00057 00058 /** 00059 Destructor 00060 */ 00061 virtual ~TickerResourceObserver(); 00062 00063 /** 00064 begin the observation 00065 */ 00066 virtual void beginObservation(); 00067 00068 /** 00069 stop the observation 00070 */ 00071 virtual void stopObservation(); 00072 00073 /** 00074 tasklet invoke function (static) 00075 */ 00076 void observationNotifier(void); 00077 00078 /** 00079 halt the underlying observer mechanism 00080 */ 00081 virtual void halt(); 00082 00083 private: 00084 Ticker m_ticker; 00085 }; 00086 00087 #endif // CONNECTOR_USING_TICKER 00088 00089 #endif // __TICKER_RESOURCE_OBSERVER_H__
Generated on Wed Jul 13 2022 01:24:02 by
