******************************************************************/
#include "RCSResourceObject.h"
+#include "RCSRequest.h"
#include "OCPlatform.h"
using namespace OC::OCPlatform;
{
assert(min <= max);
- int input;
+ int input = 0;
std::cin >> input;
}
}
-RCSGetResponse requestHandlerForGet(const RCSRequest&, RCSResourceAttributes& attrs)
+RCSGetResponse requestHandlerForGet(const RCSRequest & req, RCSResourceAttributes& attrs)
{
std::cout << "Received a Get request from Client" << std::endl;
printAttributes(attrs);
{
RCSResourceObject::LockGuard lock(g_resource);
std::cout << "\nSending response to Client : " << std::endl;
- printAttributes(g_resource->getAttributes());
+ if (req.getInterface() == CUSTOM_INTERFACE)
+ {
+ auto attr = g_resource->getAttributes();
+ static RCSByteString::DataType binval {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
+ 0x9, 0x0, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF};
+ attr["blob"] = RCSByteString {binval};
+ printAttributes(attr);
+ return RCSGetResponse::create(attr);
+ }
+ else
+ {
+ printAttributes(g_resource->getAttributes());
+ return RCSGetResponse::defaultAction();
+ }
}
-
- return RCSGetResponse::defaultAction();
}
RCSSetResponse requestHandlerForSet(const RCSRequest&, RCSResourceAttributes& attrs)
std::cout << "========================================================\n";
int resourceType = processUserInput(RESOURCE_TEMP, RESOURCE_LIGHT);
- DisplayControlMenuFunc displayMenuFunc;
+ DisplayControlMenuFunc displayMenuFunc = nullptr;
std::string attrKey;
switch (resourceType)
if (g_isPresenceStarted)
{
- stopPresence();
+ try
+ {
+ stopPresence();
+ }
+ catch(...)
+ {
+ std::cout << "presence stop fail" << std::endl;
+ }
}
}