//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/**
+ * @file
+ *
+ * This file contains BundleInfo class, which provides APIs related to Bundle information.
+ */
+
#ifndef BUNDLEINFO_H_
#define BUNDLEINFO_H_
{
namespace Service
{
- /*
- * Describes a bundle with resources, that can be loaded dynamically.
- */
+
+ /**
+ * @class BundleInfo
+ * @brief This class provides APIs for creating, getting and setting the Bundle Information
+ *
+ */
class BundleInfo
{
public:
BundleInfo();
virtual ~BundleInfo();
+
+ /**
+ * API for setting the Id of the bundle
+ *
+ * @param name - Id of the bundle in string form
+ *
+ */
virtual void setID(std::string name) = 0;
+
+ /**
+ * API for getting the Id of the bundle
+ *
+ * @return string - Id of the bundle
+ *
+ */
virtual std::string getID() = 0;
+
+ /**
+ * API for setting the path of the bundle
+ *
+ * @param path - path of the bundle in string form
+ *
+ */
virtual void setPath(std::string path) = 0;
+
+ /**
+ * API for getting the path of the bundle
+ *
+ * @return path - path of the bundle
+ *
+ */
virtual std::string getPath() = 0;
+
+ /**
+ * API for setting the Activator name for the bundle
+ *
+ * @param activator - Activator name in string form
+ *
+ */
virtual void setActivatorName(std::string activator) = 0;
+
+ /**
+ * API for setting the Activator name for the bundle
+ *
+ * @return string - Name of the activator
+ *
+ */
virtual std::string getActivatorName() = 0;
+
+ /**
+ * API for setting the library path for the bundle
+ *
+ * @param libpath - Library path in string form
+ *
+ */
virtual void setLibraryPath(std::string libpath) = 0;
+
+ /**
+ * API for getting the library path for the bundle
+ *
+ * @return string - Library path in string form
+ *
+ */
virtual std::string getLibraryPath() = 0;
+
+ /**
+ * API for setting the version of the bundle
+ *
+ * @param version - version of the bundle in string form
+ *
+ */
virtual void setVersion(std::string version) = 0;
+
+ /**
+ * API for getting the version of the bundle
+ *
+ * @return string - version of the bundle
+ *
+ */
virtual std::string getVersion() = 0;
+
+ /**
+ * API for creating new bundle information
+ *
+ * @return BundleInfo - BundleInfo pointer.
+ *
+ */
static BundleInfo *build();
protected:
std::string m_ID, m_path, m_version;
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/**
+ * @file
+ *
+ * This file defines a class to handle exception thrown for resource manipulation.
+ */
+
#ifndef RES_MANIPULATION_RCSEXCEPTION_H
#define RES_MANIPULATION_RCSEXCEPTION_H
namespace Service
{
+ /**
+ * @class RCSException
+ * @brief This class helps to throw wide range of exception to the application/developers.
+ * It inherits the standard exception class.
+ *
+ */
class RCSException: public std::exception
{
- public:
- RCSException();
- explicit RCSException(const std::string&);
- explicit RCSException(std::string&&);
+ public:
+ /**
+ * Default Constructor
+ */
+ RCSException();
+
+ /**
+ * Parametrized Constructor to set exception description as a string.
+ *
+ * @param what - exception description
+ */
+ explicit RCSException(const std::string &what);
+
+ /**
+ * Parametrized Constructor to set exception description as a string.
+ *
+ * @param what - exception description
+ */
+ explicit RCSException(std::string &&what);
- virtual ~RCSException() noexcept {}
+ /**
+ * virtual destructor
+ */
+ virtual ~RCSException() noexcept {}
- virtual const char* what() const noexcept;
+ /**
+ * API for returning the exception description in string format
+ *
+ * @return const char* - exception description
+ */
+ virtual const char *what() const noexcept;
- private:
- std::string m_what;
+ private:
+ /**
+ * Exception description
+ */
+ std::string m_what;
};
+ /**
+ * @class PlatformException
+ * @brief This class helps in throwing platform exception to the application/developers.
+ * It inherits from RCSException class.
+ *
+ * NOTE: OCStackResult is defined in octypes.h.
+ */
class PlatformException: public RCSException
{
- public:
- explicit PlatformException(OCStackResult reason);
+ public:
+ explicit PlatformException(OCStackResult reason);
- OCStackResult getReasonCode() const;
- std::string getReason() const;
+ /**
+ * API for getting exception code.
+ *
+ * @return OCStackResult - exception code.
+ *
+ */
+ OCStackResult getReasonCode() const;
+ /**
+ * API for getting exception reason.
+ *
+ * @return string - exception reason as a string.
+ *
+ */
+ std::string getReason() const;
- private:
- OCStackResult m_reason;
+ private:
+ /*
+ * reason for the exception, stored as OCStackResult value.
+ */
+ OCStackResult m_reason;
};
}
}
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/**
+ * @file
+ *
+ * This file cotains RCSRequest class, which provide API to get resource URI from the request.
+ */
#ifndef SERVERBUILDER_PRIMITIVEREQUEST_H
#define SERVERBUILDER_PRIMITIVEREQUEST_H
{
namespace Service
{
-
+ /**
+ * @class RCSRequest
+ * @brief This class describes the resource request.
+ * It provides API to get the resource URI from the request.
+ */
class RCSRequest
{
- public:
- explicit RCSRequest(const std::string& resourceUri);
+ public:
+ /**
+ * Constructor to set resource URI.
+ *
+ * @param resourceUri - URI of the resource for which the request is generated.
+ */
+ explicit RCSRequest(const std::string &resourceUri);
- RCSRequest& operator=(RCSRequest&) = delete;
+ RCSRequest &operator=(RCSRequest &) = delete;
- std::string getResourceUri() const;
+ /**
+ * API to get the URI from the request.
+ *
+ * @return string - uri of resource.
+ */
+ std::string getResourceUri() const;
- private:
- std::string m_resourceUri;
+ private:
+ /**
+ * resource uri value stored as a string.
+ * value set once during request initialization.
+ */
+ std::string m_resourceUri;
};
}
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/**
+ * @file
+ *
+ * This file contains the classes for creating Get & Set response for the Get & Set request.
+ */
#ifndef SERVERBUILDER_RCSRESPONSE_H
#define SERVERBUILDER_RCSRESPONSE_H
{
namespace Service
{
+ //forward declaration of classes
class ResourceAttributes;
class RequestHandler;
class SetRequestHandler;
+ /**
+ * @class RCSGetResponse
+ * @brief This class provides APIs to create the response for the recieved Get request.
+ */
class RCSGetResponse
{
public:
+ /**
+ * Create RCSGetResponse with default response.
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ */
static RCSGetResponse defaultAction();
- static RCSGetResponse create(const OCEntityHandlerResult&, int errorCode);
+ /**
+ * Create RCSGetResponse using OCEntityHandlerResult value and error code provided.
+ *
+ * @param result -OCEntityHandlerResult
+ *
+ * @param errorCode - error code to set in response
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ *
+ * NOTE : OCEntityHandlerResult is defined in octypes.h
+ */
+ static RCSGetResponse create(const OCEntityHandlerResult &result, int errorCode);
- static RCSGetResponse create(const ResourceAttributes&);
- static RCSGetResponse create(const ResourceAttributes&,
- const OCEntityHandlerResult&, int errorCode);
+ /**
+ * Create RCSGetResponse using resource attributes.
+ *
+ * @param attrs -ResourceAttributes to set
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ *
+ * @see ResourceAttributes
+ *
+ * NOTE : ResourceAttributes is defined in ResourceAttributes.h
+ */
+ static RCSGetResponse create(const ResourceAttributes &attrs);
+ /**
+ * Create RCSGetResponse using ResourceAttributes, OCEntityHandlerResult and error code.
+ *
+ * @param attrs - ResourceAttributes to set
+ *
+ * @param result - OCEntityHandlerResult
+ *
+ * @param errorCode - error code for response
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ *
+ * @see ResourceAttributes
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h.
+ * ResourceAttributes is defined in ResourceAttributes.h.
+ */
+ static RCSGetResponse create(const ResourceAttributes &attrs,
+ const OCEntityHandlerResult &result, int errorCode);
- static RCSGetResponse create(ResourceAttributes&&);
- static RCSGetResponse create(ResourceAttributes&&, const OCEntityHandlerResult&,
- int errorCode);
+ /**
+ * Create RCSGetResponse using ResourceAttributes value.
+ *
+ * @param attrs - ResourceAttributes to set
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ *
+ * @see ResourceAttributes
+ *
+ *NOTE : ResourceAttributes is defined in ResourceAttributes.h.
+ */
+ static RCSGetResponse create(ResourceAttributes &&attrs);
+ /**
+ * Create RCSGetResponse using ResourceAttributes value.
+ *
+ * @param attrs - ResourceAttributes to set
+ *
+ * @param result - OCEntityHandlerResult
+ *
+ * @param errorCode - error code for response
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ *
+ * @see ResourceAttributes
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h.
+ * ResourceAttributes is defined in ResourceAttributes.h.
+ */
+ static RCSGetResponse create(ResourceAttributes &&attrs, const OCEntityHandlerResult &result,
+ int errorCode);
+ /**
+ * Get the request handler.
+ *
+ * @return RequestHandler - RequestHandler pointer.
+ *
+ */
RequestHandler* getHandler() const;
private:
std::shared_ptr< RequestHandler > m_handler;
};
+ /**
+ * @class RCSSetResponse
+ * @brief This class provides API to create a response for received Set request.
+ */
class RCSSetResponse
{
public:
- enum class AcceptanceMethod
+ /**
+ * AcceptanceMethod enum provides values for different acceptance method policy to be
+ * used in setting response.
+ */
+ enum class AcceptanceMethod
{
DEFAULT,
ACCEPT,
IGNORE
};
+ /**
+ * Create default RCSSetResponse with default response.
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ */
static RCSSetResponse defaultAction();
+ /**
+ * Internally it invokes the defaultAction() API.
+ * It sets the AcceptanceMethod as ACCEPT.
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see AcceptanceMethod
+ */
static RCSSetResponse accept();
- static RCSSetResponse accept(const OCEntityHandlerResult&, int errorCode);
+ /**
+ * Internally it invokes the create(const OCEntityHandlerResult&, int errorCode) API.
+ * It sets the AcceptanceMethod as ACCEPT.
+ *
+ * @param result - OCEntityHandlerResult value.
+ *
+ * @param errorCode - error code for the response
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see AcceptanceMethod
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h
+ */
+ static RCSSetResponse accept(const OCEntityHandlerResult &result, int errorCode);
+ /**
+ * Internally it invokes the defaultAction() API.
+ * It sets the AcceptanceMethod as IGNORE.
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse.
+ *
+ * @see AcceptanceMethod
+ */
static RCSSetResponse ignore();
- static RCSSetResponse ignore(const OCEntityHandlerResult&, int errorCode);
+ /**
+ * Internaly it invokes the create(const OCEntityHandlerResult&, int errorCode) API.
+ * It sets the AcceptanceMethod as IGNORE.
+ *
+ * @param result - OCEntityHandlerResult value.
+ *
+ * @param errorCode - error code for the response.
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse.
+ *
+ * @see AcceptanceMethod
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h
+ */
+ static RCSSetResponse ignore(const OCEntityHandlerResult &result, int errorCode);
- static RCSSetResponse create(const OCEntityHandlerResult&, int errorCode);
+ /**
+ * Create RCSSetResponse with OCEntityHandlerResult and errorCode.
+ *
+ * @param result - OCEntityHandlerResult value
+ *
+ * @param errorCode - error code for the response
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h
+ */
+ static RCSSetResponse create(const OCEntityHandlerResult &result, int errorCode);
- static RCSSetResponse create(const ResourceAttributes&);
- static RCSSetResponse create(const ResourceAttributes&,
- const OCEntityHandlerResult&, int errorCode);
+ /**
+ * Create RCSSetResponse with ResourceAttributes.
+ *
+ * @param attrs - ResourceAttributes to set
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see ResourceAttributes
+ */
+ static RCSSetResponse create(const ResourceAttributes &attrs);
+ /**
+ * Create RCSSetResponse with ResourceAttributes, OCEntityHandlerResult and errorCode.
+ *
+ * @param attrs - ResourceAttributes to set.
+ *
+ * @param result - OCEntityHandlerResult value
+ *
+ * @param errorCode - error code for the response
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see ResourceAttributes
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h.
+ */
+ static RCSSetResponse create(const ResourceAttributes &attrs,
+ const OCEntityHandlerResult &result, int errorCode);
- static RCSSetResponse create(ResourceAttributes&&);
- static RCSSetResponse create(ResourceAttributes&&, const OCEntityHandlerResult&,
- int errorCode);
+ /**
+ * Create RCSSetResponse with ResourceAttributes.
+ *
+ * @param attrs - ResourceAttributes value to set
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see ResourceAttributes
+ */
+ static RCSSetResponse create(ResourceAttributes &&attrs);
+ /**
+ * Create RCSSetResponse with ResourceAttributes, OCEntityHandlerResult and errorCode.
+ *
+ * @param attrs - ResourceAttributes value to set
+ *
+ * @param result - OCEntityHandlerResult value
+ *
+ * @param errorCode - error code for the response
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see ResourceAttributes
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h.
+ */
+ static RCSSetResponse create(ResourceAttributes &&attrs, const OCEntityHandlerResult &result,
+ int errorCode);
+ /**
+ * API to get the set request handler.
+ *
+ * @return SetRequestHandler - pointer to SetRequestHandler.
+ *
+ */
SetRequestHandler* getHandler() const;
+ /**
+ * API to get the acceptance method of the RCSSetResponse.
+ *
+ * @return AcceptanceMethod - acceptance methods enum value.
+ *
+ * @see AcceptanceMethod
+ *
+ */
AcceptanceMethod getAcceptanceMethod() const;
- RCSSetResponse& setAcceptanceMethod(AcceptanceMethod);
+ /**
+ * API to get the acceptance method of the RCSSetResponse.
+ *
+ * @param method - AcceptanceMethod value to set
+ *
+ * @return RCSSetResponse - reference to RCSSetResponse
+ *
+ * @see AcceptanceMethod
+ *
+ */
+ RCSSetResponse &setAcceptanceMethod(AcceptanceMethod method);
private:
RCSSetResponse(std::shared_ptr< SetRequestHandler >&&);
#include <boost/scoped_ptr.hpp>
#include <RCSException.h>
-
+/**
+ * @file
+ *
+ * This file contains the "ResourceAttributes" class & its helper classes
+ */
namespace OIC
{
namespace Service
{
+ /**
+ * @class BadGetException
+ * @brief This class is used to throw exception to the upper layer if Get request for a particular
+ * attribute is invalid. It is inherited from RCSException class.
+ *
+ */
class BadGetException: public RCSException
{
public:
BadGetException(const std::string& what) : RCSException{ what } {}
BadGetException(std::string&& what) : RCSException{ std::move(what) } {}
};
-
+ /**
+ * @class InvalidKeyException
+ * @brief This class is used to throw exception to the upper layer if key is invalid.
+ * It is inherited from RCSException class.
+ *
+ */
class InvalidKeyException: public RCSException
{
public:
InvalidKeyException(std::string&& what) : RCSException{ std::move(what) } {}
};
+ /**
+ * @class ResourceAttributes
+ * @brief This class represents the attributes for a resource.
+ * It overloaded the various operators like ==, [], = etc. It provides the APIs that a std::Map provides
+ * like begin, end, size etc. Also provides two kinds of iterator to iterate over the attributes.
+ *
+ * It has helper classes:
+ * Value - For value of the Attribute
+ * Type - For data type of the Attribute
+ * iterator - For iterating over attributes
+ * const_iterator - const iterator for attributes
+ *
+ *
+ * @see Value
+ * @see Type
+ * @see iterator
+ * @see const_iterator
+ *
+ * NOTE: If Developer wants to get the ResourceAttributes for the resource of interest following
+ * are the steps:
+ * - first call the discover API of DiscoveryManager class.
+ * - After getting the RemoteResourceObject, call getRemoteAttributes() API
+ * of RemoteResourceObject class
+ *
+ * @see DiscoveryManager
+ * @see RemoteResourceObject
+ */
class ResourceAttributes
{
private:
public:
template< typename T >
+ /**
+ * For checking whether the provided type is supported or not for a attribute.
+ */
struct is_supported_type: public std::conditional<
IsSupportedTypeHelper< T >::type::value, std::true_type, std::false_type>::type { };
+ /**
+ * enum class for the different supported types for Attributes
+ */
enum class TypeId
{
NULL_T,
VECTOR
};
+ /**
+ * This class contains APIs for "Type" of the attribute.
+ * All Types are specified in enum TypeId.
+ *
+ * @see TypeId
+ */
class Type
{
public:
int m_which;
};
+ /**
+ * This class provides APIs for the Value of the attributes.
+ */
class Value
{
public:
bool operator!=(const ResourceAttributes&, const ResourceAttributes&);
+ /**
+ * This class is for the static visitors of key-value for a attribute.
+ *
+ * It has three sub-classes
+ * - KeyVisitor : for key visitor
+ * - ValueVisitor : for value visitor
+ * - ConstValueVisitor : for const value visitor
+ * All these 3 sub-classes inheriting the boost::static_visitor which allows invocation as a function
+ * by overloading operator(), unambiguously accepting any value of type T. All the 3 classes are
+ * inherting the boost::static_visitor with same type i.e. String.
+ *
+ */
class ResourceAttributes::KeyValuePair
{
private:
friend class const_iterator;
};
+ /**
+ * This class is an Iterator for the ResourceAttributes.
+ */
class ResourceAttributes::iterator: public std::iterator< std::forward_iterator_tag,
ResourceAttributes::KeyValuePair >
{
friend class ResourceAttributes;
};
-
- class ResourceAttributes::const_iterator: public std::iterator< std::forward_iterator_tag,
+ /**
+ * This class is an Const Iterator for the ResourceAttributes.
+ */
+ class ResourceAttributes::const_iterator: public std::iterator < std::forward_iterator_tag,
const ResourceAttributes::KeyValuePair >
{
private:
/**
* @file
*
- * This file contains the resource client APIs provided to the developers
+ * This file contains the Resource Client APIs provided to the developers.
+ * It is a common API layer for the Resource Broker and Resource Cache module of Resource
+ * Manipulation layer.
*/
#ifndef RESOURCE_CLIENT_H_
class RemoteResourceObject;
/**
- * @class BadRequestException
- * @brief It is used to throw exception to the upper layer if request is invalid.
- * This class inherited from PrimitiveException class.
+ * @class BadRequestException
+ * @brief This class is used to throw exception to the upper layer if request is invalid.
+ * It is inherited from RCSException class.
*
*/
class BadRequestException: public RCSException
{
public:
- BadRequestException(const std::string &what) : RCSException{ what } {}
- BadRequestException(std::string &&what) : RCSException{ std::move(what) } {}
+ BadRequestException(const std::string &what) : RCSException { what } {}
+ BadRequestException(std::string &&what) : RCSException { std::move(what) } {}
};
/**
* @class InvalidParameterException
- * @brief It is used to throw exception to the upper layer if parameter is invalid.
- * This class inherited from PrimitiveException class.
+ * @brief This class is used to throw exception to the upper layer if parameter is invalid.
+ * It is inherited from RCSException class.
*/
class InvalidParameterException: public RCSException
{
public:
- InvalidParameterException(const std::string &what) : RCSException{ what } {}
+ InvalidParameterException(const std::string &what) : RCSException { what } {}
InvalidParameterException(std::string &&what) : RCSException{ std::move(what) } {}
};
/**
* @class RemoteResourceObject
- * @brief It is an interaction point between Resource
- * and the developers.
+ * @brief This class is an interaction point between Resource
+ * and the developers. Developer will get the RemoteResourceObject by calling the
+ * discoverResource() API of "DiscoveryManager" class.
+ *
+ * @see DiscoveryManager
*
*/
class RemoteResourceObject
/**
* Typedef for callback of startWatching API
+ *
+ * @see ResourceState
*/
typedef std::function< void(ResourceState) > ResourceStateChangedCallback;
/**
* Typedef for callback of startCaching API
+ *
+ * @see ResourceAttributes
*/
typedef std::function< void(const ResourceAttributes &) > CacheUpdatedCallback;
/**
* Typedef for callback of getRemoteAttributes API
+ *
+ * @see ResourceAttributes
*/
typedef std::function< void(const ResourceAttributes &) >
RemoteAttributesReceivedCallback;
/**
* Typedef for callback of setRemoteAttributes API
+ *
+ * @see ResourceAttributes
*/
typedef std::function< void(const ResourceAttributes &) >
RemoteAttributesSetCallback;
/**
- * API to get watching state.
+ * Check current watching state.
+ *
+ * @details This API checks the current watching state for the resource of interest.
*
- * @return bool - watching or not.
+ * @return bool - true if Watching otherwise false.
*/
bool isWatching() const;
/**
- * API to get Caching state.
+ * Check current Caching state.
*
- * @return bool - caching or not.
+ * @details This API checks the current caching state for the resource of interest.
+ *
+ * @return bool - true if Caching started otherwise false.
*/
+
bool isCaching() const;
/**
- * API to get observable state.
+ * Check whether reosurce is observable or not.
*
- * @return bool - observable or not.
+ * @details This API checks the observable property of the resource.
+ *
+ * @return bool - true if observable otherwise false.
*/
bool isObservable() const;
/**
- * API to start watching the resource.
+ * Start watching the resource.
+ *
+ * @details This API will start monitoring the resource of interest.
+ * Once this API is called it will check whether the particular resource
+ * is available or not. It will provide the changed resource state in the callback.
*
- * @param ResourceStateChangedCallback - callback to get changed resource state.
+ * @param cb - callback to get changed resource state.
*
* @throw InvalidParameterException
*
+ * @see ResourceStateChangedCallback
+ * @see ResourceState
+ *
+ * NOTE: Developer can call this API any number of time. Developer should take care
+ * of Synchronization as ResourceStateChangedCallback is asynchronous.
+ * This function throws the InvalidParameterException if the callback is NULL or not valid.
*/
void startMonitoring(ResourceStateChangedCallback cb);
/**
- * API to stop watching the resource.
+ * Stop monitoring the resource.
+ *
+ * @details This API will stop monitoring the resource of interest it means it will stop to look
+ * for the resource presence in the network.
+ *
+ * NOTE: If startMonitoring() is not being called & directly this API is called it will do nothing.
+ * Developer can call this API any number of time. It will not results in any kind of warning.
+ *
*/
void stopMonitoring();
/**
- * API to get resource state.
+ * Provides the current resource state. Resource state is an enum class.
*
* @return ResourceState - current state of the resource.
+ *
+ * @see ResourceState
*/
ResourceState getState() const ;
/**
- * API to start caching for the resource.
- */
+ * Start caching data for the resource of interest.
+ *
+ * @details This API will start data caching for the resource of interest.
+ * Once caching started it will look for the data updation on the resource of interest
+ * & updates the cache data accordingly. It provides the cached data on demand.
+ *
+ * @see getCachedAttributes()
+ * @see getCachedAttribute( const std::string &)
+ *
+ * NOTE: developer can get the cached data by calling getCachedAttributes()
+ * or getCachedAttribute() API
+ */
void startCaching();
/**
- * API to start caching data of the resource.
+ * Start caching data for the resource of interest.
*
- * @param CacheUpdatedCallback - callback to get updated resourceAttributes.
+ * @details This API will start data caching for the resource of interest.
+ * Once caching started it look for the data updation on the resource of interest &
+ * updates the cached data accordingly Whenever data is updated in the cache, it
+ * provides the updated data to the application/caller.
*
- * @throw InvalidParameterException
+ * @param cb - callback to get updated resourceAttributes.
+ *
+ * @see CacheUpdatedCallback
+ *
+ * NOTE: Developer can call this API any number of time. Developer should
+ * take care of Synchronization as CacheUpdatedCallback is asynchronous.
+ * This function throws the InvalidParameterException if the callback is NULL or not valid.
*
*/
- void startCaching(CacheUpdatedCallback);
+ void startCaching(CacheUpdatedCallback cb);
/**
- * API to get the cache State of the resource
+ * Provides the current cache state for the resource of interest. CacheState is the enum class.
*
* @return CacheState - Current state of the Cache.
+ *
+ * @see CacheState
+ *
*/
CacheState getResourceCacheState();
/**
- * API to stop caching the data for the resource
- */
+ * Stop data caching for the resource of interest.
+ *
+ * @details This API will stop caching the data for the resource of interest.
+ *
+ * NOTE: If startCaching() or startCaching(CacheUpdatedCallback) is not being called &
+ * directly this API is called it will do nothing.
+ * Developer can call this API any number of time, it will not results in any warning.
+ *
+ */
void stopCaching();
/**
- * API to refresh the cache explicitly.
- */
+ * Refresh the cache.
+ *
+ * @details This API will refresh the cache, i.e. it will get the latest data from the server.
+ *
+ */
void refreshCache() ;
/**
- * API to get cached ResourceAttributes data.
+ * Get the cached ResourceAttributes data.
+ *
+ * @pre startCaching() or startCaching(CacheUpdatedCallback) API should be called.
*
- * @return ResourceAttributes - cached ResourceAttributes data
+ * @return ResourceAttributes - cached resourceAttribute
*
* @throw BadRequestException
*
+ * @see startCaching()
+ * @see startCaching(CacheUpdatedCallback)
+ * @see ResourceAttributes
+ *
+ * NOTE: If startCaching() or startCaching(CacheUpdatedCallback) is not being called &
+ * directly this API is called it will throw the
+ * BadRequestException.
*/
ResourceAttributes getCachedAttributes() const;
/**
- * API to get particular cached ResourceAttribute value
- *
- * @return Value - ResourceAttributes::Value class object
- *
- * @throw BadRequestException
- *
- */
+ * Get a particular cached ResourceAttribute value.
+ *
+ * @pre startCaching() or startCaching(CacheUpdatedCallback) API should be called.
+ *
+ * @return ResourceAttributes::Value - requested attribute Value
+ *
+ * @throw BadRequestException
+ *
+ * @see startCaching()
+ * @see startCaching(CacheUpdatedCallback)
+ * @see ResourceAttributes::Value
+ *
+ * NOTE: If startCaching() or startCaching(CacheUpdatedCallback) is not being called &
+ * directly this API is called it will throw the BadRequestException.
+ *
+ */
ResourceAttributes::Value getCachedAttribute( const std::string &) ;
/**
- * API to get current resource attributes data.
- *
- * @param RemoteAttributesReceivedCallback - callback to get resourceAttributes data.
- *
- */
- void getRemoteAttributes(RemoteAttributesReceivedCallback);
+ * Get resource attributes.
+ *
+ * @details This API send a get request to the resource of interest and provides the attributes
+ * to the caller in the RemoteAttributesReceivedCallback.
+ *
+ * @see ResourceAttributes::Value
+ */
+ void getRemoteAttributes(RemoteAttributesReceivedCallback cb);
/**
- * API to set resource attributes data.
- *
- * @param ResourceAttributes - resourceAttributes data to set
- * @param RemoteAttributesSetCallback - callback on setting resourceAttributes data.
- *
- */
- void setRemoteAttributes(ResourceAttributes &, RemoteAttributesSetCallback );
+ * Set resource attributes.
+ *
+ * @details This API send a set request to the resource of interest and provides the updated
+ * attributes to the caller in the RemoteAttributesSetCallback.
+ *
+ * @param attributes - resourceAttributes data to set
+ * @param cb - callback on setting resourceAttributes data.
+ *
+ */
+ void setRemoteAttributes(ResourceAttributes &attributes, RemoteAttributesSetCallback cb);
/**
- * API to get resource uri.
+ * Get resource uri.
*
* @return string - uri of the Resource
*/
std::string getUri() const;
/**
- * API to get resource address.
+ * Get resource address.
*
* @return string - address of the Resource
*/
std::string getAddress() const;
/**
- * API to get resource types.
+ * Get resource types.
*
* @return vector - resource types
*/
std::vector< std::string > getTypes() const;
/**
- * API to get resource interfaces.
+ * Get resource interfaces.
*
* @return vector - resource interfaces
*/
/**
* @class DiscoveryManager
- * @brief It contains the resource discovery method.
+ * @brief This class contains the resource discovery method.
*
*/
class DiscoveryManager
OnResourceDiscoveredCallback;
/**
- * API to get DiscoveryManager instance.
+ * API for getting DiscoveryManager instance.
*
- * @return DiscoveryManager -instance.
+ * @return DiscoveryManager - Instance of DiscoveryManager class
*/
static DiscoveryManager *getInstance();
/**
- * API for discovey of resource of Interest.
+ * API for discovering the resource of Interest.
*
* @param host - host of the Resource
* @param resourceURI - uri of resource to be searched
* @param connectivityType - connection type
- * @param cb - callback to obtain discovered resource.
+ * @param cb - callback to obtain discovered resource
*
- * @throw InvalidParameterException
+ * @throw InvalidParameterException : This API throws the InvalidParameterException if any of
+ * the parameter is invalid.
*
*/
void discoverResource(std::string host, std::string resourceURI,
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/**
+ * @file
+ *
+ * This file contains the resource container APIs provided to the developers.
+ */
+
#ifndef RESOURCECONTAINER_H_
#define RESOURCECONTAINER_H_
{
namespace Service
{
+
+ /**
+ * @class ResourceContainer
+ * @brief This class provides APIs for managing the container and bundles in the container.
+ *
+ */
class ResourceContainer
{
public:
+ /**
+ * Constructor
+ */
ResourceContainer();
+
+ /**
+ *virtual Destructor
+ */
virtual ~ResourceContainer();
+
+ /**
+ * API for starting the Container
+ *
+ * @details This API start the container with the provided Configuration file.
+ *
+ * @param configFile - configuration File that contains the Bundle/Bundles information.
+ *
+ */
virtual void startContainer(std::string configFile) = 0;
+ /**
+ * API for stopping the Container
+ */
virtual void stopContainer() = 0;
// list of bundle ids
+ /**
+ * API for getting the list of all bundles in the container
+ *
+ * @return list<BundleInfo*> -List of BundleInfo pointer each associated with a bundle
+ *
+ */
virtual std::list<BundleInfo *> listBundles() = 0;
+ /**
+ * API for starting the bundle.
+ *
+ * @param bundleId - Id of the Bundle
+ *
+ */
virtual void startBundle(std::string bundleId) = 0;
+ /**
+ * API for Stopping the bundle
+ *
+ * @param bundleId - Id of the Bundle
+ *
+ */
virtual void stopBundle(std::string bundleId) = 0;
// dynamic configuration
+ /**
+ * API for adding the bundle to the Container
+ *
+ * @param bundleId - Id of the Bundle
+ * @param bundleUri - Uri of the bundle
+ * @param bundlePath - Path of the bundle
+ * @param params - key-value pairs in string form for other Bundle parameters
+ *
+ */
virtual void addBundle(std::string bundleId, std::string bundleUri, std::string bundlePath,
std::map<std::string, std::string> params) = 0;
+ /**
+ * API for removing the bundle from the container
+ *
+ * @param bundleId - Id of the Bundle
+ *
+ */
virtual void removeBundle(std::string bundleId) = 0;
+ /**
+ * API for adding the Resource configuration information to the bundle
+ *
+ * @param bundleId - Id of the Bundle
+ * @param resourceUri - URI of the resource
+ * @param params - key-value pairs in string form for other Bundle parameters
+ *
+ */
virtual void addResourceConfig(std::string bundleId, std::string resourceUri,
std::map<std::string, std::string> params) = 0;
+ /**
+ * API for removing the Resource configuration information from the bundle
+ *
+ * @param bundleId - Id of the Bundle
+ * @param resourceUri - URI of the resource
+ *
+ */
virtual void removeResourceConfig(std::string bundleId, std::string resourceUri) = 0;
+ /**
+ * API for getting the list of Bundle Resources
+ *
+ * @param bundleId - Id of the Bundle
+ *
+ */
virtual std::list<std::string> listBundleResources(std::string bundleId) = 0;
+ /**
+ * API for getting the Instance of ResourceContainer class
+ *
+ * @return ResourceContainer - Instance of the "ResourceContainer" class
+ *
+ */
static ResourceContainer *getInstance();
};
}
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/**
+ * @file
+ *
+ * This file contains the resource object APIs provided to the developers.
+ * ResourceObject is a part of the server builder module.
+ */
#ifndef SERVERBUILDER_RESOURCEOBJECT_H
#define SERVERBUILDER_RESOURCEOBJECT_H
namespace OC
{
+ /**
+ * Forward declaration
+ */
class OCResourceRequest;
}
namespace Service
{
+ /**
+ * @class NoLockException
+ * @brief This class is used to throw exception to the upper layer if lock has not been acquired.
+ * It is inherited from PrimitiveException class.
+ *
+ */
class NoLockException: public RCSException
{
- public:
- NoLockException(std::string&& what) : RCSException{ std::move(what) } {}
+ public:
+ NoLockException(std::string &&what) : RCSException { std::move(what) } {}
};
+ /**
+ * @class ResourceObject
+ * @brief This class provides APIs and subclasses for creation of resource(s), setting and getting
+ * resource properties and attributes, and for handling of requests.
+ * It provides resource locking feature for synchronized operations. On creating a resouce
+ * using the build() API, the developer gets a ResourceObject pointer
+ *
+ *@see build()
+ */
class ResourceObject
{
- private:
- class WeakGuard;
+ private:
+ class WeakGuard;
- public:
- enum class AutoNotifyPolicy {
- NEVER,
- ALWAYS,
- UPDATED
- };
-
- enum class SetRequestHandlerPolicy {
- NEVER,
- ACCEPTANCE
- };
-
- typedef std::shared_ptr< ResourceObject > Ptr;
- typedef std::shared_ptr< const ResourceObject > ConstPtr;
-
- class Builder
- {
public:
- Builder(const std::string& uri, const std::string& type,
- const std::string& interface);
-
- Builder& setDiscoverable(bool discoverable);
- Builder& setObservable(bool observable);
-
- Builder& setAttributes(const ResourceAttributes&);
- Builder& setAttributes(ResourceAttributes&&);
/**
- * @throw PlatformException
- */
- ResourceObject::Ptr build();
+ * enum class contains the different Auto notify policy
+ */
+ enum class AutoNotifyPolicy
+ {
+ NEVER,
+ ALWAYS,
+ UPDATED
+ };
- private:
- std::string m_uri;
- std::string m_type;
- std::string m_interface;
-
- uint8_t m_properties;
+ /**
+ * enum class contains the different Request Handler policies
+ */
+ enum class SetRequestHandlerPolicy
+ {
+ NEVER,
+ ACCEPTANCE
+ };
- ResourceAttributes m_resourceAttributes;
- };
+ /**
+ * declaring member as a shared pointer to object of own class.
+ */
+ typedef std::shared_ptr< ResourceObject > Ptr;
+ /**
+ * declaring member as a shared pointer to constant object of own class.
+ */
+ typedef std::shared_ptr< const ResourceObject > ConstPtr;
- class LockGuard;
+ /**
+ * @class Builder
+ * @brief This class provides APIs for resource creation, setting properties & attributes for the
+ * constructed resource. It is a subclass of ResourceObject. It provides the build() API
+ * which builds a resource and return pointer to ResourceObject class.
+ *
+ *@see build()
+ */
+ class Builder
+ {
+ public:
+ /**
+ * @brief Constructor.
+ * Sets the resource property values using initializers list.
+ *
+ * @param uri - Resource URI value to be set
+ * @param type - Resource type value to be set
+ * @param interface - Interface value to be set
+ *
+ *NOTE : m_properties value is by default set to OC_DISCOVERABLE | OC_OBSERVABLE.
+ * OC_DISCOVERABLE and OC_OBSERVABLE are defined in octypes.h.
+ */
+ Builder(const std::string &uri, const std::string &type,
+ const std::string &interface);
+
+ /**
+ * Sets the discoverable(OC_DISCOVERABLE) property for the resource.
+ *
+ * @param discoverable - true or false
+ *
+ * @return Builder& -reference of the builder class
+ *
+ *NOTE : OC_DISCOVERABLE is defined in octypes.h
+ */
+ Builder &setDiscoverable(bool discoverable);
+ /**
+ * Sets the observable(OC_OBSERVABLE) property of the resource.
+ *
+ * @param observable - true or false
+ *
+ * @return Builder& - reference of the builder class
+ *
+ *NOTE : OC_DISCOVERABLE is defined in octypes.h
+ */
+ Builder &setObservable(bool observable);
+
+ /**
+ * Sets attribute of the resource.
+ *
+ * @param attributes - Resource attributes to set
+ *
+ * @return Builder& - reference of the builder class
+ */
+ Builder &setAttributes(const ResourceAttributes &attributes);
+ /**
+ * API for setting attributes of the resource.
+ *
+ * @param attributes - Resource Attributes to set
+ *
+ * @return Builder& - reference of the builder class
+ */
+ Builder &setAttributes(ResourceAttributes &&attributes);
+
+ /**
+ * API for constructing a new resource.
+ * It internally invokes the ResourceObject constructor to create a
+ * new ResourceObject instance. It also binds an entity handler to the ResourceObject created.
+ * Then it registers a resource with set properties to obtain a resource handle.
+ * This handle is set as the handle of ResourceObject created.
+ * On successful execution the pointer to this object is returned.
+ *
+ * @return ResourceObject::Ptr - Pointer to ResourceObject instance created.
+ *
+ * @throw PlatformException
+ * It catches exception from registerResource API of OCPlatform and throws it to developer.
+ *
+ */
+ ResourceObject::Ptr build();
+
+ private:
+
+ /**
+ * Resource URI.
+ */
+ std::string m_uri;
+
+ /**
+ * Resource type.
+ */
+ std::string m_type;
+
+ /**
+ * Resource interface.
+ */
+ std::string m_interface;
+
+ /**
+ * Resource property.
+ */
+ uint8_t m_properties;
+
+ /**
+ * Attributes of the resource.
+ */
+ ResourceAttributes m_resourceAttributes;
+ };
+
+ class LockGuard;
- typedef std::function< RCSGetResponse(const RCSRequest&,
- ResourceAttributes&) > GetRequestHandler;
- typedef std::function< RCSSetResponse(const RCSRequest&,
- ResourceAttributes&) > SetRequestHandler;
- typedef std::function< void(const ResourceAttributes::Value&,
- const ResourceAttributes::Value&) > AttributeUpdatedListener;
+ /**
+ * Request handler for get requests
+ */
+ typedef std::function < RCSGetResponse(const RCSRequest &,
+ ResourceAttributes &) > GetRequestHandler;
+ /**
+ * Request handler for set requests
+ */
+ typedef std::function < RCSSetResponse(const RCSRequest &,
+ ResourceAttributes &) > SetRequestHandler;
+ /**
+ * Listener for update of attribute
+ */
+ typedef std::function < void(const ResourceAttributes::Value &,
+ const ResourceAttributes::Value &) > AttributeUpdatedListener;
- public:
- ResourceObject(ResourceObject&&) = delete;
- ResourceObject(const ResourceObject&) = delete;
+ public:
+ /**
+ * Constructor
+ */
+ ResourceObject(ResourceObject&&) = delete;
+ ResourceObject(const ResourceObject &) = delete;
- ResourceObject& operator=(ResourceObject&&) = delete;
- ResourceObject& operator=(const ResourceObject&) = delete;
+ /**
+ * overloading = operator
+ */
+ ResourceObject &operator=(ResourceObject && ) = delete;
+ ResourceObject &operator=(const ResourceObject &) = delete;
- virtual ~ResourceObject();
+ /**
+ * Virtual destructor.
+ */
+ virtual ~ResourceObject();
- void setAttribute(const std::string& key, const ResourceAttributes::Value&);
- void setAttribute(const std::string& key, ResourceAttributes::Value&&);
+ /**
+ * API for setting a particular attribute value.
+ * It uses mutex to invoke autoNotifyIfNeeded on updating the value. This notifies all observers
+ * with updated attributes value as per the notification policy(AutoNotifyPolicy).
+ *
+ * @param key - name of attribute(used to map the attribute value).
+ *
+ * @param value - attribute value to be mapped against the key.
+ *
+ *NOTE : AutoNotifyPolicy enum class is defined in ResourceObject class.
+ */
+ void setAttribute(const std::string &key, const ResourceAttributes::Value & value);
+ /**
+ * API for setting a particular attribute value.
+ * It uses mutex to invoke autoNotifyIfNeeded on updating the value. This notifies all observers
+ * with updated attributes value as per the notification policy(AutoNotifyPolicy).
+ *
+ * @param key - name of attribute(used to map the attribute value).
+ *
+ * @param value - attribute value to be mapped against the key.
+ *
+ *NOTE : AutoNotifyPolicy enum class is defined in ResourceObject class.
+ */
+ void setAttribute(const std::string &key, ResourceAttributes::Value&& value);
- void setAttribute(std::string&& key, const ResourceAttributes::Value&);
- void setAttribute(std::string&& key, ResourceAttributes::Value&&);
+ /**
+ * API for setting a particular attribute value.
+ * It uses mutex to invoke autoNotifyIfNeeded on updating the value. This notifies all observers
+ * with updated attributes value as per the notification policy(AutoNotifyPolicy).
+ *
+ * @param key - name of attribute(used to map the attribute value).
+ *
+ * @param value - attribute value to be mapped against the key.
+ *
+ *NOTE : AutoNotifyPolicy enum class is defined in ResourceObject class.
+ */
+ void setAttribute(std::string&& key, const ResourceAttributes::Value & value);
+ /**
+ * API for setting a particular attribute value.
+ * It uses mutex to invoke autoNotifyIfNeeded on updating the value. This notifies all observers
+ * with updated attributes value as per the notification policy(AutoNotifyPolicy).
+ *
+ * @param key - name of attribute(used to map the attribute value).
+ *
+ * @param value - attribute value to be mapped against the key.
+ *
+ *NOTE : AutoNotifyPolicy enum class is defined in ResourceObject class.
+ */
+ void setAttribute(std::string&& key, ResourceAttributes::Value&& value);
- ResourceAttributes::Value getAttributeValue(const std::string& key) const;
+ /**
+ * API for getting attribute value corresponding to a key(name of that attribute). Uses mutex.
+ *
+ *@param key - name of the attribute value to look for.
+ *
+ * @return ResourceAttributes::Value -value of the resource attribute.
+ *
+ */
+ ResourceAttributes::Value getAttributeValue(const std::string &key) const;
- template< typename T >
- T getAttribute(const std::string& key) const
- {
- WeakGuard lock(*this);
- return m_resourceAttributes.at(key).get< T >();
- }
+ /**
+ * API for retrieving the attribute value associated with the supplied name. Uses mutex.
+ *
+ * @param key - Name of the attribute
+ *
+ * @return typename - resource attributes value.
+ */
+ template< typename T >
+ T getAttribute(const std::string &key) const
+ {
+ WeakGuard lock(*this);
+ return m_resourceAttributes.at(key).get< T >();
+ }
- bool removeAttribute(const std::string& key);
+ /**
+ * API for removing a particular attribute of the resource.
+ * Uses mutex.
+ *
+ * @param key - Name of the attribute.
+ *
+ * @return bool - true or false
+ *
+ */
+ bool removeAttribute(const std::string &key);
- bool containsAttribute(const std::string& key) const;
+ /**
+ * API for checking whether a particular attribute is there for a resource or not.
+ *
+ * @param key - Name of the attribute.
+ *
+ * @return bool - true or false.
+ *
+ */
+ bool containsAttribute(const std::string &key) const;
- ResourceAttributes& getAttributes();
- const ResourceAttributes& getAttributes() const;
+ /**
+ * API for getting all the attributes of the resource.
+ * It invokes the expectOwnLock() API to check the owner of the lock using the thread id.
+ * If it is not the owner then it throws exception.
+ *
+ * @return ResourceAttributes& - reference of the attributes of the resource.
+ *
+ *@see expectOwnLock()
+ *
+ * @throw NoLockException
+ * It catches exception thrown from expectOwnLock() API and throws it to the developer.
+ */
+ ResourceAttributes &getAttributes();
+ /**
+ * API for getting all the attributes of the resource.
+ * It invokes the expectOwnLock() API to check the owner of the lock using the thread id.
+ * If it is not the owner then it throws exception.
+ *
+ * @return ResourceAttributes& - reference of the attributes of the resource.
+ *
+ *@see expectOwnLock()
+ *
+ * @throw NoLockException
+ * It catches exception thrown from expectOwnLock() API and throws it to the developer.
+ */
+ const ResourceAttributes &getAttributes() const;
- virtual bool isObservable() const;
- virtual bool isDiscoverable() const;
+ /**
+ * API for checking whether the particular resource is observable or not
+ *
+ * @return bool - true or false.
+ *
+ */
+ virtual bool isObservable() const;
+ /**
+ * API for checking whether the particular resource is discoverable or not
+ *
+ * @return bool - true or false.
+ *
+ */
+ virtual bool isDiscoverable() const;
- virtual void setGetRequestHandler(GetRequestHandler);
- virtual void setSetRequestHandler(SetRequestHandler);
+ /**
+ * API for setting the resource's get request handler by the developer/application.
+ * If developer set this handler then all get request will come to the application & developer can
+ * send the response to the client using APIs of RCSGetResponse class.
+ *
+ * @param handler - Request handler for get requests
+ *
+ * @see RCSGetResponse
+ *
+ */
+ virtual void setGetRequestHandler(GetRequestHandler handler);
+ /**
+ * API for setting the resource's set request handler by the developer/application.
+ * If developer set this handler then all set request for the resource will come to the application
+ * & developer can send the response to the client using APIs of RCSSetResponse class.
+ *
+ * @param handler - Request handler for set requests
+ *
+ * @see RCSSetResponse
+ *
+ */
+ virtual void setSetRequestHandler(SetRequestHandler handler);
- virtual void addAttributeUpdatedListener(const std::string& key,
- AttributeUpdatedListener );
- virtual void addAttributeUpdatedListener(std::string&& key, AttributeUpdatedListener);
- virtual bool removeAttributeUpdatedListener(const std::string& key);
+ /**
+ * API for setting the Listener for a particular attribute update.
+ *
+ * @param key - The intersted attribute's key
+ * @param listener - Listener for updation of the interested attribute
+ *
+ */
+ virtual void addAttributeUpdatedListener(const std::string &key,
+ AttributeUpdatedListener listener);
+ /**
+ * API for setting the Listener for a particular attribute update.
+ *
+ * @param key - The intersted attribute's key
+ * @param listener - Listener for updation of the interested attribute
+ *
+ */
+ virtual void addAttributeUpdatedListener(std::string &&key, AttributeUpdatedListener listener);
+ /**
+ * API for removing the handler for a particular attribute update.
+ *
+ * @param key - The intersted attribute's key
+ *
+ */
+ virtual bool removeAttributeUpdatedListener(const std::string &key);
+ /**
+ * API for notifying all observers of the resource with the updated attributes value
+ */
+ virtual void notify() const;
- virtual void notify() const;
+ /**
+ * API for setting Auto notify policy
+ *
+ * @param policy - Policy to be set
+ *
+ * Note: AutoNotifyPolicy is an enum class
+ *
+ * @see AutoNotifyPolicy
+ *
+ */
+ void setAutoNotifyPolicy(AutoNotifyPolicy policy);
+ /**
+ * API for getting auto notify policy
+ *
+ * @returns AutoNotifyPolicy - AntoNotify policy
+ *
+ * Note: AutoNotifyPolicy is an enum class
+ *
+ * @see AutoNotifyPolicy
+ */
+ AutoNotifyPolicy getAutoNotifyPolicy() const;
- void setAutoNotifyPolicy(AutoNotifyPolicy);
- AutoNotifyPolicy getAutoNotifyPolicy() const;
+ /**
+ * API for setting the policy for a setRequestHandler.
+ *
+ * @param policy - policy to be set
+ *
+ * @see SetRequestHandlerPolicy
+ *
+ * Note: SetRequestHandlerPolicy is the enum class with two values : DEFAULT & ACCEPTANCE
+ *
+ */
+ void setSetRequestHandlerPolicy(SetRequestHandlerPolicy policy);
- void setSetRequestHandlerPolicy(SetRequestHandlerPolicy);
- SetRequestHandlerPolicy getSetRequestHandlerPolicy() const;
+ /**
+ * API for getting the SetRequestHandler Policy.
+ *
+ * @returns SetRequestHandlerPolicy - Property of setRequesthandler
+ *
+ * @see SetRequestHandlerPolicy
+ *
+ * Note: SetRequestHandlerPolicy is the enum class with two values : DEFAULT & ACCEPTANCE
+ *
+ */
+ SetRequestHandlerPolicy getSetRequestHandlerPolicy() const;
private:
ResourceObject(uint8_t, ResourceAttributes&&);
std::mutex m_mutexKeyAttributeUpdate;
};
-
+ /**
+ * This class enables mutex functionality for the ResourceObject instances.
+ */
class ResourceObject::LockGuard
{
public:
std::function<void()> m_autoNotifyFunc;
};
-
+ /**
+ * This class manages weak guard for the ResourceObject.
+ */
class ResourceObject::WeakGuard
{
public: