From 6dfd716da1a1f2f478eda31b039105c1be835190 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Fri, 14 Jun 2019 12:40:30 -0700 Subject: [PATCH] [auto-start] remove auto-start feature (#3920) --- include/openthread/thread.h | 21 ------------- src/cli/README.md | 29 ------------------ src/cli/cli.cpp | 32 -------------------- src/cli/cli.hpp | 1 - src/core/api/thread_api.cpp | 32 -------------------- src/core/common/instance.cpp | 16 ---------- src/core/common/settings.hpp | 37 +---------------------- src/core/openthread-core-config-check.h | 6 +++- src/core/openthread-core-default-config.h | 10 ------ 9 files changed, 6 insertions(+), 178 deletions(-) diff --git a/include/openthread/thread.h b/include/openthread/thread.h index e1077aa3f..d97ec0990 100644 --- a/include/openthread/thread.h +++ b/include/openthread/thread.h @@ -213,27 +213,6 @@ typedef struct otThreadParentResponseInfo */ otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled); -/** - * This function queries if the Thread stack is configured to automatically start on reinitialization. - * - * @param[in] aInstance A pointer to an OpenThread instance. - * - * @retval TRUE It is configured to automatically start. - * @retval FALSE It is not configured to automatically start. - * - */ -bool otThreadGetAutoStart(otInstance *aInstance); - -/** - * This function configures the Thread stack to automatically start on reinitialization. - * It has no effect on the current Thread state. - * - * @param[in] aInstance A pointer to an OpenThread instance. - * @param[in] aStartAutomatically TRUE to automatically start; FALSE to not automatically start. - * - */ -otError otThreadSetAutoStart(otInstance *aInstance, bool aStartAutomatically); - /** * This function indicates whether a node is the only router on the network. * diff --git a/src/cli/README.md b/src/cli/README.md index 04c951731..2a40b7783 100644 --- a/src/cli/README.md +++ b/src/cli/README.md @@ -7,7 +7,6 @@ OpenThread test scripts use the CLI to execute test cases. ## OpenThread Command List -* [autostart](#autostart) * [bufferinfo](#bufferinfo) * [channel](#channel) * [child](#child-list) @@ -77,34 +76,6 @@ OpenThread test scripts use the CLI to execute test cases. ## OpenThread Command Details -### autostart enable - -Automatically start Thread on initialization. - -```bash -> autostart enable -Done -``` - -### autostart disable - -Don't automatically start Thread on initialization. - -```bash -> autostart disable -Done -``` - -### autostart - -Show the status of automatically starting Thread on initialization. - -```bash -> autostart -Disabled -Done -``` - ### bufferinfo Show the current message buffer information. diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 23632366a..2846e974f 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -100,7 +100,6 @@ namespace Cli { const struct Command Interpreter::sCommands[] = { {"help", &Interpreter::ProcessHelp}, - {"autostart", &Interpreter::ProcessAutoStart}, {"bufferinfo", &Interpreter::ProcessBufferInfo}, {"channel", &Interpreter::ProcessChannel}, #if OPENTHREAD_FTD @@ -454,37 +453,6 @@ void Interpreter::ProcessHelp(int argc, char *argv[]) } } -void Interpreter::ProcessAutoStart(int argc, char *argv[]) -{ - otError error = OT_ERROR_NONE; - - if (argc == 0) - { - if (otThreadGetAutoStart(mInstance)) - { - mServer->OutputFormat("Enabled\r\n"); - } - else - { - mServer->OutputFormat("Disabled\r\n"); - } - } - else if (strcmp(argv[0], "enable") == 0) - { - error = otThreadSetAutoStart(mInstance, true); - } - else if (strcmp(argv[0], "disable") == 0) - { - error = otThreadSetAutoStart(mInstance, false); - } - else - { - error = OT_ERROR_INVALID_ARGS; - } - - AppendResult(error); -} - void Interpreter::ProcessBufferInfo(int argc, char *argv[]) { OT_UNUSED_VARIABLE(argc); diff --git a/src/cli/cli.hpp b/src/cli/cli.hpp index b6d94b272..cbfe6caea 100644 --- a/src/cli/cli.hpp +++ b/src/cli/cli.hpp @@ -194,7 +194,6 @@ private: otError ParsePingInterval(const char *aString, uint32_t &aInterval); void ProcessHelp(int argc, char *argv[]); - void ProcessAutoStart(int argc, char *argv[]); void ProcessBufferInfo(int argc, char *argv[]); void ProcessChannel(int argc, char *argv[]); #if OPENTHREAD_FTD diff --git a/src/core/api/thread_api.cpp b/src/core/api/thread_api.cpp index 6630049b1..fe6d91c92 100644 --- a/src/core/api/thread_api.cpp +++ b/src/core/api/thread_api.cpp @@ -459,38 +459,6 @@ exit: return error; } -bool otThreadGetAutoStart(otInstance *aInstance) -{ -#if OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT - uint8_t autoStart = 0; - Instance &instance = *static_cast(aInstance); - - if (instance.Get().ReadThreadAutoStart(autoStart) != OT_ERROR_NONE) - { - autoStart = 0; - } - - return autoStart != 0; -#else - OT_UNUSED_VARIABLE(aInstance); - return false; -#endif -} - -otError otThreadSetAutoStart(otInstance *aInstance, bool aStartAutomatically) -{ -#if OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT - uint8_t autoStart = aStartAutomatically ? 1 : 0; - Instance &instance = *static_cast(aInstance); - - return instance.Get().SaveThreadAutoStart(autoStart); -#else - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aStartAutomatically); - return OT_ERROR_NOT_IMPLEMENTED; -#endif -} - bool otThreadIsSingleton(otInstance *aInstance) { Instance &instance = *static_cast(aInstance); diff --git a/src/core/common/instance.cpp b/src/core/common/instance.cpp index 4325a3574..8543da6f0 100644 --- a/src/core/common/instance.cpp +++ b/src/core/common/instance.cpp @@ -161,22 +161,6 @@ void Instance::AfterInit(void) Get().Init(); Get().Restore(); -#if OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT - - if (otThreadGetAutoStart(this)) - { - if (otIp6SetEnabled(this, true) == OT_ERROR_NONE) - { - // Only try to start Thread if we could bring up the interface - if (otThreadSetEnabled(this, true) != OT_ERROR_NONE) - { - // Bring the interface down if Thread failed to start - otIp6SetEnabled(this, false); - } - } - } - -#endif #endif // OPENTHREAD_MTD || OPENTHREAD_FTD #if OPENTHREAD_ENABLE_VENDOR_EXTENSION diff --git a/src/core/common/settings.hpp b/src/core/common/settings.hpp index 28db3142f..39bc0d627 100644 --- a/src/core/common/settings.hpp +++ b/src/core/common/settings.hpp @@ -130,7 +130,7 @@ protected: kKeyNetworkInfo = 0x0003, ///< Thread network information kKeyParentInfo = 0x0004, ///< Parent information kKeyChildInfo = 0x0005, ///< Child information - kKeyThreadAutoStart = 0x0006, ///< Auto-start information + kKeyReserved = 0x0006, ///< Reserved (previously auto-start) kKeySlaacIidSecretKey = 0x0007, ///< Secret key used by SLAAC module for generating semantically opaque IID }; @@ -288,41 +288,6 @@ public: */ otError DeleteParentInfo(void); - /** - * This method saves ThreadAutoStart. - * - * @param[in] aAutoStart A value to be saved (0 or 1). - * - * @retval OT_ERROR_NONE Successfully saved the value. - * @retval OT_ERROR_NOT_IMPLEMENTED The platform does not implement settings functionality. - * - */ - otError SaveThreadAutoStart(uint8_t aAutoStart) { return Save(kKeyThreadAutoStart, &aAutoStart, sizeof(uint8_t)); } - - /** - * This method reads ThreadAutoStart . - * - * @param[out] aAutoStart A reference to a `uint8_t` to output the read value - * - * @retval OT_ERROR_NONE Successfully read the value. - * @retval OT_ERROR_NOT_FOUND No corresponding value in the setting store. - * @retval OT_ERROR_NOT_IMPLEMENTED The platform does not implement settings functionality. - * - */ - otError ReadThreadAutoStart(uint8_t &aAutoStart) const - { - return ReadFixedSize(kKeyThreadAutoStart, &aAutoStart, sizeof(uint8_t)); - } - - /** - * This method deletes ThreadAutoStart value from settings. - * - * @retval OT_ERROR_NONE Successfully deleted the value. - * @retval OT_ERROR_NOT_IMPLEMENTED The platform does not implement settings functionality. - * - */ - otError DeleteThreadAutoStart(void) { return Delete(kKeyThreadAutoStart); } - #if OPENTHREAD_CONFIG_ENABLE_SLAAC /** diff --git a/src/core/openthread-core-config-check.h b/src/core/openthread-core-config-check.h index 384348f5d..290189a98 100644 --- a/src/core/openthread-core-config-check.h +++ b/src/core/openthread-core-config-check.h @@ -54,7 +54,11 @@ #endif #ifdef OPENTHREAD_CONFIG_MAX_SERVER_ALOCS -#error "OPENTHREAD_CONFIG_MAX_SERVER_ALOCS was replaced by OPENTHREAD_CONFIG_MAX_SERVICE_ALOCS" +#error "OPENTHREAD_CONFIG_MAX_SERVER_ALOCS was replaced by OPENTHREAD_CONFIG_MAX_SERVICE_ALOCS." +#endif + +#ifdef OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT +#error "OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT was removed." #endif #endif // OPENTHREAD_CORE_CONFIG_CHECK_H_ diff --git a/src/core/openthread-core-default-config.h b/src/core/openthread-core-default-config.h index a4860eca6..59b3bb39a 100644 --- a/src/core/openthread-core-default-config.h +++ b/src/core/openthread-core-default-config.h @@ -1084,16 +1084,6 @@ #define OPENTHREAD_CONFIG_ENABLE_PLATFORM_EUI64_CUSTOM_SOURCE 0 #endif -/** - * @def OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT - * - * Define to 1 if you want to enable auto start logic. - * - */ -#ifndef OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT -#define OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT 1 -#endif - /** * @def OPENTHREAD_CONFIG_ENABLE_BEACON_RSP_WHEN_JOINABLE *