From 6db94b6c279b76d7f4429256063cfbd3489c1940 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 10 Jan 2017 15:18:44 -0800 Subject: [PATCH] Change API name: `otNetworkSettingErase` -> `otPersistentInfoErase` (#1126) --- include/openthread.h | 12 ++++++++---- src/core/openthread.cpp | 2 +- src/ncp/ncp_base.cpp | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/openthread.h b/include/openthread.h index 194eb8a9b..df715a6ff 100644 --- a/include/openthread.h +++ b/include/openthread.h @@ -1675,7 +1675,10 @@ OTAPI ThreadError OTCALL otGetAssignLinkQuality(otInstance *aInstance, const uin OTAPI void OTCALL otSetAssignLinkQuality(otInstance *aInstance, const uint8_t *aExtAddr, uint8_t aLinkQuality); /** - * This method triggers platform reset. + * This method triggers a platform reset. + * + * The reset process ensures that all the OpenThread state/info (stored in volatile memory) is erased. Note that the + * `otPlatformReset` does not erase any persistent state/info saved in non-volatile memory. * * @param[in] aInstance A pointer to an OpenThread instance. */ @@ -1689,15 +1692,16 @@ OTAPI void OTCALL otPlatformReset(otInstance *aInstance); OTAPI void OTCALL otFactoryReset(otInstance *aInstance); /** - * This method erases all the settings stored on non-volatile memory. + * This function erases all the OpenThread persistent info (network settings) stored on non-volatile memory. + * Erase is successful only if the device is in `disabled` state/role. * * @param[in] aInstance A pointer to an OpenThread instance. * - * @retval kThreadError_None All data was wiped successfully. + * @retval kThreadError_None All persistent info/state was erased successfully. * @retval kThreadError_InvalidState Device is not in `disabled` state/role. * */ -ThreadError otNetworkSettingsErase(otInstance *aInstance); +ThreadError otPersistentInfoErase(otInstance *aInstance); /** * Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role. diff --git a/src/core/openthread.cpp b/src/core/openthread.cpp index 0caf302e4..1c9536168 100644 --- a/src/core/openthread.cpp +++ b/src/core/openthread.cpp @@ -703,7 +703,7 @@ void otFactoryReset(otInstance *aInstance) otPlatReset(aInstance); } -ThreadError otNetworkSettingsErase(otInstance *aInstance) +ThreadError otPersistentInfoErase(otInstance *aInstance) { ThreadError error = kThreadError_None; diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 48130478c..f7f2ed02c 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -1439,7 +1439,7 @@ ThreadError NcpBase::CommandHandler_NET_CLEAR(uint8_t header, unsigned int comma (void)arg_ptr; (void)arg_len; - return SendLastStatus(header, ThreadErrorToSpinelStatus(otNetworkSettingsErase(mInstance))); + return SendLastStatus(header, ThreadErrorToSpinelStatus(otPersistentInfoErase(mInstance))); } ThreadError NcpBase::CommandHandler_NET_RECALL(uint8_t header, unsigned int command, const uint8_t *arg_ptr,