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 mbedConnectorInterfaceV3 by
EventQueueResourceObserver.h
00001 /** 00002 * @file EventQueueResourceObserver.h 00003 * @brief mbed CoAP DynamicResource EventQueue-based observer (header) 00004 * @author Doug Anson/Chris Paola 00005 * @version 1.0 00006 * @see 00007 * 00008 * Copyright (c) 2017 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 __EVENT_QUEUE_RESOURCE_OBSERVER_H__ 00024 #define __EVENT_QUEUE_RESOURCE_OBSERVER_H__ 00025 00026 // mbedConnectorInterface configuration 00027 #include "mbed-connector-interface/mbedConnectorInterface.h" 00028 00029 #ifdef CONNECTOR_USING_EVENT_QUEUES 00030 00031 // mbed support 00032 #include "mbed.h" 00033 #include "mbed_events.h" 00034 00035 // Base class support 00036 #include "mbed-connector-interface/ResourceObserver.h" 00037 00038 class EventQueueResourceObserver : public ResourceObserver { 00039 public: 00040 /** 00041 Default Constructor 00042 @param resource input the resource to observe 00043 @param sleep_time input the time for the observation thread to sleep (in ms) 00044 */ 00045 EventQueueResourceObserver(DynamicResource *resource,int sleep_time = DEFAULT_OBS_PERIOD); 00046 00047 /** 00048 Destructor 00049 */ 00050 virtual ~EventQueueResourceObserver(); 00051 00052 /** 00053 begin the observation 00054 */ 00055 virtual void beginObservation(); 00056 00057 /** 00058 stop the observation 00059 */ 00060 virtual void stopObservation(); 00061 00062 /** 00063 observation task method (static) 00064 */ 00065 static void observation_task(); 00066 00067 /** 00068 halt the underlying observer mechanism 00069 */ 00070 virtual void halt(); 00071 00072 private: 00073 EventQueue m_event_queue; 00074 int m_id; 00075 }; 00076 00077 #endif // CONNECTOR_USING_EVENT_QUEUES 00078 00079 #endif // __EVENT_QUEUE_RESOURCE_OBSERVER_H__
Generated on Tue Jul 12 2022 18:16:51 by
1.7.2
