added max-age and content-format
Fork of mbedConnectorInterface by
Diff: api/OptionsBuilder.cpp
- Revision:
- 48:4b9ee3e32f93
- Parent:
- 47:e75750ddc413
--- a/api/OptionsBuilder.cpp Sun Apr 12 04:00:53 2015 +0000 +++ b/api/OptionsBuilder.cpp Mon Apr 13 23:41:34 2015 +0000 @@ -140,6 +140,7 @@ OptionsBuilder &OptionsBuilder::addResource(const StaticResource *resource) { if (resource != NULL) { + ((StaticResource *)resource)->setOptions(this); this->m_static_resources.push_back((StaticResource *)resource); } return *this; @@ -171,6 +172,7 @@ { if (resource != NULL) { this->m_dynamic_resources.push_back((DynamicResource *)resource); + ((DynamicResource *)resource)->setOptions(this); if (((DynamicResource *)resource)->isObservable() == true && use_observer == true) { #ifdef CONNECTOR_USING_THREADS ThreadedResourceObserver *observer = new ThreadedResourceObserver((DynamicResource *)resource,(int)sleep_time); @@ -178,7 +180,11 @@ TickerResourceObserver *observer = new TickerResourceObserver((DynamicResource *)resource,(int)sleep_time); #endif this->m_resource_observers.push_back(observer); - observer->beginObservation(); + + // immedate observation enablement option + if (this->immedateObservationEnabled()) { + observer->beginObservation(); + } } } return *this; @@ -225,4 +231,16 @@ return (Options *)this; } +// Enable/Disable immediate observationing +OptionsBuilder &OptionsBuilder::setImmedateObservationEnabled(bool enable) { + this->m_enable_immediate_observation = enable; + return *this; +} + +// Enable/Disable GET-based control of observations +OptionsBuilder &OptionsBuilder::setEnableGETObservationControl(bool enable) { + this->m_enable_get_obs_control = enable; + return *this; +} + } // namespace Connector \ No newline at end of file