observe updates
Fork of mbedConnectorInterface by
Revision 48:f6dc5f56b810, committed 2015-04-13
- Comitter:
- michaeljkoster
- Date:
- Mon Apr 13 22:36:34 2015 +0000
- Parent:
- 47:e75750ddc413
- Commit message:
- update DynamicResource and OptionsBuilder for observe
Changed in this revision
api/DynamicResource.cpp | Show annotated file Show diff for this revision Revisions of this file |
api/OptionsBuilder.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e75750ddc413 -r f6dc5f56b810 api/DynamicResource.cpp --- a/api/DynamicResource.cpp Sun Apr 12 04:00:53 2015 +0000 +++ b/api/DynamicResource.cpp Mon Apr 13 22:36:34 2015 +0000 @@ -29,6 +29,7 @@ #include "ResourceObserver.h" // Leaving this disabled until the CoAP draft spec is further along... +#define GET_ENABLE_DISABLE_OBS #ifdef GET_ENABLE_DISABLE_OBS // GET verb can Start/Stop Observations... #define START_OBS 0 @@ -319,6 +320,9 @@ if (status == 0) { this->logger()->log("ERROR: resource(NOTIFY) send failed..."); } + else{ + this->m_obs_number++; + } // return our status return status;
diff -r e75750ddc413 -r f6dc5f56b810 api/OptionsBuilder.cpp --- a/api/OptionsBuilder.cpp Sun Apr 12 04:00:53 2015 +0000 +++ b/api/OptionsBuilder.cpp Mon Apr 13 22:36:34 2015 +0000 @@ -178,7 +178,9 @@ TickerResourceObserver *observer = new TickerResourceObserver((DynamicResource *)resource,(int)sleep_time); #endif this->m_resource_observers.push_back(observer); +#ifdef ENABLE_OBS_ON_START observer->beginObservation(); +#endif } } return *this;