Settings
This module includes the platform abstraction for non-volatile storage of settings.
Summary
Enumerations |
|
---|---|
Anonymous Enum 21{
|
enum Defines the keys of settings. |
Functions |
|
---|---|
otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
|
Adds a value to a setting.
|
otPlatSettingsDeinit(otInstance *aInstance)
|
void
Performs any de-initialization for the settings subsystem, if necessary.
|
otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
|
Removes a setting from the setting store.
|
otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
|
Fetches the value of a setting.
|
otPlatSettingsInit(otInstance *aInstance, const uint16_t *aSensitiveKeys, uint16_t aSensitiveKeysLength)
|
void
Performs any initialization for the settings subsystem, if necessary.
|
otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
|
Sets or replaces the value of a setting.
|
otPlatSettingsWipe(otInstance *aInstance)
|
void
Removes all settings from the setting store.
|
Enumerations
Anonymous Enum 21
Anonymous Enum 21
Defines the keys of settings.
Note: When adding a new settings key, if the settings corresponding to the key contains security sensitive information, the developer MUST add the key to the array aSensitiveKeys
which is passed in otPlatSettingsInit()
.
Functions
otPlatSettingsAdd
otError otPlatSettingsAdd( otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength )
Adds a value to a setting.
Adds the value to a setting identified by aKey
, without replacing any existing values.
Note that the underlying implementation is not required to maintain the order of the items associated with a specific key. The added value may be added to the end, the beginning, or even somewhere in the middle. The order of any pre-existing values may also change.
Calling this function successfully may cause unrelated settings with multiple values to be reordered.
OpenThread stack guarantees to use otPlatSettingsAdd()
method for a aKey
that was either previously managed by otPlatSettingsAdd()
(i.e., contains one or more items) or is empty and/or fully deleted (contains no value).
Platform layer can rely and use this fact for optimizing its implementation.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||
Return Values |
|
otPlatSettingsDeinit
void otPlatSettingsDeinit( otInstance *aInstance )
Performs any de-initialization for the settings subsystem, if necessary.
Details | |||
---|---|---|---|
Parameters |
|
otPlatSettingsDelete
otError otPlatSettingsDelete( otInstance *aInstance, uint16_t aKey, int aIndex )
Removes a setting from the setting store.
Deletes a specific value from the setting identified by aKey from the settings store.
Note that the underlying implementation is not required to maintain the order of the items associated with a specific key.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Return Values |
|
otPlatSettingsGet
otError otPlatSettingsGet( otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength )
Fetches the value of a setting.
Fetches the value of the setting identified by aKey
and write it to the memory pointed to by aValue. It then writes the length to the integer pointed to by aValueLength
. The initial value of aValueLength
is the maximum number of bytes to be written to aValue
.
Can be used to check for the existence of a key without fetching the value by setting aValue
and aValueLength
to NULL. You can also check the length of the setting without fetching it by setting only aValue to NULL.
Note that the underlying storage implementation is not required to maintain the order of settings with multiple values. The order of such values MAY change after ANY write operation to the store.
Details | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||
Return Values |
|
otPlatSettingsInit
void otPlatSettingsInit( otInstance *aInstance, const uint16_t *aSensitiveKeys, uint16_t aSensitiveKeysLength )
Performs any initialization for the settings subsystem, if necessary.
Also sets the sensitive keys that should be stored in the secure area.
Note that the memory pointed by aSensitiveKeys
MUST not be released before aInstance
is destroyed.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
otPlatSettingsSet
otError otPlatSettingsSet( otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength )
Sets or replaces the value of a setting.
Sets or replaces the value of a setting identified by aKey
.
Calling this function successfully may cause unrelated settings with multiple values to be reordered.
OpenThread stack guarantees to use otPlatSettingsSet()
method for a aKey
that was either previously set using otPlatSettingsSet()
(i.e., contains a single value) or is empty and/or fully deleted (contains no value).
Platform layer can rely and use this fact for optimizing its implementation.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||
Return Values |
|
otPlatSettingsWipe
void otPlatSettingsWipe( otInstance *aInstance )
Removes all settings from the setting store.
Deletes all settings from the settings store, resetting it to its initial factory state.
Details | |||
---|---|---|---|
Parameters |
|
Resources
OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.