mirror of
https://github.com/espressif/openthread.git
synced 2026-08-21 01:49:52 +00:00
Add txpowermax CLI (#1775)
This commit is contained in:
@@ -63,6 +63,7 @@ OpenThread test scripts use the CLI to execute test cases.
|
||||
* [singleton](#singleton)
|
||||
* [state](#state)
|
||||
* [thread](#thread-start)
|
||||
* [txpowermax](#txpowermax)
|
||||
* [version](#version)
|
||||
* [whitelist](#whitelist)
|
||||
* [diag](#diag)
|
||||
@@ -1566,6 +1567,25 @@ Disable Thread protocol operation and detach from a Thread network.
|
||||
Done
|
||||
```
|
||||
|
||||
### txpowermax
|
||||
|
||||
Get the maximum transmit power in dBm.
|
||||
|
||||
```bash
|
||||
> txpowermax
|
||||
-10 dBm
|
||||
Done
|
||||
```
|
||||
|
||||
### txpowermax \<txpowermax\>
|
||||
|
||||
Set the maximum transmit power.
|
||||
|
||||
```bash
|
||||
> txpowermax -10
|
||||
Done
|
||||
```
|
||||
|
||||
### version
|
||||
|
||||
Print the build version information.
|
||||
|
||||
@@ -188,6 +188,7 @@ const struct Command Interpreter::sCommands[] =
|
||||
{ "singleton", &Interpreter::ProcessSingleton },
|
||||
{ "state", &Interpreter::ProcessState },
|
||||
{ "thread", &Interpreter::ProcessThread },
|
||||
{ "txpowermax", &Interpreter::ProcessTxPowerMax },
|
||||
{ "version", &Interpreter::ProcessVersion },
|
||||
{ "whitelist", &Interpreter::ProcessWhitelist },
|
||||
};
|
||||
@@ -2495,6 +2496,25 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
void Interpreter::ProcessTxPowerMax(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
long value;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
sServer->OutputFormat("%d dBm\r\n", otLinkGetMaxTransmitPower(mInstance));
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error = ParseLong(argv[0], value));
|
||||
otLinkSetMaxTransmitPower(mInstance, static_cast<int8_t>(value));
|
||||
}
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
void Interpreter::ProcessVersion(int argc, char *argv[])
|
||||
{
|
||||
otStringPtr version(otGetVersionString());
|
||||
|
||||
@@ -263,6 +263,7 @@ private:
|
||||
void ProcessSingleton(int argc, char *argv[]);
|
||||
void ProcessState(int argc, char *argv[]);
|
||||
void ProcessThread(int argc, char *argv[]);
|
||||
void ProcessTxPowerMax(int argc, char *argv[]);
|
||||
void ProcessVersion(int argc, char *argv[]);
|
||||
void ProcessWhitelist(int argc, char *argv[]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user