OCStackResult setSecurePSI(const unsigned char *key, const OCPersistentStorage *psPlain,
const OCPersistentStorage *psEnc, const OCPersistentStorage *psRescue);
+/**
+ *
+ * @return pointer on resetSVRDB structure for manipulating with callback
+ */
+resetSVRDBCB_t* const GetResetSVRDBCB(void);
+
#endif //IOTVT_SRM_PSI_H
OCStackResult OCResetSVRDB(void);\r
\r
/**\r
+ * The function registers callback, for getting notification if SVR DB was reseted.\r
+ *\r
+ * @param[in] ResetSVRDBCB notifier callback function.\r
+ * @return OC_STACK_OK in case of success and other value otherwise.\r
+ */\r
+OCStackResult OCRegisterResetSVRDBNotifier(ResetSVRDBCB callback);\r
+\r
+/**\r
+ * The function unregisters ResetSVRDBCB notification callback.\r
+ */\r
+void OCUnregisterResetSVRDBNotifier(void);\r
+\r
+/**\r
* This function configures SVR DB as self-ownership.\r
*\r
*@return OC_STACK_OK in case of successful configue and other value otherwise.\r
}
/**
+ * This function to register callback, for getting notification if SVR DB was reseted.
+ * @param[in] ResetSVRDBCB notifier callback function.
+ * @return OC_STACK_OK in case of successful reset and other value otherwise.
+ */
+
+OCStackResult OCRegisterResetSVRDBNotifier(ResetSVRDBCB callback)
+{
+ OIC_LOG_V(INFO, TAG, "IN %s", __func__);
+
+ if(NULL != GetResetSVRDBCB()->callback)
+ {
+ OIC_LOG_V(ERROR, TAG,"%s Can't register notifier callback, unregister previous one!" ,__func__);
+ return OC_STACK_ERROR;
+ }
+
+ GetResetSVRDBCB()->callback = callback;
+
+ OIC_LOG_V(INFO, TAG, "Out %s", __func__);
+ return OC_STACK_OK;
+}
+
+
+/**
+ * This function to unregister ResetSVRDBCB notification callback.
+ */
+void OCUnregisterResetSVRDBNotifier(void)
+{
+ OIC_LOG_V(INFO, TAG, "IN %s", __func__);
+
+ if(NULL != GetResetSVRDBCB()->callback)
+ {
+ GetResetSVRDBCB()->callback = NULL;
+ }
+
+ OIC_LOG_V(INFO, TAG, "Out %s", __func__);
+}
+
+/**
* This function configures SVR DB as self-ownership.
*
*@return OC_STACK_OK in case of successful configue and other value otherwise.
// Persistent Storage status
static PSStatus_t g_psStatus = PS_NO_EXTERNAL_DB_SET;
+static resetSVRDBCB_t g_resetSVRDBCB = {0};
+
+resetSVRDBCB_t* const GetResetSVRDBCB(void)
+{
+ return &g_resetSVRDBCB;
+}
/**
* Update the Persistent Storage Database size.
*/
OICFree(pstatCbor);
OICFree(doxmCbor);
OICFree(resetPfCbor);
+
+ g_resetSVRDBCB.callback(ret);
return ret;
}
typedef void (*OCOtmEventHandler)(void *ctx, const char *addr, uint16_t port,
const char *ownerId, OCOtmEvent_t event);
+/**
+ * Callback function for notification SVR DB was reseted.
+ *
+ * @param[in] result of OCResetSVRDB API call
+ */
+typedef void (*ResetSVRDBCB)(OCStackResult result);
+
+/**
+ * resetSVRDBCB structure.
+ */
+typedef struct resetSVRDBCB
+{
+ ResetSVRDBCB callback;
+} resetSVRDBCB_t;
+
#ifdef __cplusplus
}
#endif // __cplusplus