{
//Set the header options here.
uint16_t optionID;
- std::string optionData;
+ char optionData[MAX_HEADER_OPTION_DATA_LENGTH + 1];
HeaderOptions headerOptions;
+ optionData[MAX_HEADER_OPTION_DATA_LENGTH] = '\0';
for(int i = 0;
i < entityHandlerRequest->numRcvdVendorSpecificHeaderOptions;
i++)
{
optionID = entityHandlerRequest->rcvdVendorSpecificHeaderOptions[i].optionID;
- optionData = reinterpret_cast<const char*>
- (entityHandlerRequest->rcvdVendorSpecificHeaderOptions[i].optionData);
+ memcpy(optionData, entityHandlerRequest->rcvdVendorSpecificHeaderOptions[i].optionData,
+ MAX_HEADER_OPTION_DATA_LENGTH);
HeaderOption::OCHeaderOption headerOption(optionID, optionData);
headerOptions.push_back(headerOption);
}
return result;
}
+ OCStackResult InProcServerWrapper::resetResourceTypes(const OCResourceHandle& resourceHandle,
+ const std::string& newResourceType)
+ {
+ auto cLock = m_csdkLock.lock();
+ OCStackResult result;
+ if(cLock)
+ {
+ std::lock_guard<std::recursive_mutex> lock(*cLock);
+ result = OCResetResourceTypes(resourceHandle, newResourceType.c_str());
+ }
+ else
+ {
+ result = OC_STACK_ERROR;
+ }
+
+ if (result != OC_STACK_OK)
+ {
+ throw OCException(OC::Exception::BIND_TYPE_FAILED, result);
+ }
+ return result;
+ }
+
OCStackResult InProcServerWrapper::bindInterfaceToResource(
const OCResourceHandle& resourceHandle,
const std::string& resourceInterfaceName)
return result;
}
+ OCStackResult InProcServerWrapper::resetResourceInterfaces(
+ const OCResourceHandle& resourceHandle,
+ const std::string& newResourceInterface)
+ {
+ auto cLock = m_csdkLock.lock();
+ OCStackResult result;
+ if(cLock)
+ {
+ std::lock_guard<std::recursive_mutex> lock(*cLock);
+ result = OCResetResourceInterfaces(resourceHandle,
+ newResourceInterface.c_str());
+ }
+ else
+ {
+ result = OC_STACK_ERROR;
+ }
+
+ if (result != OC_STACK_OK)
+ {
+ throw OCException(OC::Exception::BIND_INTERFACE_FAILED, result);
+ }
+ return result;
+ }
+
OCStackResult InProcServerWrapper::startPresence(const unsigned int seconds)
{
+#ifdef WITH_PRESENCE
auto cLock = m_csdkLock.lock();
OCStackResult result = OC_STACK_ERROR;
if(cLock)
throw OCException(OC::Exception::START_PRESENCE_FAILED, result);
}
return result;
+#else
+ return OC_STACK_NOT_IMPLEMENTED;
+#endif
}
OCStackResult InProcServerWrapper::stopPresence()
{
+#ifdef WITH_PRESENCE
auto cLock = m_csdkLock.lock();
OCStackResult result = OC_STACK_ERROR;
if(cLock)
throw OCException(OC::Exception::END_PRESENCE_FAILED, result);
}
return result;
+#else
+ return OC_STACK_NOT_IMPLEMENTED;
+#endif
}
OCStackResult InProcServerWrapper::sendResponse(
}
catch (InitializeException &e)
{
- oclog() << "Exception in stop"<< e.what() << std::flush;
+ OIC_LOG_V(INFO, TAG, "Exception in stop (%s)", e.what());
}
}
}