std::shared_ptr<OCSecureResource> &foundDevice);
/**
+ * API for registering Ownership transfer methods for a particular transfer Type.
+ * @deprecated Use setInputPinCallback to set input pin callback value.
+ *
+ * @param oxm Ownership transfer method.
+ * @param callbackData CallbackData Methods for ownership transfer.
+ * @param inputPin Callback method to input pin for verification.
+ * @return ::OC_STACK_OK in case of success and other value otherwise.
+ *
+ */
+ static OCStackResult setOwnerTransferCallbackData(OicSecOxm_t oxm,
+ OTMCallbackData_t* callbackData, InputPinCallback inputPin);
+
+ /**
* API is responsible for discovery of devices in specified endpoint/deviceID.
* And this function will only return the specified device's response.
*
return result;
}
+ OCStackResult OCSecure::setOwnerTransferCallbackData(OicSecOxm_t oxm,
+ OTMCallbackData_t* callbackData, InputPinCallback inputPin)
+ {
+ if (NULL == callbackData || oxm >= OIC_OXM_COUNT)
+ {
+ oclog() <<"Invalid callbackData or OXM type";
+ return OC_STACK_INVALID_PARAM;
+ }
+
+ if ((OIC_RANDOM_DEVICE_PIN == oxm) && !inputPin)
+ {
+ oclog() <<"for OXM type DEVICE_PIN, inputPin callback can't be null";
+ return OC_STACK_INVALID_PARAM;
+ }
+
+ OCStackResult result;
+ auto cLock = OCPlatform_impl::Instance().csdkLock().lock();
+
+ if (cLock)
+ {
+ std::lock_guard<std::recursive_mutex> lock(*cLock);
+ result = OCSetOwnerTransferCallbackData(oxm, callbackData);
+ if (result == OC_STACK_OK && (OIC_RANDOM_DEVICE_PIN == oxm))
+ {
+ SetInputPinCB(inputPin);
+ }
+ }
+ else
+ {
+ oclog() <<"Mutex not found";
+ result = OC_STACK_ERROR;
+ }
+ return result;
+ }
+
OCStackResult OCSecure::discoverSingleDeviceInUnicast(unsigned short timeout,
const OicUuid_t* deviceID,
const std::string& hostAddress,