mirror of
https://github.com/espressif/openthread.git
synced 2026-11-08 23:41:00 +00:00
[cli] add docs for detach command (#9303)
This commit is contained in:
@@ -41,6 +41,7 @@ Done
|
||||
- [csl](#csl)
|
||||
- [dataset](README_DATASET.md)
|
||||
- [delaytimermin](#delaytimermin)
|
||||
- [detach](#detach)
|
||||
- [deviceprops](#deviceprops)
|
||||
- [diag](#diag)
|
||||
- [discover](#discover-channel)
|
||||
@@ -1065,6 +1066,25 @@ Set the minimal delay timer (in seconds).
|
||||
Done
|
||||
```
|
||||
|
||||
### detach
|
||||
|
||||
Start the graceful detach process by first notifying other nodes (sending Address Release if acting as a router, or setting Child Timeout value to zero on parent if acting as a child) and then stopping Thread protocol operation.
|
||||
|
||||
```bash
|
||||
> detach
|
||||
Finished detaching
|
||||
Done
|
||||
```
|
||||
|
||||
### detach async
|
||||
|
||||
Start the graceful detach process similar to the `detach` command without blocking and waiting for the callback indicating that detach is finished.
|
||||
|
||||
```bash
|
||||
> detach async
|
||||
Done
|
||||
```
|
||||
|
||||
### deviceprops
|
||||
|
||||
Get the current device properties.
|
||||
|
||||
+36
-13
@@ -2442,18 +2442,41 @@ exit:
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @cli detach
|
||||
* @code
|
||||
* detach
|
||||
* Finished detaching
|
||||
* Done
|
||||
* @endcode
|
||||
* @par
|
||||
* Start the graceful detach process by first notifying other nodes (sending Address Release if acting as a router, or
|
||||
* setting Child Timeout value to zero on parent if acting as a child) and then stopping Thread protocol operation.
|
||||
* @sa otThreadDetachGracefully
|
||||
*/
|
||||
template <> otError Interpreter::Process<Cmd("detach")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
/**
|
||||
* @cli detach async
|
||||
* @code
|
||||
* detach async
|
||||
* Done
|
||||
* @endcode
|
||||
* @par
|
||||
* Start the graceful detach process similar to the `detach` command without blocking and waiting for the callback
|
||||
* indicating that detach is finished.
|
||||
* @csa{detach}
|
||||
* @sa otThreadDetachGracefully
|
||||
*/
|
||||
if (aArgs[0] == "async")
|
||||
{
|
||||
SuccessOrExit(error = otThreadDetachGracefully(GetInstancePtr(), nullptr, nullptr));
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error =
|
||||
otThreadDetachGracefully(GetInstancePtr(), &Interpreter::HandleDetachGracefullyResult, this));
|
||||
SuccessOrExit(error = otThreadDetachGracefully(GetInstancePtr(), HandleDetachGracefullyResult, this));
|
||||
error = OT_ERROR_PENDING;
|
||||
}
|
||||
|
||||
@@ -2461,6 +2484,17 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void Interpreter::HandleDetachGracefullyResult(void *aContext)
|
||||
{
|
||||
static_cast<Interpreter *>(aContext)->HandleDetachGracefullyResult();
|
||||
}
|
||||
|
||||
void Interpreter::HandleDetachGracefullyResult(void)
|
||||
{
|
||||
OutputLine("Finished detaching");
|
||||
OutputResult(OT_ERROR_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli discover
|
||||
* @code
|
||||
@@ -7748,17 +7782,6 @@ void Interpreter::OutputChildTableEntry(uint8_t aIndentSize, const otNetworkDiag
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
|
||||
|
||||
void Interpreter::HandleDetachGracefullyResult(void *aContext)
|
||||
{
|
||||
static_cast<Interpreter *>(aContext)->HandleDetachGracefullyResult();
|
||||
}
|
||||
|
||||
void Interpreter::HandleDetachGracefullyResult(void)
|
||||
{
|
||||
OutputLine("Finished detaching");
|
||||
OutputResult(OT_ERROR_NONE);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
void Interpreter::HandleDiscoveryRequest(const otThreadDiscoveryRequestInfo *aInfo, void *aContext)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user