Prefix is added for consistency for exposed headers.
Change-Id: I4b038fe5fdd79bfbc6d5b8963491332a180b77a4
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1893
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
}
}
-void HostingObject::dataChangedCB(const ResourceAttributes & attributes, RemoteObjectPtr rObject)
+void HostingObject::dataChangedCB(const RCSResourceAttributes & attributes, RemoteObjectPtr rObject)
{
if(attributes.empty())
{
}
}
- ResourceAttributes rData;
+ RCSResourceAttributes rData;
{
RCSResourceObject::LockGuard guard(mirroredServer);
rData = mirroredServer->getAttributes();
}
RCSSetResponse HostingObject::setRequestHandler(const RCSRequest & primitiveRequest,
- ResourceAttributes & resourceAttibutes)
+ RCSResourceAttributes & resourceAttibutes)
{
try
{
typedef std::shared_ptr<PrimitiveResource> PrimiteveResourcePtr;
typedef std::function<void(ResourceState)> BrokerCallback;
- typedef std::function<void(const ResourceAttributes &)> CacheCallback;
+ typedef std::function<void(const RCSResourceAttributes &)> CacheCallback;
typedef std::function<void()> DestroyedCallback;
typedef std::function<
- RCSSetResponse(const RCSRequest&, ResourceAttributes&)> SetRequestHandler;
+ RCSSetResponse(const RCSRequest&, RCSResourceAttributes&)> SetRequestHandler;
public:
HostingObject();
ResourceObjectPtr createMirroredServer(RemoteObjectPtr rObject);
void stateChangedCB(ResourceState state, RemoteObjectPtr rObject);
- void dataChangedCB(const ResourceAttributes & attributes, RemoteObjectPtr rObject);
+ void dataChangedCB(const RCSResourceAttributes & attributes, RemoteObjectPtr rObject);
RCSSetResponse setRequestHandler(
- const RCSRequest & request, ResourceAttributes & attributes);
+ const RCSRequest & request, RCSResourceAttributes & attributes);
void destroyHostingObject();
{
void RequestObject::invokeRequest(RemoteObjectPtr remoteObject, RequestMethod method,
- const RCSRequest & pRequest, ResourceAttributes & resourceAttibutes)
+ const RCSRequest & pRequest, RCSResourceAttributes & resourceAttibutes)
{
try
{
}
}
-void RequestObject::setRequestCB(const ResourceAttributes & returnedAttributes,
- ResourceAttributes & putAttibutes)
+void RequestObject::setRequestCB(const RCSResourceAttributes & returnedAttributes,
+ RCSResourceAttributes & putAttibutes)
{
if(putAttibutes != returnedAttributes)
{
~RequestObject() = default;
void invokeRequest(RemoteObjectPtr remoteObject, RequestMethod method,
- const RCSRequest & pRequest, ResourceAttributes & resourceAttibutes);
+ const RCSRequest & pRequest, RCSResourceAttributes & resourceAttibutes);
private:
- void setRequestCB(const ResourceAttributes & returnedAttributes,
- ResourceAttributes & putAttibutes);
+ void setRequestCB(const RCSResourceAttributes & returnedAttributes,
+ RCSResourceAttributes & putAttibutes);
};
} /* namespace Service */
#include<iostream>
#include "ResourceClient.h"
-#include "ResourceAttributes.h"
+#include "RCSResourceAttributes.h"
#include "OCPlatform.h"
using namespace std;
using namespace OIC::Service;
std::shared_ptr<RemoteResourceObject> resource;
-ResourceAttributes resourceAttributes;
+RCSResourceAttributes resourceAttributes;
bool startCachingFlag;
bool isReady;
}
//callback for startCaching() [uptodate]
-void OnCacheUpdated(const ResourceAttributes atttribute )
+void OnCacheUpdated(const RCSResourceAttributes atttribute )
{
cout << "\nOnCacheUpdated callback" << std::endl;
if (atttribute.empty())
}
else
{
- ResourceAttributes::const_iterator iter = atttribute.begin();
+ RCSResourceAttributes::const_iterator iter = atttribute.begin();
for (unsigned int i = 0; i < atttribute.size(); ++i)
{
std::cout << "key : " << iter->key() << "\nvalue : " << iter->value().toString() << std::endl;
}
//callback for getRemoteAttributes()
-void OnRemoteAttributesReceivedCallback(const ResourceAttributes &atttribute)
+void OnRemoteAttributesReceivedCallback(const RCSResourceAttributes &atttribute)
{
std::cout << "\nOnRemoteAttributesReceivedCallback callback" << std::endl;
else
{
resourceAttributes = atttribute;
- ResourceAttributes::const_iterator iter = atttribute.begin();
+ RCSResourceAttributes::const_iterator iter = atttribute.begin();
for (unsigned int i = 0; i < atttribute.size(); ++i)
{
std::cout << "key : " << iter->key() << "\nvalue : " << iter->value().toString() << std::endl;
}
//callback for setRemoteAttributes()
-void OnRemoteAttributesSetCallback(const ResourceAttributes &atttribute)
+void OnRemoteAttributesSetCallback(const RCSResourceAttributes &atttribute)
{
std::cout << "\nOnRemoteAttributesSetCallback callback" << std::endl;
else
{
resourceAttributes = atttribute;
- ResourceAttributes::const_iterator iter = atttribute.begin();
+ RCSResourceAttributes::const_iterator iter = atttribute.begin();
for (unsigned int i = 0; i < atttribute.size(); ++i)
{
std::cout << "key : " << iter->key() << "\nvalue : " << iter->value().toString() << std::endl;
}
else
{
- ResourceAttributes::const_iterator iter = resourceAttributes.begin();
+ RCSResourceAttributes::const_iterator iter = resourceAttributes.begin();
for (unsigned int i = 0; i < resourceAttributes.size(); ++i)
{
if ( iter->key() == "Temperature")
{
try
{
- ResourceAttributes atttribute = resource->getCachedAttributes();
+ RCSResourceAttributes atttribute = resource->getCachedAttributes();
if (atttribute.empty())
{
cout << "Received cached attribute is empty" << std::endl;
}
else
{
- ResourceAttributes::const_iterator iter = atttribute.begin();
+ RCSResourceAttributes::const_iterator iter = atttribute.begin();
for (unsigned int i = 0; i < atttribute.size(); ++i)
{
std::cout << "\nkey : " << iter->key() << "\nvalue : " << iter->value().toString() << std::endl;
std::string key = "Temperature";
try
{
- ResourceAttributes::Value valueObj = resource->getCachedAttribute(key);
+ RCSResourceAttributes::Value valueObj = resource->getCachedAttribute(key);
int value = valueObj.get< int >();
cout << "\nkey : " << key << "\nValue : " << value << std::endl;
}
//hander for get request (if developer choose second option for resource Creation)
RCSGetResponse RequestHandlerForGet(const RCSRequest &request,
- ResourceAttributes &attrs)
+ RCSResourceAttributes &attrs)
{
cout << "Recieved a Get request from Client" << std::endl;
RCSResourceObject::LockGuard lock(*server);
- ResourceAttributes attr = server->getAttributes();
- ResourceAttributes::const_iterator iter = attr.begin();
+ RCSResourceAttributes attr = server->getAttributes();
+ RCSResourceAttributes::const_iterator iter = attr.begin();
cout << "\nSending response to Client : " << std::endl;
for (unsigned int i = 0; i < attr.size(); ++i)
{
//hander for set request (if developer choose second option for resource Creation)
RCSSetResponse RequestHandlerForSet(const RCSRequest &request,
- ResourceAttributes &attrs)
+ RCSResourceAttributes &attrs)
{
cout << "Recieved a Set request from Client" << std::endl;
- ResourceAttributes::const_iterator iter = attrs.begin();
+ RCSResourceAttributes::const_iterator iter = attrs.begin();
for (unsigned int i = 0; i < attrs.size(); ++i)
{
std::cout << "\tkey : " << iter->key() << "\n\tvalue : " << iter->value().toString() << std::endl;
case 1:
{
RCSResourceObject::LockGuard lock(*server);
- ResourceAttributes attrs = server->getAttributes();
+ RCSResourceAttributes attrs = server->getAttributes();
attrs[attributeKey] = (server->getAttribute<int>(attributeKey) + 10);
server->setAttribute(attributeKey, attrs[attributeKey]);
//getting the current attribute and priniting it on the console
attrs = server->getAttributes();
cout << "\nCurrent Temperature : ";
- ResourceAttributes::const_iterator iter = attrs.begin();
+ RCSResourceAttributes::const_iterator iter = attrs.begin();
for (unsigned int i = 0; i < attrs.size(); ++i)
{
std::cout << iter->value().toString() << std::endl;
case 2:
{
RCSResourceObject::LockGuard lock(*server);
- ResourceAttributes attrs = server->getAttributes();
+ RCSResourceAttributes attrs = server->getAttributes();
attrs[attributeKey] = (server->getAttribute<int>(attributeKey) - 10);
server->setAttribute(attributeKey, attrs[attributeKey]);
cout << "\nTemperature decreased by 10 degree" << endl;
//getting the current attribute and priniting it on the console
attrs = server->getAttributes();
cout << "\nCurrent Temperature : ";
- ResourceAttributes::const_iterator iter = attrs.begin();
+ RCSResourceAttributes::const_iterator iter = attrs.begin();
for (unsigned int i = 0; i < attrs.size(); ++i)
{
std::cout << iter->value().toString() << std::endl;
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#ifndef RES_ENCAPSULATION_RESOURCEATTRIBUTES_H
-#define RES_ENCAPSULATION_RESOURCEATTRIBUTES_H
+#ifndef RES_MANIPULATION_RESOURCEATTRIBUTES_H
+#define RES_MANIPULATION_RESOURCEATTRIBUTES_H
// To avoid conflict using different boost::variant configuration with OC.
// It causes compile errors.
/**
* @file
*
- * This file contains the "ResourceAttributes" class & its helper classes
+ * This file contains the "RCSResourceAttributes" class & its helper classes
*/
namespace OIC
{
};
/**
- * ResourceAttributes represents the attributes for a resource.
+ * RCSResourceAttributes represents the attributes for a resource.
*
* It provides similar usage to c++ standard containers. (iterator,
* operators and accessors)<br/>
* An attribute value can be one of various types. <br/>
*
- * @note If client developer wants to get the ResourceAttributes for the resource of
+ * @note If client developer wants to get the RCSResourceAttributes for the resource of
* interest following are the steps:
* - first call the discover API of DiscoveryManager class.
* - After getting the RemoteResourceObject, call getRemoteAttributes() API
* @see RemoteResourceObject
* @see RCSResourceObject
*/
- class ResourceAttributes
+ class RCSResourceAttributes
{
private:
template< typename T > struct IsSupportedTypeHelper;
double,
bool,
std::string,
- ResourceAttributes
+ RCSResourceAttributes
> ValueVariant;
template< typename T, typename V = void,
DOUBLE, /**< double */
BOOL, /**< bool */
STRING, /**< std::string */
- ATTRIBUTES, /**< ResourceAttributes */
+ ATTRIBUTES, /**< RCSResourceAttributes */
VECTOR /**< std::vector */
};
/**
* A Helper class to identify types of Value.
*
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
* @see Value
* @see TypeId
*/
*
* Type helps identify type information of Value.
*
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
* @see Type
* @see is_supported_type
*/
void swap(Value&);
//! @cond
- friend class ResourceAttributes;
+ friend class RCSResourceAttributes;
//! @endcond
private:
class const_iterator;
public:
- ResourceAttributes() = default;
- ResourceAttributes(const ResourceAttributes&) = default;
- ResourceAttributes(ResourceAttributes&&) = default;
+ RCSResourceAttributes() = default;
+ RCSResourceAttributes(const RCSResourceAttributes&) = default;
+ RCSResourceAttributes(RCSResourceAttributes&&) = default;
- ResourceAttributes& operator=(const ResourceAttributes&) = default;
- ResourceAttributes& operator=(ResourceAttributes&&) = default;
+ RCSResourceAttributes& operator=(const RCSResourceAttributes&) = default;
+ RCSResourceAttributes& operator=(RCSResourceAttributes&&) = default;
/**
* Returns an {@link iterator} referring to the first element.
//! @cond
friend class ResourceAttributesConverter;
- friend bool operator==(const ResourceAttributes&, const ResourceAttributes&);
+ friend bool operator==(const RCSResourceAttributes&, const RCSResourceAttributes&);
//! @endcond
};
/**
* A helper class to avoid obscure comparisons of values which are supported
- * by ResourceAttributes::Value caused by implicitly converting a value
- * to a ResourceAttributes::Value.
+ * by RCSResourceAttributes::Value caused by implicitly converting a value
+ * to a RCSResourceAttributes::Value.
*
* @see Value
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
* @see is_supported_type
*/
- class ResourceAttributes::Value::ComparisonHelper
+ class RCSResourceAttributes::Value::ComparisonHelper
{
public:
ComparisonHelper(const Value&);
};
template< typename T >
- struct ResourceAttributes::IsSupportedTypeHelper
+ struct RCSResourceAttributes::IsSupportedTypeHelper
{
typedef boost::mpl::contains<ValueVariant::types, typename std::decay< T >::type> type;
};
template <typename T>
- struct ResourceAttributes::IndexOfType
+ struct RCSResourceAttributes::IndexOfType
{
typedef typename boost::mpl::find< ValueVariant::types, T >::type iter;
typedef typename boost::mpl::begin< ValueVariant::types >::type mpl_begin;
};
/**
- * @relates ResourceAttributes::Type
+ * @relates RCSResourceAttributes::Type
*
* Checks if the objects are equal, that is, whether types are exactly same.
*
* @return true if the objects are equal, false otherwise.
*/
- bool operator==(const ResourceAttributes::Type&, const ResourceAttributes::Type&);
+ bool operator==(const RCSResourceAttributes::Type&, const RCSResourceAttributes::Type&);
/**
- * @relates ResourceAttributes::Type
+ * @relates RCSResourceAttributes::Type
*
* Checks if the objects are not equal, that is, whether types are not exactly same.
*
* @return true if the objects are not equal, false otherwise.
*/
- bool operator!=(const ResourceAttributes::Type&, const ResourceAttributes::Type&);
+ bool operator!=(const RCSResourceAttributes::Type&, const RCSResourceAttributes::Type&);
/**
- * @relates ResourceAttributes::Value
+ * @relates RCSResourceAttributes::Value
*
* Checks if the contents are equal, that is,
* whether types are matched and underlying values are equal.
*
* @return true if the contents are equal, false otherwise.
*/
- bool operator==(const ResourceAttributes::Value::ComparisonHelper&,
- const ResourceAttributes::Value::ComparisonHelper&);
+ bool operator==(const RCSResourceAttributes::Value::ComparisonHelper&,
+ const RCSResourceAttributes::Value::ComparisonHelper&);
/**
- * @relates ResourceAttributes::Value
+ * @relates RCSResourceAttributes::Value
*
* Checks if the contents are not equal, that is,
* whether types are not matched or underlying values are not equal.
*
* @return true if the contents are not equal, false otherwise.
*/
- bool operator!=(const ResourceAttributes::Value::ComparisonHelper&,
- const ResourceAttributes::Value::ComparisonHelper&);
+ bool operator!=(const RCSResourceAttributes::Value::ComparisonHelper&,
+ const RCSResourceAttributes::Value::ComparisonHelper&);
//! @cond
template< typename T >
- typename std::enable_if< ResourceAttributes::is_supported_type< T >::value ||
+ typename std::enable_if< RCSResourceAttributes::is_supported_type< T >::value ||
std::is_constructible< std::string, T >::value, bool >::type
- operator==(const ResourceAttributes::Value::ComparisonHelper& lhs, const T& rhs)
+ operator==(const RCSResourceAttributes::Value::ComparisonHelper& lhs, const T& rhs)
{
return lhs.equals(rhs);
}
template< typename T >
- typename std::enable_if< ResourceAttributes::is_supported_type< T >::value ||
+ typename std::enable_if< RCSResourceAttributes::is_supported_type< T >::value ||
std::is_constructible< std::string, T >::value, bool >::type
- operator==(const T& lhs, const ResourceAttributes::Value::ComparisonHelper& rhs)
+ operator==(const T& lhs, const RCSResourceAttributes::Value::ComparisonHelper& rhs)
{
return rhs == lhs;
}
template< typename T >
- typename std::enable_if< ResourceAttributes::is_supported_type< T >::value ||
+ typename std::enable_if< RCSResourceAttributes::is_supported_type< T >::value ||
std::is_constructible< std::string, T >::value, bool >::type
- operator!=(const ResourceAttributes::Value::ComparisonHelper& lhs, const T& rhs)
+ operator!=(const RCSResourceAttributes::Value::ComparisonHelper& lhs, const T& rhs)
{
return !(lhs == rhs);
}
template< typename T >
- typename std::enable_if< ResourceAttributes::is_supported_type< T >::value ||
+ typename std::enable_if< RCSResourceAttributes::is_supported_type< T >::value ||
std::is_constructible< std::string, T >::value, bool >::type
- operator!=(const T& lhs, const ResourceAttributes::Value::ComparisonHelper& rhs)
+ operator!=(const T& lhs, const RCSResourceAttributes::Value::ComparisonHelper& rhs)
{
return !(rhs == lhs);
}
//! @endcond
/**
- * @relates ResourceAttributes
+ * @relates RCSResourceAttributes
*
* Checks if the attributes are equal, that is, whether contents are equal.
*
* @return true if the attributes are equal, false otherwise.
*/
- bool operator==(const ResourceAttributes& lhs, const ResourceAttributes& rhs);
+ bool operator==(const RCSResourceAttributes& lhs, const RCSResourceAttributes& rhs);
/**
- * @relates ResourceAttributes
+ * @relates RCSResourceAttributes
*
* Checks if the attributes are not equal, that is, whether contents are not equal.
*
* @return true if the attributes are not equal, false otherwise.
*/
- bool operator!=(const ResourceAttributes&, const ResourceAttributes&);
+ bool operator!=(const RCSResourceAttributes&, const RCSResourceAttributes&);
/**
* KeyValuePair is a class to access attribute's key and value of an element pointed by
- * iterators of ResourceAttributes.
+ * iterators of RCSResourceAttributes.
*
*
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
* @see iterator
* @see const_iterator
*/
- class ResourceAttributes::KeyValuePair
+ class RCSResourceAttributes::KeyValuePair
{
private:
class KeyVisitor: public boost::static_visitor< const std::string& >
public:
const std::string& key() const;
- const ResourceAttributes::Value& value() const;
- ResourceAttributes::Value& value();
+ const RCSResourceAttributes::Value& value() const;
+ RCSResourceAttributes::Value& value();
private:
KeyValuePair(const KeyValuePair&) = default;
/**
* A forward iterator to KeyValuePair.
*
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
* @see KeyValuePair
* @see const_iterator
*/
- class ResourceAttributes::iterator:
- public std::iterator< std::forward_iterator_tag, ResourceAttributes::KeyValuePair >
+ class RCSResourceAttributes::iterator:
+ public std::iterator< std::forward_iterator_tag, RCSResourceAttributes::KeyValuePair >
{
private:
typedef std::unordered_map< std::string, Value >::iterator base_iterator;
private:
base_iterator m_cur;
- ResourceAttributes::KeyValuePair m_keyValuePair;
+ RCSResourceAttributes::KeyValuePair m_keyValuePair;
//! @cond
- friend class ResourceAttributes;
+ friend class RCSResourceAttributes;
//! @endcond
};
/**
* A forward iterator to const KeyValuePair.
*
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
* @see KeyValuePair
* @see iterator
*/
- class ResourceAttributes::const_iterator:
+ class RCSResourceAttributes::const_iterator:
public std::iterator < std::forward_iterator_tag,
- const ResourceAttributes::KeyValuePair >
+ const RCSResourceAttributes::KeyValuePair >
{
private:
typedef std::unordered_map< std::string, Value >::const_iterator base_iterator;
public:
const_iterator();
const_iterator(const const_iterator&) = default;
- const_iterator(const ResourceAttributes::iterator&);
+ const_iterator(const RCSResourceAttributes::iterator&);
const_iterator& operator=(const const_iterator&) = default;
- const_iterator& operator=(const ResourceAttributes::iterator&);
+ const_iterator& operator=(const RCSResourceAttributes::iterator&);
reference operator*() const;
pointer operator->() const;
private:
base_iterator m_cur;
- ResourceAttributes::KeyValuePair m_keyValuePair;
+ RCSResourceAttributes::KeyValuePair m_keyValuePair;
//! @cond
- friend class ResourceAttributes;
+ friend class RCSResourceAttributes;
//! @endcond
};
}
}
-#endif // RES_ENCAPSULATION_RESOURCEATTRIBUTES_H
+#endif // RES_MANIPULATION_RESOURCEATTRIBUTES_H
#include <boost/atomic.hpp>
-#include <ResourceAttributes.h>
+#include <RCSResourceAttributes.h>
#include <RCSResponse.h>
#include <RCSRequest.h>
*
* @return reference of this Builder
*/
- Builder &setAttributes(const ResourceAttributes &attributes);
+ Builder &setAttributes(const RCSResourceAttributes &attributes);
/**
* API for setting attributes of the resource.
*
* @return reference of this Builder
*/
- Builder &setAttributes(ResourceAttributes &&attributes);
+ Builder &setAttributes(RCSResourceAttributes &&attributes);
/**
* API for constructing a new RCSResourceObject.
std::string m_type;
std::string m_interface;
uint8_t m_properties;
- ResourceAttributes m_resourceAttributes;
+ RCSResourceAttributes m_resourceAttributes;
};
class LockGuard;
typedef std::function < RCSGetResponse(const RCSRequest &,
- ResourceAttributes &) > GetRequestHandler;
+ RCSResourceAttributes &) > GetRequestHandler;
typedef std::function < RCSSetResponse(const RCSRequest &,
- ResourceAttributes &) > SetRequestHandler;
+ RCSResourceAttributes &) > SetRequestHandler;
- typedef std::function < void(const ResourceAttributes::Value &,
- const ResourceAttributes::Value &) > AttributeUpdatedListener;
+ typedef std::function < void(const RCSResourceAttributes::Value &,
+ const RCSResourceAttributes::Value &) > AttributeUpdatedListener;
public:
RCSResourceObject(RCSResourceObject&&) = delete;
*
* @note It is guaranteed thread-safety about attributes.
*/
- void setAttribute(const std::string &key, const ResourceAttributes::Value & value);
+ void setAttribute(const std::string &key, const RCSResourceAttributes::Value & value);
/**
* @overload
*/
- void setAttribute(const std::string &key, ResourceAttributes::Value&& value);
+ void setAttribute(const std::string &key, RCSResourceAttributes::Value&& value);
/**
* @overload
*/
- void setAttribute(std::string&& key, const ResourceAttributes::Value & value);
+ void setAttribute(std::string&& key, const RCSResourceAttributes::Value & value);
/**
* @overload
*/
- void setAttribute(std::string&& key, ResourceAttributes::Value&& value);
+ void setAttribute(std::string&& key, RCSResourceAttributes::Value&& value);
/**
* API for getting attribute value corresponding to a key(name of that attribute).
* @throw InvalidKeyException
* Throw exception when empty string is provided as Attribute key.
*/
- ResourceAttributes::Value getAttributeValue(const std::string &key) const;
+ RCSResourceAttributes::Value getAttributeValue(const std::string &key) const;
/**
* API for retrieving the attribute value associated with the supplied name.
* @throw NoLockException
* If you don't do lock with LockGuard, throw exception.
*/
- ResourceAttributes &getAttributes();
+ RCSResourceAttributes &getAttributes();
/**
* @overload
*/
- const ResourceAttributes &getAttributes() const;
+ const RCSResourceAttributes &getAttributes() const;
/**
* API for checking whether the particular resource is observable or not
SetRequestHandlerPolicy getSetRequestHandlerPolicy() const;
private:
- RCSResourceObject(uint8_t, ResourceAttributes&&);
+ RCSResourceObject(uint8_t, RCSResourceAttributes&&);
OCEntityHandlerResult entityHandler(std::shared_ptr< OC::OCResourceRequest >);
void expectOwnLock() const;
void autoNotify(bool, AutoNotifyPolicy) const;
- void autoNotifyIfNeeded(const std::string& , const ResourceAttributes::Value& );
+ void autoNotifyIfNeeded(const std::string& , const RCSResourceAttributes::Value& );
private:
const uint8_t m_properties;
OCResourceHandle m_resourceHandle;
- ResourceAttributes m_resourceAttributes;
+ RCSResourceAttributes m_resourceAttributes;
GetRequestHandler m_getRequestHandler;
SetRequestHandler m_setRequestHandler;
namespace Service
{
//forward declaration of classes
- class ResourceAttributes;
+ class RCSResourceAttributes;
class RequestHandler;
class SetRequestHandler;
class RCSGetResponse
{
public:
- /**
- * Create RCSGetResponse with default response.
- *
- * @return RCSGetResponse - instance of RCSGetResponse
- */
+ /**
+ * Create RCSGetResponse with default response.
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ */
static RCSGetResponse defaultAction();
- /**
- * 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);
+ /**
+ * 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);
- /**
- * 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);
+ /**
+ * Create RCSGetResponse using resource attributes.
+ *
+ * @param attrs -RCSResourceAttributes to set
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ *
+ * @see RCSResourceAttributes
+ *
+ * NOTE : RCSResourceAttributes is defined in RCSResourceAttributes.h
+ */
+ static RCSGetResponse create(const RCSResourceAttributes &attrs);
+ /**
+ * Create RCSGetResponse using RCSResourceAttributes, OCEntityHandlerResult and error code.
+ *
+ * @param attrs - RCSResourceAttributes to set
+ *
+ * @param result - OCEntityHandlerResult
+ *
+ * @param errorCode - error code for response
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ *
+ * @see RCSResourceAttributes
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h.
+ * RCSResourceAttributes is defined in RCSResourceAttributes.h.
+ */
+ static RCSGetResponse create(const RCSResourceAttributes &attrs,
+ const OCEntityHandlerResult &result, 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);
+ /**
+ * Create RCSGetResponse using RCSResourceAttributes value.
+ *
+ * @param attrs - RCSResourceAttributes to set
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ *
+ * @see RCSResourceAttributes
+ *
+ *NOTE : RCSResourceAttributes is defined in RCSResourceAttributes.h.
+ */
+ static RCSGetResponse create(RCSResourceAttributes &&attrs);
+ /**
+ * Create RCSGetResponse using RCSResourceAttributes value.
+ *
+ * @param attrs - RCSResourceAttributes to set
+ *
+ * @param result - OCEntityHandlerResult
+ *
+ * @param errorCode - error code for response
+ *
+ * @return RCSGetResponse - instance of RCSGetResponse
+ *
+ * @see RCSResourceAttributes
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h.
+ * RCSResourceAttributes is defined in RCSResourceAttributes.h.
+ */
+ static RCSGetResponse create(RCSResourceAttributes &&attrs,
+ const OCEntityHandlerResult &result, int errorCode);
- /**
- * Get the request handler.
- *
- * @return RequestHandler - RequestHandler pointer.
- *
- */
+ /**
+ * Get the request handler.
+ *
+ * @return RequestHandler - RequestHandler pointer.
+ *
+ */
RequestHandler* getHandler() const;
private:
class RCSSetResponse
{
public:
- /**
- * AcceptanceMethod enum provides values for different acceptance method policy to be
- * used in setting response.
- */
- enum class AcceptanceMethod
+ /**
+ * AcceptanceMethod enum provides values for different acceptance method policy to be
+ * used in setting response.
+ */
+ enum class AcceptanceMethod
{
- DEFAULT,
- ACCEPT,
- IGNORE
+ DEFAULT, ACCEPT, IGNORE
};
- /**
- * Create default RCSSetResponse with default response.
- *
- * @return RCSSetResponse - instance of RCSSetResponse
- */
+ /**
+ * 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
- */
+ /**
+ * Internally it invokes the defaultAction() API.
+ * It sets the AcceptanceMethod as ACCEPT.
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see AcceptanceMethod
+ */
static RCSSetResponse accept();
- /**
- * 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 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
- */
+ /**
+ * Internally it invokes the defaultAction() API.
+ * It sets the AcceptanceMethod as IGNORE.
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse.
+ *
+ * @see AcceptanceMethod
+ */
static RCSSetResponse ignore();
- /**
- * 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);
+ /**
+ * 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);
- /**
- * 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);
+ /**
+ * 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);
- /**
- * 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);
+ /**
+ * Create RCSSetResponse with RCSResourceAttributes.
+ *
+ * @param attrs - RCSResourceAttributes to set
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see RCSResourceAttributes
+ */
+ static RCSSetResponse create(const RCSResourceAttributes &attrs);
+ /**
+ * Create RCSSetResponse with RCSResourceAttributes, OCEntityHandlerResult and errorCode.
+ *
+ * @param attrs - RCSResourceAttributes to set.
+ *
+ * @param result - OCEntityHandlerResult value
+ *
+ * @param errorCode - error code for the response
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see RCSResourceAttributes
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h.
+ */
+ static RCSSetResponse create(const RCSResourceAttributes &attrs,
+ const OCEntityHandlerResult &result, 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);
+ /**
+ * Create RCSSetResponse with RCSResourceAttributes.
+ *
+ * @param attrs - RCSResourceAttributes value to set
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see RCSResourceAttributes
+ */
+ static RCSSetResponse create(RCSResourceAttributes &&attrs);
+ /**
+ * Create RCSSetResponse with RCSResourceAttributes, OCEntityHandlerResult and errorCode.
+ *
+ * @param attrs - RCSResourceAttributes value to set
+ *
+ * @param result - OCEntityHandlerResult value
+ *
+ * @param errorCode - error code for the response
+ *
+ * @return RCSSetResponse - instance of RCSSetResponse
+ *
+ * @see RCSResourceAttributes
+ *
+ *NOTE : OCEntityHandlerResult is defined in octypes.h.
+ */
+ static RCSSetResponse create(RCSResourceAttributes &&attrs,
+ const OCEntityHandlerResult &result, int errorCode);
- /**
- * API to get the set request handler.
- *
- * @return SetRequestHandler - pointer to SetRequestHandler.
- *
- */
+ /**
+ * 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
- *
- */
+ /**
+ * API to get the acceptance method of the RCSSetResponse.
+ *
+ * @return AcceptanceMethod - acceptance methods enum value.
+ *
+ * @see AcceptanceMethod
+ *
+ */
AcceptanceMethod getAcceptanceMethod() const;
- /**
- * 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);
+ /**
+ * 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 >&&);
#define RESOURCE_CLIENT_H_
#include<vector>
-#include "ResourceAttributes.h"
+#include "RCSResourceAttributes.h"
namespace OIC
{
/**
* Typedef for callback of startCaching API
*
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
*/
- typedef std::function< void(const ResourceAttributes &) > CacheUpdatedCallback;
+ typedef std::function< void(const RCSResourceAttributes &) > CacheUpdatedCallback;
/**
* Typedef for callback of getRemoteAttributes API
*
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
*/
- typedef std::function< void(const ResourceAttributes &) >
+ typedef std::function< void(const RCSResourceAttributes &) >
RemoteAttributesReceivedCallback;
/**
* Typedef for callback of setRemoteAttributes API
*
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
*/
- typedef std::function< void(const ResourceAttributes &) >
+ typedef std::function< void(const RCSResourceAttributes &) >
RemoteAttributesSetCallback;
/**
void refreshCache() ;
/**
- * Get the cached ResourceAttributes data.
+ * Get the cached RCSResourceAttributes data.
*
* @pre startCaching() or startCaching(CacheUpdatedCallback) API should be called.
*
- * @return ResourceAttributes - cached resourceAttribute
+ * @return RCSResourceAttributes - cached resourceAttribute
*
* @throw BadRequestException
*
* @see startCaching()
* @see startCaching(CacheUpdatedCallback)
- * @see ResourceAttributes
+ * @see RCSResourceAttributes
*
* NOTE: If startCaching() or startCaching(CacheUpdatedCallback) is not being called &
* directly this API is called it will throw the
* BadRequestException.
*/
- ResourceAttributes getCachedAttributes() const;
+ RCSResourceAttributes getCachedAttributes() const;
/**
* Get a particular cached ResourceAttribute value.
*
* @pre startCaching() or startCaching(CacheUpdatedCallback) API should be called.
*
- * @return ResourceAttributes::Value - requested attribute Value
+ * @return RCSResourceAttributes::Value - requested attribute Value
*
* @throw BadRequestException
*
* @see startCaching()
* @see startCaching(CacheUpdatedCallback)
- * @see ResourceAttributes::Value
+ * @see RCSResourceAttributes::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 &) ;
+ RCSResourceAttributes::Value getCachedAttribute( const std::string &) ;
/**
* 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
+ * @see RCSResourceAttributes::Value
*/
void getRemoteAttributes(RemoteAttributesReceivedCallback cb);
* @param cb - callback on setting resourceAttributes data.
*
*/
- void setRemoteAttributes(ResourceAttributes &attributes, RemoteAttributesSetCallback cb);
+ void setRemoteAttributes(const RCSResourceAttributes &attributes, RemoteAttributesSetCallback cb);
/**
* Get resource uri.
}
OCStackResult cachingCallback(std::shared_ptr<PrimitiveResource> resource,
- const ResourceAttributes &data,
+ const RCSResourceAttributes &data,
RemoteResourceObject::CacheUpdatedCallback onCacheUpdated)
{
OC_LOG(DEBUG, CLIENT_W_TAG, "cachingCallback entry");
- onCacheUpdated(data); //passing ResourceAttributes to application
+ onCacheUpdated(data); //passing RCSResourceAttributes to application
OC_LOG(DEBUG, CLIENT_W_TAG, "cachingCallback exit");
return OC_STACK_OK;
{
OC_LOG(DEBUG, CLIENT_W_TAG, "setCallback entry");
- const ResourceAttributes &attributes = response.getAttributes();
- onRemoteAttributesSet(attributes); //passing ResourceAttributes to application
+ const RCSResourceAttributes &attributes = response.getAttributes();
+ onRemoteAttributesSet(attributes); //passing RCSResourceAttributes to application
OC_LOG(DEBUG, CLIENT_W_TAG, "setCallback exit");
}
{
OC_LOG(DEBUG, CLIENT_W_TAG, "getCallback entry");
- const ResourceAttributes &attributes = response.getAttributes();
- onRemoteAttributesReceived(attributes); //passing ResourceAttributes to application
+ const RCSResourceAttributes &attributes = response.getAttributes();
+ onRemoteAttributesReceived(attributes); //passing RCSResourceAttributes to application
OC_LOG(DEBUG, CLIENT_W_TAG, "getCallback exit");
}
OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject::refreshCache exit");
}
- ResourceAttributes RemoteResourceObject:: getCachedAttributes() const
+ RCSResourceAttributes RemoteResourceObject:: getCachedAttributes() const
{
OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject :: getCachedAttributes ");
try
}
}
- ResourceAttributes::Value RemoteResourceObject:: getCachedAttribute( const std::string &key)
+ RCSResourceAttributes::Value RemoteResourceObject:: getCachedAttribute( const std::string &key)
{
OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject :: getCachedAttribute entry");
try
{
- ResourceAttributes Cachedattributes = ResourceCacheManager::getInstance()->getCachedData(
+ RCSResourceAttributes Cachedattributes = ResourceCacheManager::getInstance()->getCachedData(
m_primitiveResource);
return Cachedattributes[key];
}
OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject::getRemoteAttributes exit");
}
- void RemoteResourceObject::setRemoteAttributes(ResourceAttributes &attribute,
+ void RemoteResourceObject::setRemoteAttributes(const RCSResourceAttributes &attribute,
RemoteAttributesSetCallback cb)
{
OC_LOG(DEBUG, CLIENT_W_TAG, "RemoteResourceObject::setRemoteAttributes entry");
RESOURCE_SRC + 'PrimitiveResource.cpp',
RESOURCE_SRC + 'RCSException.cpp',
RESOURCE_SRC + 'RCSAddress.cpp',
- RESOURCE_SRC + 'ResourceAttributes.cpp',
+ RESOURCE_SRC + 'RCSResourceAttributes.cpp',
RESOURCE_SRC + 'ResponseStatement.cpp'
]
typedef OC::HeaderOption::OCHeaderOption HeaderOption;
typedef std::vector<HeaderOption> HeaderOptions;
- class ResourceAttributes;
+ class RCSResourceAttributes;
class ResponseStatement;
class PrimitiveResource
virtual ~PrimitiveResource() { };
virtual void requestGet(GetCallback) = 0;
- virtual void requestSet(const ResourceAttributes&, SetCallback) = 0;
+ virtual void requestSet(const RCSResourceAttributes&, SetCallback) = 0;
virtual void requestObserve(ObserveCallback) = 0;
virtual void cancelObserve() = 0;
std::bind(createResponseStatement, _2), _3));
}
- void requestSet(const ResourceAttributes& attrs, SetCallback callback)
+ void requestSet(const RCSResourceAttributes& attrs, SetCallback callback)
{
using namespace std::placeholders;
#ifndef COMMON_INTERNAL_RESOURCEATTRIBUTESCONVERTER_H
#define COMMON_INTERNAL_RESOURCEATTRIBUTESCONVERTER_H
-#include <ResourceAttributes.h>
+#include <RCSResourceAttributes.h>
#include <OCRepresentation.h>
item.getValue< OC::OCRepresentation >()));
case OC::AttributeType::Vector:
- // ResourceAttributes doesn't support vector yet!
+ // RCSResourceAttributes doesn't support vector yet!
return;
}
}
- ResourceAttributes&& extract()
+ RCSResourceAttributes&& extract()
{
return std::move(m_target);
}
private:
template< typename T >
- typename std::enable_if<ResourceAttributes::is_supported_type< T >::value >::type
+ typename std::enable_if<RCSResourceAttributes::is_supported_type< T >::value >::type
putValue(const std::string& key, T && value)
{
m_target[key] = std::forward< T >(value);
}
template< typename T >
- typename std::enable_if<!ResourceAttributes::is_supported_type< T >::value >::type
+ typename std::enable_if<!RCSResourceAttributes::is_supported_type< T >::value >::type
putValue(const std::string& key, T && value)
{
}
private:
- ResourceAttributes m_target;
+ RCSResourceAttributes m_target;
};
class OCRepresentationBuilder
m_target.setNULL(key);
}
- void operator()(const std::string& key, const ResourceAttributes& value)
+ void operator()(const std::string& key, const RCSResourceAttributes& value)
{
m_target[key] = ResourceAttributesConverter::toOCRepresentation(value);
}
};
public:
- static ResourceAttributes fromOCRepresentation(
+ static RCSResourceAttributes fromOCRepresentation(
const OC::OCRepresentation& ocRepresentation)
{
ResourceAttributesBuilder builder;
}
static OC::OCRepresentation toOCRepresentation(
- const ResourceAttributes& resourceAttributes)
+ const RCSResourceAttributes& resourceAttributes)
{
OCRepresentationBuilder builder;
#include <vector>
#include <string>
-#include <ResourceAttributes.h>
+#include <RCSResourceAttributes.h>
namespace OIC
{
namespace Service
{
- typedef std::pair< std::string, ResourceAttributes::Value > AttrKeyValuePair;
+ typedef std::pair< std::string, RCSResourceAttributes::Value > AttrKeyValuePair;
typedef std::vector< AttrKeyValuePair > AttrKeyValuePairs;
- bool acceptableAttributes(const ResourceAttributes& dest, const ResourceAttributes& attr);
+ bool acceptableAttributes(const RCSResourceAttributes& dest, const RCSResourceAttributes& attr);
- bool acceptableAttributeValue(const ResourceAttributes::Value& dest,
- const ResourceAttributes::Value& value);
+ bool acceptableAttributeValue(const RCSResourceAttributes::Value& dest,
+ const RCSResourceAttributes::Value& value);
- AttrKeyValuePairs replaceAttributes(ResourceAttributes& dest,
- const ResourceAttributes& attrs);
+ AttrKeyValuePairs replaceAttributes(RCSResourceAttributes& dest,
+ const RCSResourceAttributes& attrs);
}
}
#include <string>
#include <vector>
-#include <ResourceAttributes.h>
+#include <RCSResourceAttributes.h>
namespace OC
{
{
namespace Service
{
- class ResourceAttributes;
+ class RCSResourceAttributes;
class ResponseStatement
{
public:
static ResponseStatement create(const OC::OCRepresentation&);
- static ResponseStatement create(ResourceAttributes&&);
+ static ResponseStatement create(RCSResourceAttributes&&);
- explicit ResponseStatement(const ResourceAttributes&);
- explicit ResponseStatement(ResourceAttributes&&);
+ explicit ResponseStatement(const RCSResourceAttributes&);
+ explicit ResponseStatement(RCSResourceAttributes&&);
- ResponseStatement(ResourceAttributes&&, std::string&& uri,
+ ResponseStatement(RCSResourceAttributes&&, std::string&& uri,
std::vector< std::string >&& resourceTypes,
std::vector< std::string >&& resourceInterfaces);
std::vector< std::string > getResourceTypes() const;
std::vector< std::string > getResourceInterfaces() const;
- const ResourceAttributes& getAttributes() const;
+ const RCSResourceAttributes& getAttributes() const;
private:
- ResourceAttributes m_attrs;
+ RCSResourceAttributes m_attrs;
std::string m_uri;
std::vector< std::string > m_resourceTypes;
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#include <ResourceAttributes.h>
+#include <RCSResourceAttributes.h>
#include <ResourceAttributesUtils.h>
#include <ResourceAttributesConverter.h>
return value;
}
- std::string operator()(const OIC::Service::ResourceAttributes&) const
+ std::string operator()(const OIC::Service::RCSResourceAttributes&) const
{
return "Attributes";
}
};
- class TypeVisitor: public boost::static_visitor< ResourceAttributes::Type >
+ class TypeVisitor: public boost::static_visitor< RCSResourceAttributes::Type >
{
public:
TypeVisitor() = default;
TypeVisitor& operator=(TypeVisitor&&) = delete;
template< typename T >
- ResourceAttributes::Type operator()(const T& value) const
+ RCSResourceAttributes::Type operator()(const T& value) const
{
- return ResourceAttributes::Type::typeOf(value);
+ return RCSResourceAttributes::Type::typeOf(value);
}
};
template< >
struct TypeInfoConverter< int >
{
- static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::INT;
+ static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::INT;
};
template< >
struct TypeInfoConverter< std::nullptr_t >
{
- static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::NULL_T;
+ static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::NULL_T;
};
template< >
struct TypeInfoConverter< double >
{
- static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::DOUBLE;
+ static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::DOUBLE;
};
template< >
struct TypeInfoConverter< bool >
{
- static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::BOOL;
+ static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::BOOL;
};
template< >
struct TypeInfoConverter< std::string >
{
- static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::STRING;
+ static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::STRING;
};
template< >
- struct TypeInfoConverter< ResourceAttributes >
+ struct TypeInfoConverter< RCSResourceAttributes >
{
- static constexpr ResourceAttributes::TypeId typeId = ResourceAttributes::TypeId::ATTRIBUTES;
+ static constexpr RCSResourceAttributes::TypeId typeId = RCSResourceAttributes::TypeId::ATTRIBUTES;
};
struct TypeInfo
{
- ResourceAttributes::TypeId typeId;
+ RCSResourceAttributes::TypeId typeId;
template< typename TRAIT >
constexpr TypeInfo(TRAIT) :
namespace Service
{
- ResourceAttributes::Value::ComparisonHelper::ComparisonHelper(const Value& v) :
+ RCSResourceAttributes::Value::ComparisonHelper::ComparisonHelper(const Value& v) :
m_valueRef(v)
{
}
- bool ResourceAttributes::Value::ComparisonHelper::operator==
+ bool RCSResourceAttributes::Value::ComparisonHelper::operator==
(const Value::ComparisonHelper& rhs) const
{
return *m_valueRef.m_data == *rhs.m_valueRef.m_data;
}
- bool operator==(const ResourceAttributes::Type& lhs, const ResourceAttributes::Type& rhs)
+ bool operator==(const RCSResourceAttributes::Type& lhs, const RCSResourceAttributes::Type& rhs)
{
return lhs.m_which == rhs.m_which;
}
- bool operator!=(const ResourceAttributes::Type& lhs, const ResourceAttributes::Type& rhs)
+ bool operator!=(const RCSResourceAttributes::Type& lhs, const RCSResourceAttributes::Type& rhs)
{
return !(lhs == rhs);
}
- bool operator==(const ResourceAttributes::Value::ComparisonHelper& lhs,
- const ResourceAttributes::Value::ComparisonHelper& rhs)
+ bool operator==(const RCSResourceAttributes::Value::ComparisonHelper& lhs,
+ const RCSResourceAttributes::Value::ComparisonHelper& rhs)
{
return lhs.operator==(rhs);
}
- bool operator!=(const ResourceAttributes::Value::ComparisonHelper& lhs,
- const ResourceAttributes::Value::ComparisonHelper& rhs)
+ bool operator!=(const RCSResourceAttributes::Value::ComparisonHelper& lhs,
+ const RCSResourceAttributes::Value::ComparisonHelper& rhs)
{
return !lhs.operator==(rhs);
}
- bool operator==(const ResourceAttributes& lhs, const ResourceAttributes& rhs)
+ bool operator==(const RCSResourceAttributes& lhs, const RCSResourceAttributes& rhs)
{
return lhs.m_values == rhs.m_values;
}
- bool operator!=(const ResourceAttributes& lhs, const ResourceAttributes& rhs)
+ bool operator!=(const RCSResourceAttributes& lhs, const RCSResourceAttributes& rhs)
{
return !(lhs == rhs);
}
- auto ResourceAttributes::Type::getId() const -> TypeId
+ auto RCSResourceAttributes::Type::getId() const -> TypeId
{
return ::getTypeInfo< ValueVariant >(m_which).typeId;
}
- ResourceAttributes::Value::Value() :
+ RCSResourceAttributes::Value::Value() :
m_data{ new ValueVariant{} }
{
}
- ResourceAttributes::Value::Value(const Value& from) :
+ RCSResourceAttributes::Value::Value(const Value& from) :
m_data{ new ValueVariant{ *from.m_data } }
{
}
- ResourceAttributes::Value::Value(Value&& from) :
+ RCSResourceAttributes::Value::Value(Value&& from) :
m_data{ new ValueVariant{} }
{
m_data->swap(*from.m_data);
}
- ResourceAttributes::Value::Value(const char* value) :
+ RCSResourceAttributes::Value::Value(const char* value) :
m_data{ new ValueVariant{ std::string{ value } } }
{
}
- auto ResourceAttributes::Value::operator=(const Value& rhs) -> Value&
+ auto RCSResourceAttributes::Value::operator=(const Value& rhs) -> Value&
{
*m_data = *rhs.m_data;
return *this;
}
- auto ResourceAttributes::Value::operator=(Value&& rhs) -> Value&
+ auto RCSResourceAttributes::Value::operator=(Value&& rhs) -> Value&
{
*m_data = ValueVariant{};
m_data->swap(*rhs.m_data);
return *this;
}
- auto ResourceAttributes::Value::operator=(const char* rhs) -> Value&
+ auto RCSResourceAttributes::Value::operator=(const char* rhs) -> Value&
{
*m_data = std::string{ rhs };
return *this;
}
- auto ResourceAttributes::Value::operator=(std::nullptr_t) -> Value&
+ auto RCSResourceAttributes::Value::operator=(std::nullptr_t) -> Value&
{
*m_data = nullptr;
return *this;
}
- auto ResourceAttributes::Value::getType() const -> Type
+ auto RCSResourceAttributes::Value::getType() const -> Type
{
return boost::apply_visitor(TypeVisitor(), *m_data);
}
- std::string ResourceAttributes::Value::toString() const
+ std::string RCSResourceAttributes::Value::toString() const
{
return boost::apply_visitor(ToStringVisitor(), *m_data);
}
- void ResourceAttributes::Value::swap(Value& rhs)
+ void RCSResourceAttributes::Value::swap(Value& rhs)
{
m_data.swap(rhs.m_data);
}
- auto ResourceAttributes::KeyValuePair::KeyVisitor::operator() (iterator* iter) const
+ auto RCSResourceAttributes::KeyValuePair::KeyVisitor::operator() (iterator* iter) const
-> result_type {
return iter->m_cur->first;
}
- auto ResourceAttributes::KeyValuePair::KeyVisitor::operator() (const_iterator* iter) const
+ auto RCSResourceAttributes::KeyValuePair::KeyVisitor::operator() (const_iterator* iter) const
-> result_type {
return iter->m_cur->first;
}
- auto ResourceAttributes::KeyValuePair::ValueVisitor::operator() (iterator* iter)
+ auto RCSResourceAttributes::KeyValuePair::ValueVisitor::operator() (iterator* iter)
-> result_type {
return iter->m_cur->second;
}
- auto ResourceAttributes::KeyValuePair::ValueVisitor::operator() (const_iterator* iter)
+ auto RCSResourceAttributes::KeyValuePair::ValueVisitor::operator() (const_iterator* iter)
-> result_type {
// should not reach here.
throw BadGetException("");
}
- auto ResourceAttributes::KeyValuePair::ConstValueVisitor::operator() (iterator*iter) const
+ auto RCSResourceAttributes::KeyValuePair::ConstValueVisitor::operator() (iterator*iter) const
-> result_type {
return iter->m_cur->second;
}
- auto ResourceAttributes::KeyValuePair::ConstValueVisitor::operator() (const_iterator* iter)
+ auto RCSResourceAttributes::KeyValuePair::ConstValueVisitor::operator() (const_iterator* iter)
const -> result_type {
return iter->m_cur->second;
}
- auto ResourceAttributes::KeyValuePair::key() const -> const std::string&
+ auto RCSResourceAttributes::KeyValuePair::key() const -> const std::string&
{
return boost::apply_visitor(m_keyVisitor, m_iterRef);
}
- auto ResourceAttributes::KeyValuePair::value() const -> const Value&
+ auto RCSResourceAttributes::KeyValuePair::value() const -> const Value&
{
return boost::apply_visitor(m_constValueVisitor, m_iterRef);
}
- auto ResourceAttributes::KeyValuePair::value() -> Value&
+ auto RCSResourceAttributes::KeyValuePair::value() -> Value&
{
return boost::apply_visitor(m_valueVisitor, m_iterRef);
}
- ResourceAttributes::KeyValuePair::KeyValuePair(boost::variant<iterator*,
+ RCSResourceAttributes::KeyValuePair::KeyValuePair(boost::variant<iterator*,
const_iterator*>&& ref) :
m_iterRef{ ref }
{
}
- ResourceAttributes::iterator::iterator() :
+ RCSResourceAttributes::iterator::iterator() :
m_cur{ base_iterator{ } },
m_keyValuePair{ this }
{
}
- ResourceAttributes::iterator::iterator(base_iterator&& iter) :
+ RCSResourceAttributes::iterator::iterator(base_iterator&& iter) :
m_cur{ std::move(iter) },
m_keyValuePair{ this }
{
}
- auto ResourceAttributes::iterator::operator*() -> KeyValuePair&
+ auto RCSResourceAttributes::iterator::operator*() -> KeyValuePair&
{
return m_keyValuePair;
}
- auto ResourceAttributes::iterator::iterator::operator->() -> KeyValuePair*
+ auto RCSResourceAttributes::iterator::iterator::operator->() -> KeyValuePair*
{
return &m_keyValuePair;
}
- auto ResourceAttributes::iterator::operator++() -> iterator&
+ auto RCSResourceAttributes::iterator::operator++() -> iterator&
{
++m_cur;
return *this;
}
- auto ResourceAttributes::iterator::operator++(int) -> iterator
+ auto RCSResourceAttributes::iterator::operator++(int) -> iterator
{
iterator iter(*this);
++(*this);
return iter;
}
- bool ResourceAttributes::iterator::operator==(const iterator& rhs) const
+ bool RCSResourceAttributes::iterator::operator==(const iterator& rhs) const
{
return m_cur == rhs.m_cur;
}
- bool ResourceAttributes::iterator::operator!=(const iterator& rhs) const
+ bool RCSResourceAttributes::iterator::operator!=(const iterator& rhs) const
{
return !(*this == rhs);
}
- ResourceAttributes::const_iterator::const_iterator() :
+ RCSResourceAttributes::const_iterator::const_iterator() :
m_cur{ base_iterator{} }, m_keyValuePair{ this }
{
}
- ResourceAttributes::const_iterator::const_iterator(base_iterator&& iter) :
+ RCSResourceAttributes::const_iterator::const_iterator(base_iterator&& iter) :
m_cur{ iter }, m_keyValuePair{ this }
{
}
- ResourceAttributes::const_iterator::const_iterator(
- const ResourceAttributes::iterator& iter) :
+ RCSResourceAttributes::const_iterator::const_iterator(
+ const RCSResourceAttributes::iterator& iter) :
m_cur{ iter.m_cur }, m_keyValuePair{ this }
{
}
- auto ResourceAttributes::const_iterator::operator=(const ResourceAttributes::iterator& iter)
+ auto RCSResourceAttributes::const_iterator::operator=(const RCSResourceAttributes::iterator& iter)
-> const_iterator& {
m_cur = iter.m_cur;
return *this;
}
- auto ResourceAttributes::const_iterator::operator*() const -> reference
+ auto RCSResourceAttributes::const_iterator::operator*() const -> reference
{
return m_keyValuePair;
}
- auto ResourceAttributes::const_iterator::operator->() const -> pointer
+ auto RCSResourceAttributes::const_iterator::operator->() const -> pointer
{
return &m_keyValuePair;
}
- auto ResourceAttributes::const_iterator::operator++() -> const_iterator&
+ auto RCSResourceAttributes::const_iterator::operator++() -> const_iterator&
{
++m_cur;
return *this;
}
- auto ResourceAttributes::const_iterator::operator++(int) -> const_iterator
+ auto RCSResourceAttributes::const_iterator::operator++(int) -> const_iterator
{
const_iterator iter(*this);
++(*this);
return iter;
}
- bool ResourceAttributes::const_iterator::operator==(const const_iterator& rhs) const
+ bool RCSResourceAttributes::const_iterator::operator==(const const_iterator& rhs) const
{
return m_cur == rhs.m_cur;
}
- bool ResourceAttributes::const_iterator::operator!=(const const_iterator& rhs) const
+ bool RCSResourceAttributes::const_iterator::operator!=(const const_iterator& rhs) const
{
return !(*this == rhs);
}
- auto ResourceAttributes::begin() -> iterator
+ auto RCSResourceAttributes::begin() -> iterator
{
return iterator{ m_values.begin() };
}
- auto ResourceAttributes::end() -> iterator
+ auto RCSResourceAttributes::end() -> iterator
{
return iterator{ m_values.end() };
}
- auto ResourceAttributes::begin() const -> const_iterator
+ auto RCSResourceAttributes::begin() const -> const_iterator
{
return const_iterator{ m_values.begin() };
}
- auto ResourceAttributes::end() const -> const_iterator
+ auto RCSResourceAttributes::end() const -> const_iterator
{
return const_iterator{ m_values.end() };
}
- auto ResourceAttributes::cbegin() const -> const_iterator
+ auto RCSResourceAttributes::cbegin() const -> const_iterator
{
return const_iterator{ m_values.begin() };
}
- auto ResourceAttributes::cend() const -> const_iterator
+ auto RCSResourceAttributes::cend() const -> const_iterator
{
return const_iterator{ m_values.end() };
}
- auto ResourceAttributes::operator[](const std::string& key) -> Value&
+ auto RCSResourceAttributes::operator[](const std::string& key) -> Value&
{
return m_values[key];
}
- auto ResourceAttributes::operator[](std::string&& key) -> Value&
+ auto RCSResourceAttributes::operator[](std::string&& key) -> Value&
{
return m_values[std::move(key)];
}
- auto ResourceAttributes::at(const std::string& key) -> Value&
+ auto RCSResourceAttributes::at(const std::string& key) -> Value&
{
try
{
}
}
- auto ResourceAttributes::at(const std::string& key) const -> const Value&
+ auto RCSResourceAttributes::at(const std::string& key) const -> const Value&
{
try
{
}
}
- void ResourceAttributes::clear()
+ void RCSResourceAttributes::clear()
{
return m_values.clear();
}
- bool ResourceAttributes::erase(const std::string& key)
+ bool RCSResourceAttributes::erase(const std::string& key)
{
return m_values.erase(key) == 1U;
}
- bool ResourceAttributes::contains(const std::string& key) const
+ bool RCSResourceAttributes::contains(const std::string& key) const
{
return m_values.find(key) != m_values.end();
}
- bool ResourceAttributes::empty() const
+ bool RCSResourceAttributes::empty() const
{
return m_values.empty();
}
- size_t ResourceAttributes::size() const
+ size_t RCSResourceAttributes::size() const
{
return m_values.size();
}
- bool acceptableAttributeValue(const ResourceAttributes::Value& dest,
- const ResourceAttributes::Value& value)
+ bool acceptableAttributeValue(const RCSResourceAttributes::Value& dest,
+ const RCSResourceAttributes::Value& value)
{
if (dest.getType() != value.getType())
{
return false;
}
- static_assert(ResourceAttributes::is_supported_type< ResourceAttributes >::value,
- "ResourceAttributes doesn't have ResourceAttributes recursively.");
- if (dest.getType().getId() == ResourceAttributes::TypeId::ATTRIBUTES
- && !acceptableAttributes(dest.get< ResourceAttributes >(),
- value.get< ResourceAttributes >()))
+ static_assert(RCSResourceAttributes::is_supported_type< RCSResourceAttributes >::value,
+ "RCSResourceAttributes doesn't have RCSResourceAttributes recursively.");
+ if (dest.getType().getId() == RCSResourceAttributes::TypeId::ATTRIBUTES
+ && !acceptableAttributes(dest.get< RCSResourceAttributes >(),
+ value.get< RCSResourceAttributes >()))
{
return false;
}
return true;
}
- bool acceptableAttributes(const ResourceAttributes& dest, const ResourceAttributes& attr)
+ bool acceptableAttributes(const RCSResourceAttributes& dest, const RCSResourceAttributes& attr)
{
for (const auto& kv : attr)
{
return true;
}
- AttrKeyValuePairs replaceAttributes(ResourceAttributes& dest,
- const ResourceAttributes& newAttrs)
+ AttrKeyValuePairs replaceAttributes(RCSResourceAttributes& dest,
+ const RCSResourceAttributes& newAttrs)
{
AttrKeyValuePairs replacedList;
{
if (dest[kv.key()] != kv.value())
{
- ResourceAttributes::Value replacedValue;
+ RCSResourceAttributes::Value replacedValue;
replacedValue.swap(dest[kv.key()]);
dest[kv.key()] = kv.value();
ResourceAttributesConverter::fromOCRepresentation(ocRepresentation));
}
- ResponseStatement ResponseStatement::create(ResourceAttributes&& attrs)
+ ResponseStatement ResponseStatement::create(RCSResourceAttributes&& attrs)
{
return ResponseStatement(std::move(attrs));
}
- ResponseStatement::ResponseStatement(const ResourceAttributes& attrs) :
+ ResponseStatement::ResponseStatement(const RCSResourceAttributes& attrs) :
m_attrs{ attrs }
{
}
- ResponseStatement::ResponseStatement(ResourceAttributes&& attrs) :
+ ResponseStatement::ResponseStatement(RCSResourceAttributes&& attrs) :
m_attrs{ std::move(attrs) }
{
}
- ResponseStatement::ResponseStatement(ResourceAttributes&& attrs, std::string&& uri,
+ ResponseStatement::ResponseStatement(RCSResourceAttributes&& attrs, std::string&& uri,
std::vector< std::string >&& resourceTypes,
std::vector< std::string >&& resourceInterfaces) :
m_attrs{ std::move(attrs) },
return m_resourceInterfaces;
}
- const ResourceAttributes& ResponseStatement::getAttributes() const
+ const RCSResourceAttributes& ResponseStatement::getAttributes() const
{
return m_attrs;
}
{
mocks.ExpectCall(fakeResource, FakeOCResource::put).Return(OC_STACK_OK);
- resource->requestSet(ResourceAttributes(), PrimitiveResource::SetCallback());
+ resource->requestSet(RCSResourceAttributes{ }, PrimitiveResource::SetCallback());
}
TEST_F(PrimitiveResourceTest, RequestSetThrowsOCResourcePutReturnsNotOK)
{
mocks.OnCall(fakeResource, FakeOCResource::put).Return(OC_STACK_ERROR);
- ASSERT_THROW(resource->requestSet(ResourceAttributes(), PrimitiveResource::SetCallback()),
+ ASSERT_THROW(resource->requestSet(RCSResourceAttributes{ }, PrimitiveResource::SetCallback()),
PlatformException);
}
{
constexpr int value{ -200 };
- ResourceAttributes attrs;
+ RCSResourceAttributes attrs;
mocks.ExpectCall(fakeResource, FakeOCResource::put).Match(
[](const OC::OCRepresentation& ocRep, const OC::QueryParamsMap&, OC::PutCallback)
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#include <ResourceAttributes.h>
+#include <RCSResourceAttributes.h>
#include <ResourceAttributesConverter.h>
#include <ResourceAttributesUtils.h>
class ResourceAttributesTest: public Test
{
public:
- ResourceAttributes resourceAttributes;
+ RCSResourceAttributes resourceAttributes;
};
TEST_F(ResourceAttributesTest, InitialSizeIsZero)
const char arbitraryStr[] { "ftryb457" };
resourceAttributes[KEY] = 1;
- ResourceAttributes::Value copied { resourceAttributes[KEY] };
+ RCSResourceAttributes::Value copied { resourceAttributes[KEY] };
copied = arbitraryStr;
ASSERT_TRUE(resourceAttributes[KEY] == 1);
{
resourceAttributes[KEY] = 1;
- ResourceAttributes moved{ std::move(resourceAttributes) };
+ RCSResourceAttributes moved{ std::move(resourceAttributes) };
ASSERT_TRUE(resourceAttributes.empty());
}
TEST_F(ResourceAttributesTest, CanHaveNestedResourceAttributes)
{
- ResourceAttributes nested;
+ RCSResourceAttributes nested;
nested["nested"] = "nested_value";
resourceAttributes[KEY] = nested;
- ASSERT_TRUE("nested_value" == resourceAttributes[KEY].get<ResourceAttributes>()["nested"]);
+ ASSERT_TRUE("nested_value" == resourceAttributes[KEY].get<RCSResourceAttributes>()["nested"]);
}
TEST_F(ResourceAttributesTest, ToStringReturnsStringForValue)
class ResourceAttributesIteratorTest: public Test
{
public:
- ResourceAttributes resourceAttributes;
+ RCSResourceAttributes resourceAttributes;
};
TEST_F(ResourceAttributesIteratorTest, BeginEqualsEndWhenEmpty)
TEST_F(ResourceAttributesIteratorTest, IteratorIsCopyable)
{
- ResourceAttributes::iterator it;
+ RCSResourceAttributes::iterator it;
it = resourceAttributes.begin();
{
resourceAttributes[KEY] = 1;
- ResourceAttributes::iterator it = resourceAttributes.begin();
+ RCSResourceAttributes::iterator it = resourceAttributes.begin();
it++;
TEST_F(ResourceAttributesIteratorTest, IteratorCanBeConvertedIntoConstIterator)
{
resourceAttributes[KEY] = 1;
- ResourceAttributes::const_iterator it { resourceAttributes.begin() };
+ RCSResourceAttributes::const_iterator it { resourceAttributes.begin() };
it = resourceAttributes.cbegin();
it++;
TEST_F(ResourceAttributesIteratorTest, ConstIteratorIsUsedForConst)
{
resourceAttributes[KEY] = 1;
- const ResourceAttributes& constAttrs = resourceAttributes;
+ const RCSResourceAttributes& constAttrs = resourceAttributes;
auto iter = constAttrs.begin();
- ASSERT_TRUE((std::is_same<decltype(iter), ResourceAttributes::const_iterator>::value));
+ ASSERT_TRUE((std::is_same<decltype(iter), RCSResourceAttributes::const_iterator>::value));
}
TEST(ResourceAttributesValueTest, MovedValueHasNull)
{
- ResourceAttributes::Value one { 1 };
- ResourceAttributes::Value another { std::move(one) };
+ RCSResourceAttributes::Value one { 1 };
+ RCSResourceAttributes::Value another { std::move(one) };
ASSERT_EQ(nullptr, one);
}
TEST(ResourceAttributesValueTest, MovedValueWithAssignmentHasNull)
{
- ResourceAttributes::Value one { 1 };
- ResourceAttributes::Value another;
+ RCSResourceAttributes::Value one { 1 };
+ RCSResourceAttributes::Value another;
another = std::move(one);
TEST(ResourceAttributesValueTest, SameValuesAreEqual)
{
- ResourceAttributes::Value one { 1 };
- ResourceAttributes::Value another { 1 };
+ RCSResourceAttributes::Value one { 1 };
+ RCSResourceAttributes::Value another { 1 };
ASSERT_EQ(one, another);
}
TEST(ResourceAttributesValueTest, DifferentValuesAreNotEqual)
{
- ResourceAttributes::Value one { 1 };
- ResourceAttributes::Value another { 2 };
+ RCSResourceAttributes::Value one { 1 };
+ RCSResourceAttributes::Value another { 2 };
ASSERT_NE(one, another);
}
constexpr int i { 1 };
constexpr char str[]{ "abc" };
- ResourceAttributes::Value intValue { i };
- ResourceAttributes::Value strValue { str };
+ RCSResourceAttributes::Value intValue { i };
+ RCSResourceAttributes::Value strValue { str };
intValue.swap(strValue);
TEST(ResourceAttributesTypeTest, TypeIdMatchesTypeOfValue)
{
- ResourceAttributes::Value intValue { 1 };
+ RCSResourceAttributes::Value intValue { 1 };
- ASSERT_EQ(intValue.getType().getId(), ResourceAttributes::TypeId::INT);
+ ASSERT_EQ(intValue.getType().getId(), RCSResourceAttributes::TypeId::INT);
}
TEST(ResourceAttributesTypeTest, TypeCanBeConstructedFromValue)
{
- ResourceAttributes::Value intValue { 1 };
+ RCSResourceAttributes::Value intValue { 1 };
- ResourceAttributes::Type t = ResourceAttributes::Type::typeOf(0);
+ RCSResourceAttributes::Type t = RCSResourceAttributes::Type::typeOf(0);
ASSERT_EQ(intValue.getType(), t);
}
OC::OCRepresentation ocRep;
ocRep[KEY] = value;
- ResourceAttributes resourceAttributes = ResourceAttributesConverter::fromOCRepresentation(ocRep);
+ RCSResourceAttributes resourceAttributes{
+ ResourceAttributesConverter::fromOCRepresentation(ocRep) };
ASSERT_TRUE(value == resourceAttributes[KEY]);
}
nested[KEY] = nested_value;
ocRep[KEY] = nested;
- ResourceAttributes resourceAttributes = ResourceAttributesConverter::fromOCRepresentation(ocRep);
+ RCSResourceAttributes resourceAttributes{
+ ResourceAttributesConverter::fromOCRepresentation(ocRep) };
- ASSERT_TRUE(nested_value == resourceAttributes[KEY].get<ResourceAttributes>()[KEY]);
+ ASSERT_TRUE(nested_value == resourceAttributes[KEY].get<RCSResourceAttributes>()[KEY]);
}
TEST(ResourceAttributesConverterTest, ResourceAttributesCanBeConvertedIntoOCRepresentation)
{
double value { 3453453 };
- ResourceAttributes resourceAttributes;
+ RCSResourceAttributes resourceAttributes;
resourceAttributes[KEY] = value;
- OC::OCRepresentation ocRep = ResourceAttributesConverter::toOCRepresentation(resourceAttributes);
+ OC::OCRepresentation ocRep{
+ ResourceAttributesConverter::toOCRepresentation(resourceAttributes) };
ASSERT_TRUE(value == ocRep[KEY].getValue<double>());
}
TEST(ResourceAttributesConverterTest, NestedResourceAttributesCanBeConvertedIntoOCRepresentation)
{
std::string nested_value { "nested" };
- ResourceAttributes resourceAttributes;
- ResourceAttributes nested;
+ RCSResourceAttributes resourceAttributes;
+ RCSResourceAttributes nested;
nested[KEY] = nested_value;
resourceAttributes[KEY] = nested;
- OC::OCRepresentation ocRep = ResourceAttributesConverter::toOCRepresentation(resourceAttributes);
+ OC::OCRepresentation ocRep{
+ ResourceAttributesConverter::toOCRepresentation(resourceAttributes) };
- ASSERT_TRUE(nested_value == ocRep[KEY].getValue<OC::OCRepresentation>()[KEY].getValue<std::string>());
+ ASSERT_EQ(nested_value,
+ ocRep[KEY].getValue<OC::OCRepresentation>()[KEY].getValue<std::string>());
}
TEST(ResourceAttributesConverterTest, OCRepresentationNullTypeIsNullptrInResourceAttributes)
OC::OCRepresentation ocRep;
ocRep.setNULL(KEY);
- ResourceAttributes resourceAttributes = ResourceAttributesConverter::fromOCRepresentation(ocRep);
+ RCSResourceAttributes resourceAttributes{
+ ResourceAttributesConverter::fromOCRepresentation(ocRep) };
ASSERT_EQ(nullptr, resourceAttributes[KEY]);
}
TEST(ResourceAttributesConverterTest, OCRepresentationHasNullWhenResourceAttributeIsNullptr)
{
- ResourceAttributes resourceAttributes;
+ RCSResourceAttributes resourceAttributes;
resourceAttributes[KEY] = nullptr;
- OC::OCRepresentation ocRep = ResourceAttributesConverter::toOCRepresentation(resourceAttributes);
+ OC::OCRepresentation ocRep{
+ ResourceAttributesConverter::toOCRepresentation(resourceAttributes) };
ASSERT_TRUE(ocRep.isNULL(KEY));
}
class ResourceAttributesUtilTest: public Test
{
public:
- ResourceAttributes resourceAttributes;
+ RCSResourceAttributes resourceAttributes;
protected:
void SetUp()
TEST_F(ResourceAttributesUtilTest, EmptyAttributesIsAcceptable)
{
- ASSERT_TRUE(acceptableAttributes(resourceAttributes, ResourceAttributes()));
+ ASSERT_TRUE(acceptableAttributes(resourceAttributes, RCSResourceAttributes()));
}
TEST_F(ResourceAttributesUtilTest, AttributesItselfIsAcceptable)
TEST_F(ResourceAttributesUtilTest, UnknownKeyIsNotAcceptable)
{
- ResourceAttributes newAttrs;
+ RCSResourceAttributes newAttrs;
newAttrs["unknown"] = 1;
ASSERT_FALSE(acceptableAttributes(resourceAttributes, newAttrs));
TEST_F(ResourceAttributesUtilTest, DifferentTypeWithOriginalIsNotAcceptable)
{
- ResourceAttributes newAttrs;
+ RCSResourceAttributes newAttrs;
newAttrs[KEY] = "";
ASSERT_FALSE(acceptableAttributes(resourceAttributes, newAttrs));
constexpr char KEY_NESTED_ATTR[]{ "nested" };
constexpr char KEY_NESTED_VALUE[]{ "nested_value" };
- ResourceAttributes nested;
+ RCSResourceAttributes nested;
nested[KEY_NESTED_VALUE] = -99;
resourceAttributes[KEY_NESTED_ATTR] = nested;
- ResourceAttributes newAttrs;
+ RCSResourceAttributes newAttrs;
nested[KEY_NESTED_VALUE] = "abc";
newAttrs[KEY_NESTED_ATTR] = nested;
{
constexpr char NEW_VALUE[]{ "newValue" };
- ResourceAttributes newAttrs;
+ RCSResourceAttributes newAttrs;
newAttrs[KEY] = NEW_VALUE;
replaceAttributes(resourceAttributes, newAttrs);
#include "PrimitiveResource.h"
#include "ResponseStatement.h"
-#include "ResourceAttributes.h"
+#include "RCSResourceAttributes.h"
#include "ResourcePresence.h"
#include "UnitTestHelper.h"
[](GetCallback callback){
OIC::Service::HeaderOptions op;
- ResourceAttributes attr;
+ RCSResourceAttributes attr;
OIC::Service::ResponseStatement res(attr);
callback(op,res,OC_STACK_OK);
#include "logger.h"
#include "PrimitiveResource.h"
-#include "ResourceAttributes.h"
+#include "RCSResourceAttributes.h"
namespace OIC
{
typedef int CacheID;
typedef std::function<OCStackResult(std::shared_ptr<PrimitiveResource>,
- const ResourceAttributes &)> CacheCB;
+ const RCSResourceAttributes &)> CacheCB;
typedef std::map<int, std::pair<Report_Info, CacheCB>> SubscriberInfo;
typedef std::pair<int, std::pair<Report_Info, CacheCB>> SubscriberInfoPair;
CacheID deleteSubscriber(CacheID id);
CACHE_STATE getCacheState() const;
- const ResourceAttributes getCachedData() const;
+ const RCSResourceAttributes getCachedData() const;
const PrimitiveResourcePtr getPrimitiveResource() const;
void requestGet();
std::shared_ptr<BaseResource> baseHandler;
// cached data info
- ResourceAttributes attributes;
+ RCSResourceAttributes attributes;
CACHE_STATE state;
// subscriber info
CacheID generateCacheID();
SubscriberInfoPair findSubscriber(CacheID id);
- void notifyObservers(ResourceAttributes Att);
+ void notifyObservers(RCSResourceAttributes Att);
};
} // namespace Service
} // namespace OIC
void updateResourceCache(PrimitiveResourcePtr pResource) const;
void updateResourceCache(CacheID id) const;
- const ResourceAttributes getCachedData(PrimitiveResourcePtr pResource) const;
- const ResourceAttributes getCachedData(CacheID id) const;
+ const RCSResourceAttributes getCachedData(PrimitiveResourcePtr pResource) const;
+ const RCSResourceAttributes getCachedData(CacheID id) const;
CACHE_STATE getResourceCacheState(PrimitiveResourcePtr pResource) const;
CACHE_STATE getResourceCacheState(CacheID id) const;
#include "DataCache.h"
#include "ResponseStatement.h"
-#include "ResourceAttributes.h"
+#include "RCSResourceAttributes.h"
#include "ExpiryTimer.h"
namespace OIC
return (sResource != nullptr) ? sResource : nullptr;
}
- const ResourceAttributes DataCache::getCachedData() const
+ const RCSResourceAttributes DataCache::getCachedData() const
{
if (state != CACHE_STATE::READY || attributes.empty())
{
- return ResourceAttributes();
+ return RCSResourceAttributes();
}
- const ResourceAttributes retAtt = attributes;
+ const RCSResourceAttributes retAtt = attributes;
return retAtt;
}
notifyObservers(_rep.getAttributes());
}
- void DataCache::notifyObservers(ResourceAttributes Att)
+ void DataCache::notifyObservers(RCSResourceAttributes Att)
{
if (attributes == Att)
{
attributes = Att;
- ResourceAttributes retAtt = Att;
+ RCSResourceAttributes retAtt = Att;
for (auto &i : * subscriberList)
{
if (i.second.first.rf == REPORT_FREQUENCY::UPTODATE)
foundCache->requestGet();
}
- const ResourceAttributes ResourceCacheManager::getCachedData(
+ const RCSResourceAttributes ResourceCacheManager::getCachedData(
PrimitiveResourcePtr pResource) const
{
if (pResource == nullptr)
return handler->getCachedData();
}
- const ResourceAttributes ResourceCacheManager::getCachedData(CacheID id) const
+ const RCSResourceAttributes ResourceCacheManager::getCachedData(CacheID id) const
{
if (id == 0)
{
#include "ResourceCacheManager.h"
#include "DataCache.h"
-#include "ResourceAttributes.h"
+#include "RCSResourceAttributes.h"
#include "ResponseStatement.h"
#include "UnitTestHelper.h"
TestWithMock::SetUp();
pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource *) {});
cacheHandler = new DataCache();
- cb = ([](std::shared_ptr<PrimitiveResource >, const ResourceAttributes &)->OCStackResult {return OC_STACK_OK;});
+ cb = ([](std::shared_ptr<PrimitiveResource >, const RCSResourceAttributes &)->OCStackResult {return OC_STACK_OK;});
}
virtual void TearDown()
{
OIC::Service::HeaderOptions hos;
- OIC::Service::ResourceAttributes attr;
+ OIC::Service::RCSResourceAttributes attr;
OIC::Service::ResponseStatement rep(attr);
callback(hos, rep, OC_STACK_OK);
return;
[](ObserveCallback callback)
{
OIC::Service::HeaderOptions hos;
- OIC::Service::ResourceAttributes attr;
+ OIC::Service::RCSResourceAttributes attr;
OIC::Service::ResponseStatement rep(attr);
int seq;
callback(hos, rep, OC_STACK_OK, seq);
{
OIC::Service::HeaderOptions hos;
- OIC::Service::ResourceAttributes attr;
+ OIC::Service::RCSResourceAttributes attr;
OIC::Service::ResponseStatement rep(attr);
callback(hos, rep, OC_STACK_OK);
return;
cacheHandler->initializeDataCache(pResource);
- ASSERT_EQ(cacheHandler->getCachedData(), ResourceAttributes());
+ ASSERT_EQ(cacheHandler->getCachedData(), RCSResourceAttributes());
}
TEST_F(DataCacheTest, getPrimitiveResource_normalCase)
std::cout << "HelloWorld" << std::endl;
OIC::Service::HeaderOptions hos;
- OIC::Service::ResourceAttributes attr;
- //attr = mocks.Mcok< OIC::Service::ResourceAttributes >();
+ OIC::Service::RCSResourceAttributes attr;
+ //attr = mocks.Mcok< OIC::Service::RCSResourceAttributes >();
OIC::Service::ResponseStatement rep(attr);
//rep = mocks.Mock< OIC::Service::ResponseStatement >(attr);
//fakeResource = mocks.Mock< FakeOCResource >();
- //mocks.OnCallFunc(ResourceAttributes::empty()).Return(false);
+ //mocks.OnCallFunc(RCSResourceAttributes::empty()).Return(false);
callback(hos, rep, OC_STACK_OK);
return;
}
cacheHandler->initializeDataCache(pResource);
cacheHandler->requestGet();
-}
\ No newline at end of file
+}
TestWithMock::SetUp();
cacheInstance = ResourceCacheManager::getInstance();
pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource *) {});
- cb = ([](std::shared_ptr<PrimitiveResource >, const ResourceAttributes &)->OCStackResult {return OC_STACK_OK;});
+ cb = ([](std::shared_ptr<PrimitiveResource >, const RCSResourceAttributes &)->OCStackResult {return OC_STACK_OK;});
}
virtual void TearDown()
cacheInstance->cancelResourceCache(id);
ASSERT_EQ(state, CACHE_STATE::READY_YET);
-}
\ No newline at end of file
+}
#include <vector>
#include "NotificationReceiver.h"
-#include "ResourceAttributes.h"
+#include "RCSResourceAttributes.h"
using namespace std;
/**
* Return all attributes of the resource
*
- * @return ResourceAttributes - attributes of the resource
+ * @return RCSResourceAttributes - attributes of the resource
*/
- virtual ResourceAttributes &getAttributes();
+ virtual RCSResourceAttributes &getAttributes();
/**
* Execute the logic of bundle to set the value of attribute
*
* @return void
*/
- virtual void setAttribute(std::string key, ResourceAttributes::Value &&value);
+ virtual void setAttribute(std::string key, RCSResourceAttributes::Value &&value);
/**
* Execute the logic of bundle to get the value of attribute
*
* @param key - key of attribute to get
*
- * @return ResourceAttributes::Value - return value of the attribute
+ * @return RCSResourceAttributes::Value - return value of the attribute
*/
- virtual ResourceAttributes::Value getAttribute(const std::string &key);
+ virtual RCSResourceAttributes::Value getAttribute(const std::string &key);
public:
private:
NotificationReceiver *m_pNotiReceiver;
- ResourceAttributes m_resourceAttributes;
+ RCSResourceAttributes m_resourceAttributes;
};
}
/**
* Return all attributes of the resource
*
- * @return ResourceAttributes - attributes of the resource
+ * @return RCSResourceAttributes - attributes of the resource
*/
- virtual ResourceAttributes &getAttributes() = 0;
+ virtual RCSResourceAttributes &getAttributes() = 0;
/**
* Execute the logic of bundle to set the value of attribute
*
* @return void
*/
- virtual void setAttribute(std::string key, ResourceAttributes::Value &&value) = 0;
+ virtual void setAttribute(std::string key, RCSResourceAttributes::Value &&value) = 0;
/**
* Execute the logic of bundle to get the value of attribute
*
* @param key - key of attribute to get
*
- * @return ResourceAttributes::Value - return value of the attribute
+ * @return RCSResourceAttributes::Value - return value of the attribute
*/
- virtual ResourceAttributes::Value getAttribute(const std::string &key) = 0;
+ virtual RCSResourceAttributes::Value getAttribute(const std::string &key) = 0;
};
}
}
/**
* Return all attributes of the resource
*
- * @return ResourceAttributes - attributes of the resource
+ * @return RCSResourceAttributes - attributes of the resource
*/
- virtual ResourceAttributes &getAttributes() = 0;
+ virtual RCSResourceAttributes &getAttributes() = 0;
/**
* Execute the logic of bundle to set the value of attribute
*
* @return void
*/
- virtual void setAttribute(std::string key, ResourceAttributes::Value &&value) = 0;
+ virtual void setAttribute(std::string key,
+ RCSResourceAttributes::Value &&value) = 0;
/**
* Execute the logic of bundle to get the value of attribute
*
* @param key - key of attribute to get
*
- * @return ResourceAttributes::Value - return value of the attribute
+ * @return RCSResourceAttributes::Value - return value of the attribute
*/
- virtual ResourceAttributes::Value getAttribute(const std::string &key) = 0;
+ virtual RCSResourceAttributes::Value getAttribute(const std::string &key) = 0;
/**
* Set Input data to update output value of the soft sensor
HueLight(HueConnector* connector, std::string address);
virtual ~HueLight();
virtual void initAttributes();
- virtual ResourceAttributes& getAttributes();
+ virtual RCSResourceAttributes& getAttributes();
- virtual void setAttribute(std::string key, ResourceAttributes::Value&&);
+ virtual void setAttribute(std::string key, RCSResourceAttributes::Value&&);
- virtual ResourceAttributes::Value getAttribute(const std::string& key);
+ virtual RCSResourceAttributes::Value getAttribute(const std::string& key);
private:
std::string m_address;
HueConnector* m_connector;
BundleResource::setAttribute("color", 0);
}
-ResourceAttributes& HueLight::getAttributes(){
+RCSResourceAttributes& HueLight::getAttributes(){
return BundleResource::getAttributes();
}
-ResourceAttributes::Value HueLight::getAttribute(const std::string& key){
+RCSResourceAttributes::Value HueLight::getAttribute(const std::string& key){
cout << "HueLight::getAttribute called for " << key << " called" << endl;
return BundleResource::getAttribute(key);
}
-void HueLight::setAttribute(std::string attributeName, ResourceAttributes::Value&& value){
+void HueLight::setAttribute(std::string attributeName, RCSResourceAttributes::Value&& value){
cout << "HueLight::setAttribute setting " << attributeName << " to " << value.toString() << std::endl;
if (attributeName == "on-off")
~DiscomfortIndexSensorResource();
virtual void initAttributes();
- virtual ResourceAttributes &getAttributes();
- virtual void setAttribute(std::string key, ResourceAttributes::Value &&value);
- virtual ResourceAttributes::Value getAttribute(const std::string &key);
+ virtual RCSResourceAttributes &getAttributes();
+ virtual void setAttribute(std::string key, RCSResourceAttributes::Value &&value);
+ virtual RCSResourceAttributes::Value getAttribute(const std::string &key);
void setInputAttribute(SensorData input);
BundleResource::setAttribute("discomfortIndex", "5");
}
-ResourceAttributes &DiscomfortIndexSensorResource::getAttributes()
+RCSResourceAttributes &DiscomfortIndexSensorResource::getAttributes()
{
return BundleResource::getAttributes();
}
-ResourceAttributes::Value DiscomfortIndexSensorResource::getAttribute(const std::string &key)
+RCSResourceAttributes::Value DiscomfortIndexSensorResource::getAttribute(const std::string &key)
{
cout << "DiscomfortIndexSensorResource::getAttribute called for " << key << " called" << endl;
return BundleResource::getAttribute(key);
}
-void DiscomfortIndexSensorResource::setAttribute(std::string key, ResourceAttributes::Value &&value)
+void DiscomfortIndexSensorResource::setAttribute(std::string key, RCSResourceAttributes::Value &&value)
{
cout << "DiscomfortIndexSensorResource::setAttribute setting " << key << " to " << value.toString()
<< std::endl;
{
if (!m_outputs.data.at(i)["name"].compare("temperature"))
BundleResource::setAttribute("temperature",
- ResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str()));
+ RCSResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str()));
else if (!m_outputs.data.at(i)["name"].compare("humidity"))
BundleResource::setAttribute("humidity",
- ResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str()));
+ RCSResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str()));
else if (!m_outputs.data.at(i)["name"].compare("discomfortIndex"))
BundleResource::setAttribute("discomfortIndex",
- ResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str()));
+ RCSResourceAttributes::Value(m_outputs.data.at(i)["value"].c_str()));
}
}
}
jobjectArray attributes);
virtual ~JavaBundleResource();
- virtual ResourceAttributes& getAttributes();
+ virtual RCSResourceAttributes& getAttributes();
- virtual void setAttribute(std::string key, ResourceAttributes::Value&&);
+ virtual void setAttribute(std::string key, RCSResourceAttributes::Value&&);
- virtual ResourceAttributes::Value getAttribute(const std::string& key);
+ virtual RCSResourceAttributes::Value getAttribute(const std::string& key);
virtual void initAttributes();
private:
// needs to be a GlobalRef
std::vector< resourceInfo > *configOutput);
RCSGetResponse getRequestHandler(const RCSRequest &request,
- const ResourceAttributes &attributes);
+ const RCSResourceAttributes &attributes);
RCSSetResponse setRequestHandler(const RCSRequest &request,
- const ResourceAttributes &attributes);
+ const RCSResourceAttributes &attributes);
void onNotificationReceived(const std::string &strResourceUri);
std::list< string > BundleResource::getAttributeNames()
{
std::list< string > ret;
- for (ResourceAttributes::iterator it = m_resourceAttributes.begin(); it != m_resourceAttributes.end(); ++it){
+ for (RCSResourceAttributes::iterator it = m_resourceAttributes.begin(); it != m_resourceAttributes.end(); ++it){
ret.push_back(it->key());
}
return ret;
}
- ResourceAttributes& BundleResource::getAttributes(){
+ RCSResourceAttributes& BundleResource::getAttributes(){
return m_resourceAttributes;
}
- void BundleResource::setAttribute(std::string key, ResourceAttributes::Value&& value)
+ void BundleResource::setAttribute(std::string key, RCSResourceAttributes::Value&& value)
{
cout << "Bundle resource set attribute " << value.toString() << "|" << endl;
m_resourceAttributes[key] = value;
}
- ResourceAttributes::Value BundleResource::getAttribute(const std::string& key){
+ RCSResourceAttributes::Value BundleResource::getAttribute(const std::string& key){
cout << "Bundle resource get attribute " << m_resourceAttributes.at(key).toString() << "|" << endl;
return m_resourceAttributes.at(key);
}
}
- ResourceAttributes& JavaBundleResource::getAttributes(){
+ RCSResourceAttributes& JavaBundleResource::getAttributes(){
return BundleResource::getAttributes();
}
- ResourceAttributes::Value JavaBundleResource::getAttribute(const std::string& attributeName)
+ RCSResourceAttributes::Value JavaBundleResource::getAttribute(const std::string& attributeName)
{
JavaVM* vm = ResourceContainerImpl::getImplInstance()->getJavaVM(m_bundleId);
const char *js = env->GetStringUTFChars(returnString, NULL);
std::string val(js);
- ResourceAttributes::Value newVal = val;
+ RCSResourceAttributes::Value newVal = val;
env->ReleaseStringUTFChars(returnString, js);
BundleResource::setAttribute(attributeName, newVal.toString());
return BundleResource::getAttribute(attributeName);
}
- void JavaBundleResource::setAttribute(std::string attributeName, ResourceAttributes::Value&& value)
+ void JavaBundleResource::setAttribute(std::string attributeName, RCSResourceAttributes::Value&& value)
{
JavaVM* vm = ResourceContainerImpl::getImplInstance()->getJavaVM(m_bundleId);
}
RCSGetResponse ResourceContainerImpl::getRequestHandler(const RCSRequest &request,
- const ResourceAttributes &attributes)
+ const RCSResourceAttributes &attributes)
{
- ResourceAttributes attr;
+ RCSResourceAttributes attr;
if (m_mapServers.find(request.getResourceUri()) != m_mapServers.end()
&& m_mapResources.find(request.getResourceUri()) != m_mapResources.end())
}
RCSSetResponse ResourceContainerImpl::setRequestHandler(const RCSRequest &request,
- const ResourceAttributes &attributes)
+ const RCSResourceAttributes &attributes)
{
- ResourceAttributes attr = attributes;
+ RCSResourceAttributes attr = attributes;
if (m_mapServers.find(request.getResourceUri()) != m_mapServers.end()
&& m_mapResources.find(request.getResourceUri()) != m_mapResources.end())
RequestHandler(const OCEntityHandlerResult& result, int errorCode);
- RequestHandler(const ResourceAttributes&,
+ RequestHandler(const RCSResourceAttributes&,
const OCEntityHandlerResult& result = DEFAULT_RESULT,
int errorCode = DEFAULT_ERROR_CODE);
- RequestHandler(ResourceAttributes&&,
+ RequestHandler(RCSResourceAttributes&&,
const OCEntityHandlerResult& result = DEFAULT_RESULT,
int errorCode = DEFAULT_ERROR_CODE);
SetRequestHandler(const OCEntityHandlerResult& result, int errorCode);
- SetRequestHandler(const ResourceAttributes&,
+ SetRequestHandler(const RCSResourceAttributes&,
const OCEntityHandlerResult& result = DEFAULT_RESULT,
int errorCode = DEFAULT_ERROR_CODE);
- SetRequestHandler(ResourceAttributes&&,
+ SetRequestHandler(RCSResourceAttributes&&,
const OCEntityHandlerResult& result = DEFAULT_RESULT,
int errorCode = DEFAULT_ERROR_CODE);
AttrKeyValuePairs applyAcceptanceMethod(RCSSetResponse::AcceptanceMethod,
- RCSResourceObject&, const ResourceAttributes&) const;
+ RCSResourceObject&, const RCSResourceAttributes&) const;
};
}
return OC_EH_ERROR;
}
- ResourceAttributes getAttributesFromOCRequest(std::shared_ptr< OC::OCResourceRequest > request)
+ RCSResourceAttributes getAttributesFromOCRequest(
+ std::shared_ptr< OC::OCResourceRequest > request)
{
return ResourceAttributesConverter::fromOCRepresentation(
request->getResourceRepresentation());
}
- template< typename HANDLER, typename RESPONSE = typename std::decay<HANDLER>::type::result_type >
- RESPONSE invokeHandler(ResourceAttributes& attrs,
+ template< typename HANDLER, typename RESPONSE =
+ typename std::decay<HANDLER>::type::result_type >
+ RESPONSE invokeHandler(RCSResourceAttributes& attrs,
std::shared_ptr< OC::OCResourceRequest > ocRequest, HANDLER&& handler)
{
if (handler)
return RESPONSE::defaultAction();
}
- typedef void (RCSResourceObject::* AutoNotifyFunc)(bool, RCSResourceObject::AutoNotifyPolicy) const;
+ typedef void (RCSResourceObject::* AutoNotifyFunc)
+ (bool, RCSResourceObject::AutoNotifyPolicy) const;
std::function <void ()> createAutoNotifyInvoker(AutoNotifyFunc autoNotifyFunc,
- const RCSResourceObject& resourceObject, const ResourceAttributes& resourceAttributes,
+ const RCSResourceObject& resourceObject, const RCSResourceAttributes& resourceAttributes,
RCSResourceObject::AutoNotifyPolicy autoNotifyPolicy)
{
if(autoNotifyPolicy == RCSResourceObject::AutoNotifyPolicy::UPDATED)
{
auto&& compareAttributesFunc =
- std::bind(std::not_equal_to<ResourceAttributes>(),
+ std::bind(std::not_equal_to<RCSResourceAttributes>(),
resourceAttributes,
std::cref(resourceAttributes));
return std::bind(autoNotifyFunc,
}
RCSResourceObject::Builder& RCSResourceObject::Builder::setAttributes(
- const ResourceAttributes& attrs)
+ const RCSResourceAttributes& attrs)
{
m_resourceAttributes = attrs;
return *this;
}
RCSResourceObject::Builder& RCSResourceObject::Builder::setAttributes(
- ResourceAttributes&& attrs)
+ RCSResourceAttributes&& attrs)
{
m_resourceAttributes = std::move(attrs);
return *this;
}
- RCSResourceObject::RCSResourceObject(uint8_t properties, ResourceAttributes&& attrs) :
+ RCSResourceObject::RCSResourceObject(uint8_t properties, RCSResourceAttributes&& attrs) :
m_properties { properties },
m_resourceHandle{ },
m_resourceAttributes{ std::move(attrs) },
}
void RCSResourceObject::setAttribute(const std::string& key,
- const ResourceAttributes::Value& value)
+ const RCSResourceAttributes::Value& value)
{
WeakGuard lock(*this);
m_resourceAttributes[key] = value;
}
- void RCSResourceObject::setAttribute(const std::string& key, ResourceAttributes::Value&& value)
+ void RCSResourceObject::setAttribute(const std::string& key,
+ RCSResourceAttributes::Value&& value)
{
WeakGuard lock(*this);
m_resourceAttributes[key] = std::move(value);
}
- void RCSResourceObject::setAttribute(std::string&& key, const ResourceAttributes::Value& value)
+ void RCSResourceObject::setAttribute(std::string&& key,
+ const RCSResourceAttributes::Value& value)
{
WeakGuard lock(*this);
m_resourceAttributes[std::move(key)] = value;
}
- void RCSResourceObject::setAttribute(std::string&& key, ResourceAttributes::Value&& value)
+ void RCSResourceObject::setAttribute(std::string&& key,
+ RCSResourceAttributes::Value&& value)
{
WeakGuard lock(*this);
m_resourceAttributes[std::move(key)] = std::move(value);
}
- ResourceAttributes::Value RCSResourceObject::getAttributeValue(const std::string& key) const
+ RCSResourceAttributes::Value RCSResourceObject::getAttributeValue(
+ const std::string& key) const
{
WeakGuard lock(*this);
return m_resourceAttributes.at(key);
return m_resourceAttributes.contains(key);
}
- ResourceAttributes& RCSResourceObject::getAttributes()
+ RCSResourceAttributes& RCSResourceObject::getAttributes()
{
expectOwnLock();
return m_resourceAttributes;
}
- const ResourceAttributes& RCSResourceObject::getAttributes() const
+ const RCSResourceAttributes& RCSResourceObject::getAttributes() const
{
expectOwnLock();
return m_resourceAttributes;
}
void RCSResourceObject::autoNotifyIfNeeded(const std::string& key,
- const ResourceAttributes::Value& value)
+ const RCSResourceAttributes::Value& value)
{
autoNotify( m_resourceAttributes.contains(key) == false
|| m_resourceAttributes.at(key) != value
m_setRequestHandlerPolicy = policy;
}
- RCSResourceObject::SetRequestHandlerPolicy RCSResourceObject::getSetRequestHandlerPolicy() const
+ auto RCSResourceObject::getSetRequestHandlerPolicy() const -> SetRequestHandlerPolicy
{
return m_setRequestHandlerPolicy;
}
std::make_shared< RequestHandler >( result, errorCode) };
}
- RCSGetResponse RCSGetResponse::create(const ResourceAttributes& attrs)
+ RCSGetResponse RCSGetResponse::create(const RCSResourceAttributes& attrs)
{
return RCSGetResponse { std::make_shared< RequestHandler >(attrs) };
}
- RCSGetResponse RCSGetResponse::create(const ResourceAttributes& attrs,
+ RCSGetResponse RCSGetResponse::create(const RCSResourceAttributes& attrs,
const OCEntityHandlerResult& result, int errorCode)
{
return RCSGetResponse {
std::make_shared< RequestHandler >(attrs, result, errorCode) };
}
- RCSGetResponse RCSGetResponse::create(ResourceAttributes&& result)
+ RCSGetResponse RCSGetResponse::create(RCSResourceAttributes&& result)
{
return RCSGetResponse {
std::make_shared< RequestHandler >(std::move(result)) };
}
- RCSGetResponse RCSGetResponse::create(ResourceAttributes&& attrs,
+ RCSGetResponse RCSGetResponse::create(RCSResourceAttributes&& attrs,
const OCEntityHandlerResult& result, int errorCode)
{
return RCSGetResponse { std::make_shared< RequestHandler >(
return std::make_shared< SetRequestHandler >(result, errorCode);
}
- RCSSetResponse RCSSetResponse::create(const ResourceAttributes& attrs)
+ RCSSetResponse RCSSetResponse::create(const RCSResourceAttributes& attrs)
{
return std::make_shared< SetRequestHandler >(attrs);
}
- RCSSetResponse RCSSetResponse::create(const ResourceAttributes& attrs,
+ RCSSetResponse RCSSetResponse::create(const RCSResourceAttributes& attrs,
const OCEntityHandlerResult& result, int errorCode)
{
return std::make_shared< SetRequestHandler >(attrs, result, errorCode);
}
- RCSSetResponse RCSSetResponse::create(ResourceAttributes&& result)
+ RCSSetResponse RCSSetResponse::create(RCSResourceAttributes&& result)
{
return std::make_shared< SetRequestHandler >(std::move(result));
}
- RCSSetResponse RCSSetResponse::create(ResourceAttributes&& attrs,
+ RCSSetResponse RCSSetResponse::create(RCSResourceAttributes&& attrs,
const OCEntityHandlerResult& result, int errorCode)
{
return std::make_shared< SetRequestHandler >(std::move(attrs), result, errorCode);
return ResourceAttributesConverter::toOCRepresentation(resource.getAttributes());
}
- OC::OCRepresentation getOCRepresentation(const ResourceAttributes& attrs)
+ OC::OCRepresentation getOCRepresentation(const RCSResourceAttributes& attrs)
{
return ResourceAttributesConverter::toOCRepresentation(attrs);
}
}
AttrKeyValuePairs applyAcceptMethod(RCSResourceObject& resource,
- const ResourceAttributes& requestAttrs)
+ const RCSResourceAttributes& requestAttrs)
{
RCSResourceObject::LockGuard lock(resource, RCSResourceObject::AutoNotifyPolicy::NEVER);
}
AttrKeyValuePairs applyDefaultMethod(RCSResourceObject& resource,
- const ResourceAttributes& requestAttrs)
+ const RCSResourceAttributes& requestAttrs)
{
RCSResourceObject::LockGuard lock(resource, RCSResourceObject::AutoNotifyPolicy::NEVER);
return replaceAttributes(resource.getAttributes(), requestAttrs);
}
- AttrKeyValuePairs applyIgnoreMethod(RCSResourceObject&, const ResourceAttributes&)
+ AttrKeyValuePairs applyIgnoreMethod(RCSResourceObject&, const RCSResourceAttributes&)
{
return AttrKeyValuePairs();
}
auto getApplyAcceptanceFunc(RCSSetResponse::AcceptanceMethod method) ->
- std::function<AttrKeyValuePairs(RCSResourceObject&, const ResourceAttributes&)>
+ std::function<AttrKeyValuePairs(RCSResourceObject&, const RCSResourceAttributes&)>
{
switch (method)
{
{
}
- RequestHandler::RequestHandler(const ResourceAttributes& attrs,
+ RequestHandler::RequestHandler(const RCSResourceAttributes& attrs,
const OCEntityHandlerResult& result, int errorCode) :
m_holder{ std::bind(doBuildResponse, std::placeholders::_1, result, errorCode,
wrapGetOCRepresentation(attrs)) }
{
}
- RequestHandler::RequestHandler(ResourceAttributes&& attrs,
+ RequestHandler::RequestHandler(RCSResourceAttributes&& attrs,
const OCEntityHandlerResult& result, int errorCode) :
m_holder{ std::bind(doBuildResponse, std::placeholders::_1, result, errorCode,
wrapGetOCRepresentation(std::move(attrs))) }
}
- SetRequestHandler::SetRequestHandler(const ResourceAttributes& attrs,
+ SetRequestHandler::SetRequestHandler(const RCSResourceAttributes& attrs,
const OCEntityHandlerResult& result, int errorCode) :
RequestHandler{ attrs, result, errorCode }
{
}
- SetRequestHandler::SetRequestHandler(ResourceAttributes&& attrs,
+ SetRequestHandler::SetRequestHandler(RCSResourceAttributes&& attrs,
const OCEntityHandlerResult& result, int errorCode) :
RequestHandler{ std::move(attrs), result, errorCode }
{
AttrKeyValuePairs SetRequestHandler::applyAcceptanceMethod(
RCSSetResponse::AcceptanceMethod method, RCSResourceObject& resource,
- const ResourceAttributes& requestAttrs) const
+ const RCSResourceAttributes& requestAttrs) const
{
return getApplyAcceptanceFunc(method)(resource, requestAttrs);
}
TEST_F(ResourceObjectBuilderTest, ResourceServerHasAttrsSetByBuilder)
{
- ResourceAttributes attrs;
+ RCSResourceAttributes attrs;
attrs[KEY] = 100;
auto serverResource = RCSResourceObject::Builder(RESOURCE_URI, RESOURCE_TYPE, "").
constexpr OCEntityHandlerResult result{ OC_EH_SLOW };
server->setGetRequestHandler(
- [](const RCSRequest&, ResourceAttributes&) -> RCSGetResponse
+ [](const RCSRequest&, RCSResourceAttributes&) -> RCSGetResponse
{
return RCSGetResponse::create(result, errorCode);
}
constexpr char value[]{ "value" };
server->setSetRequestHandler(
- [](const RCSRequest&, ResourceAttributes&) -> RCSSetResponse
+ [](const RCSRequest&, RCSResourceAttributes&) -> RCSSetResponse
{
- ResourceAttributes attrs;
+ RCSResourceAttributes attrs;
attrs[KEY] = value;
return RCSSetResponse::create(attrs, result, errorCode);
}
OCRepresentation ocRep = createOCRepresentation();
server->addAttributeUpdatedListener(KEY,
- [&called](const OIC::Service::ResourceAttributes::Value&,
- const OIC::Service::ResourceAttributes::Value& )
+ [&called](const OIC::Service::RCSResourceAttributes::Value&,
+ const OIC::Service::RCSResourceAttributes::Value& )
{
called=true;
} );
OCRepresentation ocRep = createOCRepresentation();
server->addAttributeUpdatedListener("key",
- [&called](const OIC::Service::ResourceAttributes::Value&,
- const OIC::Service::ResourceAttributes::Value&)
+ [&called](const OIC::Service::RCSResourceAttributes::Value&,
+ const OIC::Service::RCSResourceAttributes::Value&)
{
called=10;
} );
server->addAttributeUpdatedListener(KEY,
- [&called](const OIC::Service::ResourceAttributes::Value&,
- const OIC::Service::ResourceAttributes::Value&)
+ [&called](const OIC::Service::RCSResourceAttributes::Value&,
+ const OIC::Service::RCSResourceAttributes::Value&)
{
called=100;
} );
TEST_F(AttributeUpdatedListenerTest, RemoveListenerReturnsTrueIfListenerIsAdded)
{
server->addAttributeUpdatedListener(KEY,
- [](const OIC::Service::ResourceAttributes::Value&,
- const OIC::Service::ResourceAttributes::Value&)
+ [](const OIC::Service::RCSResourceAttributes::Value&,
+ const OIC::Service::RCSResourceAttributes::Value&)
{
} );
void EXPECT_RESPONSE(shared_ptr< OCResourceResponse > ocResponse,
- const OCEntityHandlerResult& result, int errorCode, const ResourceAttributes& attrs)
+ const OCEntityHandlerResult& result, int errorCode, const RCSResourceAttributes& attrs)
{
EXPECT_EQ(ocResponse->getResponseResult(), result);
EXPECT_EQ(ocResponse->getErrorCode(), errorCode);
{
EXPECT_RESPONSE(buildResponse(RCSGetResponse::defaultAction()),
RequestHandler::DEFAULT_RESULT, RequestHandler::DEFAULT_ERROR_CODE,
- ResourceAttributes());
+ RCSResourceAttributes());
}
TEST_F(RCSResponseTest, GetResponseHasResultsPassedCodes)
constexpr int errorCode{ -10 };
EXPECT_RESPONSE(buildResponse(RCSGetResponse::create(result, errorCode)),
- result, errorCode, ResourceAttributes());
+ result, errorCode, RCSResourceAttributes());
}
TEST_F(RCSResponseTest, GetResponseHasAttrsAndResultsPassedCodes)
constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
constexpr int errorCode{ -10 };
- ResourceAttributes attrs;
+ RCSResourceAttributes attrs;
attrs[KEY] = 100;
EXPECT_RESPONSE(buildResponse(RCSGetResponse::create(attrs, result, errorCode)),
constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
constexpr int errorCode{ -10 };
- ResourceAttributes attrs;
+ RCSResourceAttributes attrs;
attrs[KEY] = 100;
- ResourceAttributes attrsClone;
+ RCSResourceAttributes attrsClone;
attrsClone[KEY] = 100;
EXPECT_RESPONSE(
{
EXPECT_RESPONSE(buildResponse(RCSSetResponse::defaultAction()),
RequestHandler::DEFAULT_RESULT, RequestHandler::DEFAULT_ERROR_CODE,
- ResourceAttributes());
+ RCSResourceAttributes());
}
TEST_F(RCSResponseTest, SetResponseHasResultsPassedCodes)
constexpr int errorCode{ -10 };
EXPECT_RESPONSE(buildResponse(RCSSetResponse::create(result, errorCode)),
- result, errorCode, ResourceAttributes());
+ result, errorCode, RCSResourceAttributes());
}
TEST_F(RCSResponseTest, SetResponseHasAttrsAndResultsPassedCodes)
constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
constexpr int errorCode{ -10 };
- ResourceAttributes attrs;
+ RCSResourceAttributes attrs;
attrs[KEY] = 100;
EXPECT_RESPONSE(buildResponse(RCSSetResponse::create(attrs, result, errorCode)),
constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
constexpr int errorCode{ -10 };
- ResourceAttributes attrs;
+ RCSResourceAttributes attrs;
attrs[KEY] = 100;
- ResourceAttributes attrsClone;
+ RCSResourceAttributes attrsClone;
attrsClone[KEY] = 100;
EXPECT_RESPONSE(
constexpr char key[] { "key" };
constexpr int newValue{ 100 };
- ResourceAttributes attrs;
+ RCSResourceAttributes attrs;
attrs[key] = newValue;
RequestHandler handler{ attrs };
public:
SetRequestHandler::Ptr setRequestHandler;
- ResourceAttributes requestAttrs;
+ RCSResourceAttributes requestAttrs;
protected:
void SetUp()
TEST_F(SetRequestHandlerAcceptanceTest, NothingHappenedWithEmptyAttrs)
{
setRequestHandler->applyAcceptanceMethod(
- RCSSetResponse::AcceptanceMethod::ACCEPT, *server, ResourceAttributes{ });
+ RCSSetResponse::AcceptanceMethod::ACCEPT, *server, RCSResourceAttributes{ });
ASSERT_EQ(ORIGIN_VALUE, server->getAttribute<int>(EXISTING));
}
std::shared_ptr<RemoteResourceObject> object;
DiscoveryManager *manager = DiscoveryManager::getInstance();
ResourceState receivedResourceState;
-ResourceAttributes receivedResourceAttributes;
+RCSResourceAttributes receivedResourceAttributes;
RCSResourceObject::Ptr server;
void createResource()
}
//Callbacks
-void onRemoteAttrReceived(const ResourceAttributes &attributes)
+void onRemoteAttrReceived(const RCSResourceAttributes &attributes)
{
cbresult = true;
receivedResourceAttributes = attributes;
receivedResourceState = state;
}
-void onCacheUpdated(const ResourceAttributes attribute)
+void onCacheUpdated(const RCSResourceAttributes attribute)
{
receivedResourceAttributes = attribute;
}
-void OnRemoteAttributesSetCallback(const ResourceAttributes &attributes)
+void OnRemoteAttributesSetCallback(const RCSResourceAttributes &attributes)
{
cbresult = true;
}
cbresult = false;
object->getRemoteAttributes(&onRemoteAttrReceived);
sleep(2);
- ResourceAttributes::const_iterator iter = receivedResourceAttributes.begin();
+ RCSResourceAttributes::const_iterator iter = receivedResourceAttributes.begin();
for (unsigned int i = 0; i < receivedResourceAttributes.size(); ++i)
{
if ( iter->key() == "Temperature")
TEST(ResourceClientTest, testGetCachedAttributesWithoutCallback)
{
createResource();
- ResourceAttributes result = object->getCachedAttributes();
+ RCSResourceAttributes result = object->getCachedAttributes();
EXPECT_TRUE(result.empty());
destroyResource();
}
TEST(ResourceClientTest, testGetCachedAttributeWithInvalidAttribute)
{
createResource();
- ResourceAttributes::Value result = object->getCachedAttribute("");
+ RCSResourceAttributes::Value result = object->getCachedAttribute("");
EXPECT_TRUE(result == nullptr);
destroyResource();
}
TEST(ResourceClientTest, testGetCachedAttribute)
{
createResource();
- ResourceAttributes::Value result = object->getCachedAttribute("Temperature");
+ RCSResourceAttributes::Value result = object->getCachedAttribute("Temperature");
EXPECT_TRUE(result != nullptr);
destroyResource();
}
object->stopMonitoring();
}
-//Send invalid ResourceAttributes object to function
+//Send invalid RCSResourceAttributes object to function
TEST(ResourceClientTest, testSetRemoteAttributesInvalidAttributes)
{
createResource();
cbresult = false;
- ResourceAttributes attr;
+ RCSResourceAttributes attr;
//object->getRemoteAttributes(&onRemoteAttrReceived);
object->setRemoteAttributes(attr, &OnRemoteAttributesSetCallback);
EXPECT_FALSE(cbresult);