mbed Connector Endpoint interface. This interface permits a mbed endpoint to easily setup MDS resources and emit those resources to an MDS server.

Dependents:   IoT_LED_demo ServoTest uWater_Project hackathon ... more

Committer:
ansond
Date:
Sun Sep 06 03:16:02 2015 +0000
Revision:
61:143beb6d8800
Parent:
43:769d491a48c1
fixes to observation configuration/toggle switch issues.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 38:96d15287b6f9 1 /**
ansond 38:96d15287b6f9 2 * @file TickerResourceObserver.h
ansond 38:96d15287b6f9 3 * @brief mbed CoAP DynamicResource Ticker-based observer (header)
ansond 38:96d15287b6f9 4 * @author Doug Anson/Chris Paola
ansond 38:96d15287b6f9 5 * @version 1.0
ansond 38:96d15287b6f9 6 * @see
ansond 38:96d15287b6f9 7 *
ansond 38:96d15287b6f9 8 * Copyright (c) 2014
ansond 38:96d15287b6f9 9 *
ansond 38:96d15287b6f9 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 38:96d15287b6f9 11 * you may not use this file except in compliance with the License.
ansond 38:96d15287b6f9 12 * You may obtain a copy of the License at
ansond 38:96d15287b6f9 13 *
ansond 38:96d15287b6f9 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 38:96d15287b6f9 15 *
ansond 38:96d15287b6f9 16 * Unless required by applicable law or agreed to in writing, software
ansond 38:96d15287b6f9 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 38:96d15287b6f9 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 38:96d15287b6f9 19 * See the License for the specific language governing permissions and
ansond 38:96d15287b6f9 20 * limitations under the License.
ansond 38:96d15287b6f9 21 */
ansond 38:96d15287b6f9 22
ansond 38:96d15287b6f9 23 #ifndef __TICKER_RESOURCE_OBSERVER_H__
ansond 38:96d15287b6f9 24 #define __TICKER_RESOURCE_OBSERVER_H__
ansond 38:96d15287b6f9 25
ansond 38:96d15287b6f9 26 // mbed support
ansond 38:96d15287b6f9 27 #include "mbed.h"
ansond 38:96d15287b6f9 28
ansond 43:769d491a48c1 29 // switch for proper resource observer selection (from mbedEndpointNetwork)
ansond 43:769d491a48c1 30 #include "configuration.h"
ansond 43:769d491a48c1 31
ansond 38:96d15287b6f9 32 // mbedConnectorInterface configuration
ansond 38:96d15287b6f9 33 #include "mbedConnectorInterface.h"
ansond 38:96d15287b6f9 34
ansond 38:96d15287b6f9 35 // Base class support
ansond 38:96d15287b6f9 36 #include "ResourceObserver.h"
ansond 38:96d15287b6f9 37
ansond 38:96d15287b6f9 38 class TickerResourceObserver : public ResourceObserver {
ansond 38:96d15287b6f9 39 public:
ansond 38:96d15287b6f9 40 /**
ansond 38:96d15287b6f9 41 Default Constructor
ansond 38:96d15287b6f9 42 @param resource input the resource to observe
ansond 38:96d15287b6f9 43 @param timer_id input the id for our timer (can be index value of each resource that is observed...)
ansond 38:96d15287b6f9 44 @param sleep_time input the time for the observation tasklet to sleep (in whole seconds...)
ansond 38:96d15287b6f9 45 */
ansond 42:20c375e74e8e 46 TickerResourceObserver(DynamicResource *resource,int sleep_time = NSP_DEFAULT_OBS_PERIOD);
ansond 38:96d15287b6f9 47
ansond 38:96d15287b6f9 48 /**
ansond 38:96d15287b6f9 49 Copy Constructor
ansond 38:96d15287b6f9 50 */
ansond 38:96d15287b6f9 51 TickerResourceObserver(const TickerResourceObserver &observer);
ansond 38:96d15287b6f9 52
ansond 38:96d15287b6f9 53 /**
ansond 38:96d15287b6f9 54 Destructor
ansond 38:96d15287b6f9 55 */
ansond 38:96d15287b6f9 56 virtual ~TickerResourceObserver();
ansond 38:96d15287b6f9 57
ansond 38:96d15287b6f9 58 /**
ansond 38:96d15287b6f9 59 begin the observation
ansond 38:96d15287b6f9 60 */
ansond 38:96d15287b6f9 61 virtual void beginObservation();
ansond 38:96d15287b6f9 62
ansond 38:96d15287b6f9 63 /**
ansond 38:96d15287b6f9 64 stop the observation
ansond 38:96d15287b6f9 65 */
ansond 38:96d15287b6f9 66 virtual void stopObservation();
ansond 38:96d15287b6f9 67
ansond 38:96d15287b6f9 68 /**
ansond 38:96d15287b6f9 69 tasklet invoke function (static)
ansond 38:96d15287b6f9 70 */
ansond 38:96d15287b6f9 71 void observationNotifier(void);
ansond 38:96d15287b6f9 72
ansond 38:96d15287b6f9 73 private:
ansond 38:96d15287b6f9 74 Ticker m_ticker;
ansond 38:96d15287b6f9 75 };
ansond 38:96d15287b6f9 76
ansond 38:96d15287b6f9 77 #endif // __TICKER_RESOURCE_OBSERVER_H__