static OCStackResult getDevInfoFromNetwork(unsigned short timeout,
DeviceList_t &ownedDevList,
DeviceList_t &unownedDevList);
-
+ /**
+ * Server API to register callback to display stack generated PIN.
+ *
+ * @param[in] GeneratePinCallback Method to display generated PIN.
+ * @return OC_STACK_OK in case of success and other value otherwise.
+ */
+ static OCStackResult setDisplayPinCB(GeneratePinCallback);
};
/**
return result;
}
+ OCStackResult OCSecure::setDisplayPinCB(GeneratePinCallback displayPin)
+ {
+ if(!displayPin)
+ {
+ oclog() <<"displayPin can't be null";
+ return OC_STACK_INVALID_PARAM;
+ }
+
+ OCStackResult result = OC_STACK_OK;
+ auto cLock = OCPlatform_impl::Instance().csdkLock().lock();
+
+ if(cLock)
+ {
+ std::lock_guard<std::recursive_mutex> lock(*cLock);
+ SetGeneratePinCB(displayPin);
+ }
+ else
+ {
+ oclog() <<"Mutex not found";
+ result = OC_STACK_ERROR;
+ }
+
+ return result;
+ }
+
void OCSecureResource::callbackWrapper(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool hasError)
{
PMResultList_t *results = nullptr;
owned, unowned));
}
+ TEST(SetDisplayPinCBTest, SetDisplayPinCBTestNullCB)
+ {
+ EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSecure::setDisplayPinCB(nullptr));
+ }
+
TEST(ProvisionAclTest, ProvisionAclTestNullAcl)
{
OCSecureResource device;