LOST_SIGNAL, /**< Failed to reach the resource. */
};
+ enum class CacheMode
+ {
+ OBSERVE_ONLY,
+ OBSERVE_WITH_POLLING
+ };
+
/**
* The states of monitoring.
*
* @see RCSDiscoveryManager
*
*/
- class RCSRemoteResourceObject
+ class RCSRemoteResourceObject : public std::enable_shared_from_this<RCSRemoteResourceObject>
{
public:
typedef std::shared_ptr< RCSRemoteResourceObject > Ptr;
*
* @param attrs the updated attributes
*/
- typedef std::function< void(const RCSResourceAttributes& attrs) > CacheUpdatedCallback;
+ typedef std::function< void(const RCSResourceAttributes& attrs, int eCode) >
+ CacheUpdatedCallback;
/**
* Callback definition to be invoked when the response of getRemoteAttributes is
std::shared_ptr< OC::OCResource > ocResource);
/**
+ * Returns an equivalent OCResource using RCSRemoteResourceObject instance.
+ *
+ * @throw RCSInvalidParameterException If rcsResource is nullptr.
+ */
+ static std::shared_ptr< OC::OCResource > toOCResource(
+ RCSRemoteResourceObject::Ptr rcsResource);
+
+ /**
* Returns whether monitoring is enabled.
*
* @see startMonitoring()
* updates the cached data accordingly.
*
* @param cb If non-empty function, it will be invoked whenever the cache updated.
+ * @param mode if CacheMode is OBSERVE_ONLY, it will be invoked when receive observe response only.
*
* @throws BadRequestException If caching is already started.
*
* @see getCachedAttribute(const std::string&) const
*
*/
- void startCaching(CacheUpdatedCallback cb);
+ void startCaching(CacheUpdatedCallback cb, CacheMode mode = CacheMode::OBSERVE_WITH_POLLING);
/**
* Stops caching.