mirror of
https://github.com/espressif/openthread.git
synced 2026-08-28 04:49:54 +00:00
[auto-start] remove auto-start feature (#3920)
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<Instance *>(aInstance);
|
||||
|
||||
if (instance.Get<Settings>().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<Instance *>(aInstance);
|
||||
|
||||
return instance.Get<Settings>().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<Instance *>(aInstance);
|
||||
|
||||
@@ -161,22 +161,6 @@ void Instance::AfterInit(void)
|
||||
Get<Settings>().Init();
|
||||
Get<Mle::MleRouter>().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
|
||||
|
||||
@@ -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
|
||||
|
||||
/**
|
||||
|
||||
@@ -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_
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user