* *****************************************************************/
#include "ocstack.h"
+#include "srmutility.h"
#include "base64.h"
#include "OCProvisioningManager.h"
{
std::lock_guard<std::recursive_mutex> lock(*cLock);
result = OCSetOwnerTransferCallbackData(oxm, callbackData);
- if(result == OC_STACK_OK && (OIC_RANDOM_DEVICE_PIN & oxm))
+ if(result == OC_STACK_OK && (OIC_RANDOM_DEVICE_PIN == oxm))
{
SetInputPinCB(inputPin);
}
PMResultList_t *results = nullptr;
ProvisionContext* context = static_cast<ProvisionContext*>(ctx);
- results = new PMResultList_t;
+ try
+ {
+ results = new PMResultList_t;
+ }
+ catch (std::bad_alloc& e)
+ {
+ oclog() <<"Bad alloc exception";
+ return;
+ }
+
for (int i = 0; i < nOfRes; i++)
{
results->push_back(arr[i]);
if(!resultCallback)
{
oclog() <<"Result callback can't be null";
- return OC_STACK_INVALID_PARAM;
+ return OC_STACK_INVALID_CALLBACK;
}
OCStackResult result;
OCStackResult OCSecureResource::provisionACL( const OicSecAcl_t* acl,
ResultCallBack resultCallback)
{
- if(!resultCallback || !acl)
+ if(!acl)
{
- oclog() <<"Result callback or ACL can't be null";
+ oclog() <<"ACL can't be null";
return OC_STACK_INVALID_PARAM;
}
+ if(!resultCallback)
+ {
+ oclog() <<"result callback can not be null";
+ return OC_STACK_INVALID_CALLBACK;
+ }
OCStackResult result;
auto cLock = m_csdkLock.lock();
if(!resultCallback)
{
oclog() << "Result calback can't be null";
- return OC_STACK_INVALID_PARAM;
+ return OC_STACK_INVALID_CALLBACK;
}
OCStackResult result;
{
if(!resultCallback)
{
- oclog() << "Result calback can't be null";
- return OC_STACK_INVALID_PARAM;
+ oclog() << "Result callback can not be null";
+ return OC_STACK_INVALID_CALLBACK;
}
OCStackResult result;
if(!resultCallback)
{
oclog() << "Result calback can't be null";
- return OC_STACK_INVALID_PARAM;
+ return OC_STACK_INVALID_CALLBACK;
}
OCStackResult result;
if(!resultCallback)
{
oclog() << "Result calback can't be null";
- return OC_STACK_INVALID_PARAM;
+ return OC_STACK_INVALID_CALLBACK;
}
OCStackResult result;
std::string OCSecureResource::getDeviceID()
{
- char base64Buff[B64ENCODE_OUT_SAFESIZE(sizeof(((OicUuid_t*)0)->id)) + 1] = {0,};
- uint32_t outLen = 0;
- B64Result b64Ret = B64_OK;
std::ostringstream deviceId("");
+ char *devID = nullptr;
validateSecureResource();
- b64Ret = b64Encode(devPtr->doxm->deviceID.id, sizeof(devPtr->doxm->deviceID.id), base64Buff,
- sizeof(base64Buff), &outLen);
- if (B64_OK == b64Ret)
+ if (OC_STACK_OK == ConvertUuidToStr(&(devPtr->doxm->deviceID), &devID))
+ {
+ deviceId << devID;
+ }
+ else
{
- deviceId << base64Buff;
+ oclog() <<"Can not convert uuid to struuid";
}
return deviceId.str();
}