+ 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;
+ }
+
+#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
+ OCStackResult OCSecure::saveTrustCertChain(uint8_t *trustCertChain, size_t chainSize,
+ OicEncodingType_t encodingType, uint16_t *credId)
+ {
+ if (!trustCertChain)
+ {
+ oclog() <<"trustCertChain can't be null";
+ return OC_STACK_INVALID_PARAM;
+ }
+ if (!credId)
+ {
+ oclog() <<"cred ID can not 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 = OCSaveTrustCertChain(trustCertChain, chainSize, encodingType, credId );
+ }
+ else
+ {
+ oclog() <<"Mutex not found";
+ result = OC_STACK_ERROR;
+ }
+ return result;
+ }
+#endif // __WITH_DTLS__ || __WITH_TLS__
+