nRF5 SDK for Thread v0.10.0
Functions

This module includes the platform abstraction for non-volatile storage of settings. More...

Functions

void otPlatSettingsInit (otInstance *aInstance)
 
otError otPlatSettingsBeginChange (otInstance *aInstance)
 Begin atomic change set. More...
 
otError otPlatSettingsCommitChange (otInstance *aInstance)
 Commit all settings changes since previous call to otPlatSettingsBeginChange() More...
 
otError otPlatSettingsAbandonChange (otInstance *aInstance)
 Abandon all settings changes since previous call to otPlatSettingsBeginChange() More...
 
otError otPlatSettingsGet (otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
 Fetches the value of a setting. More...
 
otError otPlatSettingsSet (otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
 Sets or replaces the value of a setting. More...
 
otError otPlatSettingsAdd (otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
 Adds a value to a setting. More...
 
otError otPlatSettingsDelete (otInstance *aInstance, uint16_t aKey, int aIndex)
 Removes a setting from the setting store. More...
 
void otPlatSettingsWipe (otInstance *aInstance)
 Removes all settings from the setting store. More...
 

Detailed Description

This module includes the platform abstraction for non-volatile storage of settings.

Function Documentation

otError otPlatSettingsAbandonChange ( otInstance *  aInstance)

Abandon all settings changes since previous call to otPlatSettingsBeginChange()

This function may be called at the end of a sequence of changes. instead of otPlatSettingsCommitChange(). If implemented, it causes all changes made since otPlatSettingsBeginChange() to be rolled back and abandoned.

The implementation of this function is optional. If not implemented, it should return OT_ERROR_NOT_IMPLEMENTED.

Parameters
[in]aInstanceThe OpenThread instance structure.
Return values
OT_ERROR_NONEThe changes made since the last call to otPlatSettingsBeginChange() have been successfully rolled back.
OT_ERROR_INVALID_STATEotPlatSettingsBeginChange() has not been called.
OT_ERROR_NOT_IMPLEMENTEDThis function is not implemented on this platform.
See Also
otPlatSettingsBeginChange(), otPlatSettingsCommitChange()
otError otPlatSettingsAdd ( otInstance *  aInstance,
uint16_t  aKey,
const uint8_t *  aValue,
uint16_t  aValueLength 
)

Adds a value to a setting.

This function 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.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aKeyThe key associated with the setting to change.
[out]aValueA pointer to where the new value of the setting should be read from. MUST NOT be NULL if aValueLength is non-zero.
[in,out]aValueLengthThe length of the data pointed to by aValue. May be zero.
Return values
OT_ERROR_NONEThe given setting was added or staged to be added.
OT_ERROR_NOT_IMPLEMENTEDThis function is not implemented on this platform.
otError otPlatSettingsBeginChange ( otInstance *  aInstance)

Begin atomic change set.

This function is called at the start of a sequence of changes that should be made atomically.

This function, along with otPlatSettingsCommitChange() are designed to ensure atomicity of changes to multiple settings. Once this function has been called, any changes made to the settings store are only committed when otPlatSettingsCommitChange() is called.

The implementation of this function is optional. If not implemented, it should return OT_ERROR_NONE.

Parameters
[in]aInstanceThe OpenThread instance structure.
Return values
OT_ERROR_NONEThe settings commit lock has been set.
OT_ERROR_ALREADYThe commit lock is already set.
See Also
otPlatSettingsCommitChange(), otPlatSettingsAbandonChange()
otError otPlatSettingsCommitChange ( otInstance *  aInstance)

Commit all settings changes since previous call to otPlatSettingsBeginChange()

This function is called at the end of a sequence of changes. The implementation of this function is optional. If not implemented, it should return OT_ERROR_NOT_IMPLEMENTED.

Parameters
[in]aInstanceThe OpenThread instance structure.
Return values
OT_ERROR_NONEThe changes made since the last call to otPlatSettingsBeginChange() have been successfully committed.
OT_ERROR_INVALID_STATEotPlatSettingsBeginChange() has not been called.
OT_ERROR_NOT_IMPLEMENTEDThis function is not implemented on this platform.
See Also
otPlatSettingsBeginChange(), otPlatSettingsAbandonChange()
otError otPlatSettingsDelete ( otInstance *  aInstance,
uint16_t  aKey,
int  aIndex 
)

Removes a setting from the setting store.

This function 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.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aKeyThe key associated with the requested setting.
[in]aIndexThe index of the value to be removed. If set to -1, all values for this aKey will be removed.
Return values
OT_ERROR_NONEThe given key and index was found and removed successfully.
OT_ERROR_NOT_FOUNDThe given key or index was not found in the setting store.
OT_ERROR_NOT_IMPLEMENTEDThis function is not implemented on this platform.
otError otPlatSettingsGet ( otInstance *  aInstance,
uint16_t  aKey,
int  aIndex,
uint8_t *  aValue,
uint16_t *  aValueLength 
)

Fetches the value of a setting.

This function 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.

This function 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.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aKeyThe key associated with the requested setting.
[in]aIndexThe index of the specific item to get.
[out]aValueA pointer to where the value of the setting should be written. May be set to NULL if just testing for the presence or length of a setting.
[in,out]aValueLengthA pointer to the length of the value. When called, this pointer should point to an integer containing the maximum value size that can be written to aValue. At return, the actual length of the setting is written. This may be set to NULL if performing a presence check.
Return values
OT_ERROR_NONEThe given setting was found and fetched successfully.
OT_ERROR_NOT_FOUNDThe given setting was not found in the setting store.
OT_ERROR_NOT_IMPLEMENTEDThis function is not implemented on this platform.
void otPlatSettingsInit ( otInstance *  aInstance)

Performs any initialization for the settings subsystem, if necessary.

Parameters
[in]aInstanceThe OpenThread instance structure.
otError otPlatSettingsSet ( otInstance *  aInstance,
uint16_t  aKey,
const uint8_t *  aValue,
uint16_t  aValueLength 
)

Sets or replaces the value of a setting.

This function sets or replaces the value of a setting identified by aKey. If there was more than one value previously associated with aKey, then they are all deleted and replaced with this single entry.

Calling this function successfully may cause unrelated settings with multiple values to be reordered.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aKeyThe key associated with the setting to change.
[out]aValueA pointer to where the new value of the setting should be read from. MUST NOT be NULL if aValueLength is non-zero.
[in]aValueLengthThe length of the data pointed to by aValue. May be zero.
Return values
OT_ERROR_NONEThe given setting was changed or staged.
OT_ERROR_NOT_IMPLEMENTEDThis function is not implemented on this platform.
void otPlatSettingsWipe ( otInstance *  aInstance)

Removes all settings from the setting store.

This function deletes all settings from the settings store, resetting it to its initial factory state.

Parameters
[in]aInstanceThe OpenThread instance structure.

Documentation feedback | Developer Zone | Subscribe | Updated