mbed Connector Interface simplification API on top of mbed-client
Fork of mbedConnectorInterfaceV3 by
NOTE:
This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!
mbed-connector-interface/MinarResourceObserver.h@127:b4a661ff6fb9, 2017-09-26 (annotated)
- Committer:
- ansond
- Date:
- Tue Sep 26 16:01:31 2017 +0000
- Revision:
- 127:b4a661ff6fb9
- Parent:
- 125:4bf229bf14a3
minor re-ordering of FCC init
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 27:b8aaf7dc7023 | 1 | /** |
ansond | 27:b8aaf7dc7023 | 2 | * @file MinarResourceObserver.h |
ansond | 27:b8aaf7dc7023 | 3 | * @brief mbed CoAP DynamicResource Minar-based observer (header) |
ansond | 27:b8aaf7dc7023 | 4 | * @author Doug Anson/Chris Paola |
ansond | 27:b8aaf7dc7023 | 5 | * @version 1.0 |
ansond | 27:b8aaf7dc7023 | 6 | * @see |
ansond | 27:b8aaf7dc7023 | 7 | * |
ansond | 27:b8aaf7dc7023 | 8 | * Copyright (c) 2014 |
ansond | 27:b8aaf7dc7023 | 9 | * |
ansond | 27:b8aaf7dc7023 | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ansond | 27:b8aaf7dc7023 | 11 | * you may not use this file except in compliance with the License. |
ansond | 27:b8aaf7dc7023 | 12 | * You may obtain a copy of the License at |
ansond | 27:b8aaf7dc7023 | 13 | * |
ansond | 27:b8aaf7dc7023 | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
ansond | 27:b8aaf7dc7023 | 15 | * |
ansond | 27:b8aaf7dc7023 | 16 | * Unless required by applicable law or agreed to in writing, software |
ansond | 27:b8aaf7dc7023 | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
ansond | 27:b8aaf7dc7023 | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ansond | 27:b8aaf7dc7023 | 19 | * See the License for the specific language governing permissions and |
ansond | 27:b8aaf7dc7023 | 20 | * limitations under the License. |
ansond | 27:b8aaf7dc7023 | 21 | */ |
ansond | 27:b8aaf7dc7023 | 22 | |
ansond | 27:b8aaf7dc7023 | 23 | #ifndef __MINAR_RESOURCE_OBSERVER_H__ |
ansond | 27:b8aaf7dc7023 | 24 | #define __MINAR_RESOURCE_OBSERVER_H__ |
ansond | 27:b8aaf7dc7023 | 25 | |
ansond | 33:1d0b855df5a5 | 26 | // mbedConnectorInterface configuration |
ansond | 33:1d0b855df5a5 | 27 | #include "mbed-connector-interface/mbedConnectorInterface.h" |
ansond | 27:b8aaf7dc7023 | 28 | |
ansond | 125:4bf229bf14a3 | 29 | #if defined (MCI_MINAR_SCHEDULER) |
ansond | 125:4bf229bf14a3 | 30 | |
ansond | 31:2507e64fcc42 | 31 | // mbed support |
ansond | 31:2507e64fcc42 | 32 | #if defined(MCI_USE_YOTTA) |
ansond | 31:2507e64fcc42 | 33 | // mbed support |
ansond | 31:2507e64fcc42 | 34 | #include "mbed-drivers/mbed.h" |
ansond | 31:2507e64fcc42 | 35 | #else |
ansond | 31:2507e64fcc42 | 36 | // mbed support |
ansond | 31:2507e64fcc42 | 37 | #include "mbed.h" |
ansond | 31:2507e64fcc42 | 38 | #endif |
ansond | 31:2507e64fcc42 | 39 | |
ansond | 27:b8aaf7dc7023 | 40 | // Base class support |
ansond | 27:b8aaf7dc7023 | 41 | #include "mbed-connector-interface/ResourceObserver.h" |
ansond | 27:b8aaf7dc7023 | 42 | |
ansond | 27:b8aaf7dc7023 | 43 | class MinarResourceObserver : public ResourceObserver { |
ansond | 27:b8aaf7dc7023 | 44 | public: |
ansond | 27:b8aaf7dc7023 | 45 | /** |
ansond | 27:b8aaf7dc7023 | 46 | Default Constructor |
ansond | 27:b8aaf7dc7023 | 47 | @param resource input the resource to observe |
ansond | 27:b8aaf7dc7023 | 48 | @param sleep_time input the time for the observation thread to sleep (in ms) |
ansond | 27:b8aaf7dc7023 | 49 | */ |
ansond | 54:dfee8691c83a | 50 | MinarResourceObserver(DynamicResource *resource,int sleep_time = DEFAULT_OBS_PERIOD); |
ansond | 27:b8aaf7dc7023 | 51 | |
ansond | 27:b8aaf7dc7023 | 52 | /** |
ansond | 27:b8aaf7dc7023 | 53 | Destructor |
ansond | 27:b8aaf7dc7023 | 54 | */ |
ansond | 27:b8aaf7dc7023 | 55 | virtual ~MinarResourceObserver(); |
ansond | 27:b8aaf7dc7023 | 56 | |
ansond | 27:b8aaf7dc7023 | 57 | /** |
ansond | 27:b8aaf7dc7023 | 58 | begin the observation |
ansond | 27:b8aaf7dc7023 | 59 | */ |
ansond | 27:b8aaf7dc7023 | 60 | virtual void beginObservation(); |
ansond | 27:b8aaf7dc7023 | 61 | |
ansond | 27:b8aaf7dc7023 | 62 | /** |
ansond | 27:b8aaf7dc7023 | 63 | stop the observation |
ansond | 27:b8aaf7dc7023 | 64 | */ |
ansond | 27:b8aaf7dc7023 | 65 | virtual void stopObservation(); |
ansond | 27:b8aaf7dc7023 | 66 | |
ansond | 27:b8aaf7dc7023 | 67 | /** |
ansond | 125:4bf229bf14a3 | 68 | observation task method |
ansond | 27:b8aaf7dc7023 | 69 | */ |
ansond | 125:4bf229bf14a3 | 70 | void observation_task(); |
ansond | 54:dfee8691c83a | 71 | |
ansond | 54:dfee8691c83a | 72 | /** |
ansond | 54:dfee8691c83a | 73 | halt the underlying observer mechanism |
ansond | 54:dfee8691c83a | 74 | */ |
ansond | 54:dfee8691c83a | 75 | virtual void halt(); |
ansond | 27:b8aaf7dc7023 | 76 | |
ansond | 27:b8aaf7dc7023 | 77 | private: |
ansond | 27:b8aaf7dc7023 | 78 | |
ansond | 27:b8aaf7dc7023 | 79 | }; |
ansond | 27:b8aaf7dc7023 | 80 | |
ansond | 27:b8aaf7dc7023 | 81 | #endif // MCI_MINAR_SCHEDULER |
ansond | 27:b8aaf7dc7023 | 82 | |
ansond | 27:b8aaf7dc7023 | 83 | #endif // __MINAR_RESOURCE_OBSERVER_H__ |