Add resetSVRDB method to OCSecure to synchronize with OCPlatform 84/235984/1
authorMichal Mank <m.mank@samsung.com>
Wed, 8 Apr 2020 12:41:57 +0000 (14:41 +0200)
committerSudipto <sudipto.bal@samsung.com>
Thu, 11 Jun 2020 18:03:23 +0000 (23:33 +0530)
[Model] LUX
[BinType] AP
[Customer] LUX

[Issue#] TTES-534
[Request] N/A
[Occurrence Version] 1.2.1-61

[Problem] resetting svr db only in c api
[Cause & Measure] added version in c++ api; this will
synchronize resetting svrdb with the rest of OCPlatform
methods using csdkLock mutex
[Checking Method] build & test on device

[Team] IoT Connectivity
[Developer] m.mank
[Solution company] Samsung
[Change Type] new feature

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/673
(cherry-picked from 7a46617818b08af0b75a61893465b007134f4098)

Change-Id: If8ae77355ab268478ec7dfed08ce6a8e0468f331
Signed-off-by: Michal Mank <m.mank@samsung.com>
Signed-off-by: Sudipto <sudipto.bal@samsung.com>
resource/include/OCProvisioningManager.hpp
resource/provisioning/src/OCProvisioningManager.cpp

index 080db13..4691e80 100644 (file)
@@ -470,6 +470,13 @@ namespace OC
              */
             static OCStackResult configSelfOwnership();
 
+            /**
+            * This function resets SVR DB.
+            *
+            *@return OC_STACK_OK in case of successful configue and other value otherwise.
+            */
+            static OCStackResult resetSVRDB();
+
     };
 
     /**
index 1ce0cca..1739998 100644 (file)
@@ -688,6 +688,24 @@ namespace OC
         return result;
     }
 
+    OCStackResult OCSecure::resetSVRDB()
+    {
+        OCStackResult result;
+        auto cLock = OCPlatform_impl::Instance().csdkLock().lock();
+
+        if (cLock)
+        {
+            std::lock_guard<std::recursive_mutex> lock(*cLock);
+            result = OCResetSVRDB();
+        }
+        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)