@@ -26,10 +26,11 @@ class PersistentStorage {
26
26
/* *
27
27
* @brief Perform the initialization required before using the storage.
28
28
*
29
+ * @param prefix storage key prefix
29
30
* @return true if success.
30
31
* @return false otherwise.
31
32
*/
32
- PSErrorCode NonSecureInit ();
33
+ PSErrorCode NonSecureInit (const char *prefix );
33
34
34
35
/* *
35
36
* @brief Store data into the persistent storage.
@@ -72,12 +73,21 @@ class PersistentStorage {
72
73
*/
73
74
PSErrorCode NonSecureRemove (PersistentStorageNode *node);
74
75
76
+ /* *
77
+ * @brief Perform factory reset and remove all keys.
78
+ *
79
+ * @return true if subtree has been removed successfully.
80
+ * @return false an error occurred.
81
+ */
82
+ PSErrorCode NonSecureFactoryReset ();
83
+
75
84
/* Secure storage API counterparts.*/
76
- PSErrorCode SecureInit ();
85
+ PSErrorCode SecureInit (const char *prefix );
77
86
PSErrorCode SecureStore (PersistentStorageNode *node, const void *data, size_t dataSize);
78
87
PSErrorCode SecureLoad (PersistentStorageNode *node, void *data, size_t dataMaxSize, size_t &outSize);
79
88
PSErrorCode SecureHasEntry (PersistentStorageNode *node);
80
89
PSErrorCode SecureRemove (PersistentStorageNode *node);
90
+ PSErrorCode SecureFactoryReset ();
81
91
82
92
protected:
83
93
PersistentStorage () = default ;
@@ -107,9 +117,9 @@ inline PersistentStorageImpl *PersistentStorage::Impl()
107
117
}
108
118
109
119
/* Non secure storage API. */
110
- inline PSErrorCode PersistentStorage::NonSecureInit ()
120
+ inline PSErrorCode PersistentStorage::NonSecureInit (const char *prefix )
111
121
{
112
- return Impl ()->_NonSecureInit ();
122
+ return Impl ()->_NonSecureInit (prefix );
113
123
};
114
124
115
125
inline PSErrorCode PersistentStorage::NonSecureStore (PersistentStorageNode *node, const void *data, size_t dataSize)
@@ -133,10 +143,15 @@ inline PSErrorCode PersistentStorage::NonSecureRemove(PersistentStorageNode *nod
133
143
return Impl ()->_NonSecureRemove (node);
134
144
}
135
145
146
+ inline PSErrorCode PersistentStorage::NonSecureFactoryReset ()
147
+ {
148
+ return Impl ()->_NonSecureFactoryReset ();
149
+ }
150
+
136
151
/* Secure storage API. */
137
- inline PSErrorCode PersistentStorage::SecureInit ()
152
+ inline PSErrorCode PersistentStorage::SecureInit (const char *prefix )
138
153
{
139
- return Impl ()->_SecureInit ();
154
+ return Impl ()->_SecureInit (prefix );
140
155
};
141
156
142
157
inline PSErrorCode PersistentStorage::SecureStore (PersistentStorageNode *node, const void *data, size_t dataSize)
@@ -160,4 +175,9 @@ inline PSErrorCode PersistentStorage::SecureRemove(PersistentStorageNode *node)
160
175
return Impl ()->_SecureRemove (node);
161
176
}
162
177
178
+ inline PSErrorCode PersistentStorage::SecureFactoryReset ()
179
+ {
180
+ return Impl ()->_SecureFactoryReset ();
181
+ }
182
+
163
183
} /* namespace Nrf */
0 commit comments