observe updates

Fork of mbedConnectorInterface by Doug Anson

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TickerResourceObserver.h Source File

TickerResourceObserver.h

Go to the documentation of this file.
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 // 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 // Base class support
00036 #include "ResourceObserver.h"
00037 
00038 class TickerResourceObserver : public ResourceObserver {
00039     public:
00040         /**
00041         Default Constructor
00042         @param resource input the resource to observe
00043         @param timer_id input the id for our timer (can be index value of each resource that is observed...)
00044         @param sleep_time input the time for the observation tasklet to sleep (in whole seconds...)
00045         */
00046         TickerResourceObserver(DynamicResource *resource,int sleep_time = NSP_DEFAULT_OBS_PERIOD);
00047         
00048         /**
00049         Copy Constructor
00050         */
00051         TickerResourceObserver(const TickerResourceObserver &observer);
00052         
00053         /**
00054         Destructor
00055         */
00056         virtual ~TickerResourceObserver();
00057         
00058         /**
00059         begin the observation
00060         */
00061         virtual void beginObservation();
00062         
00063         /**
00064         stop the observation
00065         */
00066         virtual void stopObservation();
00067                      
00068         /**
00069         tasklet invoke function (static)
00070         */
00071         void observationNotifier(void);
00072     
00073     private:
00074         Ticker m_ticker;
00075 };
00076 
00077 #endif // __TICKER_RESOURCE_OBSERVER_H__