* @return ::OC_STACK_OK in case of success and other value otherwise.
*/
static OCStackResult setDisplayPinCB(GeneratePinCallback displayPin);
+
+ /**
+ * API to remove device credential and ACL from all devices in subnet.
+ *
+ * @param resultCallback Callback provided by API user, callback will be called when
+ * credential revocation is finished.
+ * @param uuid Device uuid to be revoked.
+ * @param waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device
+ * discovery in seconds.
+ * @return ::OC_STACK_OK in case of success and other value otherwise.
+ */
+ static OCStackResult removeDeviceWithUuid(unsigned short waitTimeForOwnedDeviceDiscovery,
+ std::string uuid,
+ ResultCallBack resultCallback);
+
};
/**
ResultCallBack resultCallback);
/**
- * API to remove device credential and ACL from all devices in subnet.
- *
- * @param resultCallback Callback provided by API user, callback will be called when
- * credential revocation is finished.
- * @param uuid Device uuid to be revoked.
- * @param waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device
- * discovery in seconds.
- * @return ::OC_STACK_OK in case of success and other value otherwise.
- */
- OCStackResult removeDeviceWithUuid(unsigned short waitTimeForOwnedDeviceDiscovery,
- std::string uuid,
- ResultCallBack resultCallback);
-
- /**
* API to provision DirectPairing to devices.
*
* @param pconf pointer to PCONF (Pairing Configuration).
*/
bool getOwnedStatus();
- private:
+
/**
* Common callback wrapper, which will be called from OC-APIs.
*/
static void callbackWrapper(void* ctx, int nOfRes,
OCProvisionResult_t *arr, bool hasError);
+ private:
void validateSecureResource();
};
return result;
}
+ OCStackResult OCSecure::removeDeviceWithUuid(unsigned short waitTimeForOwnedDeviceDiscovery,
+ std::string uuid,
+ ResultCallBack resultCallback)
+ {
+ if (!resultCallback)
+ {
+ oclog() << "Result calback can't be null";
+ return OC_STACK_INVALID_CALLBACK;
+ }
+
+ OCStackResult result;
+ auto cLock = OCPlatform_impl::Instance().csdkLock().lock();
+
+ if (cLock)
+ {
+ ProvisionContext* context = new ProvisionContext(resultCallback);
+
+ std::lock_guard<std::recursive_mutex> lock(*cLock);
+
+ OicUuid_t targetDev;
+ result = ConvertStrToUuid(uuid.c_str(), &targetDev);
+ if(OC_STACK_OK == result)
+ {
+ result = OCRemoveDeviceWithUuid(static_cast<void*>(context), waitTimeForOwnedDeviceDiscovery,
+ &targetDev, &OCSecureResource::callbackWrapper);
+ }
+ else
+ {
+ oclog() <<"Can not convert struuid to uuid";
+ }
+ }
+ 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;
return result;
}
- OCStackResult OCSecureResource::removeDeviceWithUuid(unsigned short waitTimeForOwnedDeviceDiscovery,
- std::string uuid,
- ResultCallBack resultCallback)
- {
- if (!resultCallback)
- {
- oclog() << "Result calback can't be null";
- return OC_STACK_INVALID_CALLBACK;
- }
-
- OCStackResult result;
- auto cLock = m_csdkLock.lock();
-
- if (cLock)
- {
- ProvisionContext* context = new ProvisionContext(resultCallback);
-
- std::lock_guard<std::recursive_mutex> lock(*cLock);
-
- OicUuid_t targetDev;
- result = ConvertStrToUuid(uuid.c_str(), &targetDev);
- if(OC_STACK_OK == result)
- {
- result = OCRemoveDeviceWithUuid(static_cast<void*>(context), waitTimeForOwnedDeviceDiscovery,
- &targetDev, &OCSecureResource::callbackWrapper);
- }
- else
- {
- oclog() <<"Can not convert struuid to uuid";
- }
- }
- else
- {
- oclog() <<"Mutex not found";
- result = OC_STACK_ERROR;
- }
- return result;
- }
-
OCStackResult OCSecureResource::getLinkedDevices(UuidList_t &uuidList)
{
OCStackResult result;