mirror of
https://github.com/espressif/openthread.git
synced 2026-07-10 06:10:21 +00:00
[radio] remove transmit power config from core (#2352)
Thread (and OpenThread) does not employ any form of transmit power control. As a result, while OpenThread provides APIs to control transmit power, it simply buffers and passes the transmit power value straight through to the radio. Currently, the transmit power APIs allow specifying an int8_t in units of dBm. This is overly constraining for platforms that have more advanced ways of configuring the transmit power. This commit removes the transmit power configuration from the core. This provides better flexibility in platform-specific ways to configure transmit power.
This commit is contained in:
+18
-14
@@ -216,8 +216,8 @@ const struct Command Interpreter::sCommands[] =
|
||||
{ "singleton", &Interpreter::ProcessSingleton },
|
||||
{ "state", &Interpreter::ProcessState },
|
||||
{ "thread", &Interpreter::ProcessThread },
|
||||
{ "txpowermax", &Interpreter::ProcessTxPowerMax },
|
||||
#ifndef OTDLL
|
||||
{ "txpower", &Interpreter::ProcessTxPower },
|
||||
{ "udp", &Interpreter::ProcessUdp },
|
||||
#endif
|
||||
{ "version", &Interpreter::ProcessVersion },
|
||||
@@ -2618,25 +2618,38 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
void Interpreter::ProcessTxPowerMax(int argc, char *argv[])
|
||||
#ifndef OTDLL
|
||||
void Interpreter::ProcessTxPower(int argc, char *argv[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
long value;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
mServer->OutputFormat("%d dBm\r\n", otLinkGetMaxTransmitPower(mInstance));
|
||||
int8_t power;
|
||||
|
||||
SuccessOrExit(error = otPlatRadioGetTransmitPower(mInstance, &power));
|
||||
mServer->OutputFormat("%d dBm\r\n", power);
|
||||
}
|
||||
else
|
||||
{
|
||||
long value;
|
||||
|
||||
SuccessOrExit(error = ParseLong(argv[0], value));
|
||||
otLinkSetMaxTransmitPower(mInstance, static_cast<int8_t>(value));
|
||||
SuccessOrExit(error = otPlatRadioSetTransmitPower(mInstance, static_cast<int8_t>(value)));
|
||||
}
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
void Interpreter::ProcessUdp(int argc, char *argv[])
|
||||
{
|
||||
otError error;
|
||||
error = mUdp.Process(argc, argv);
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Interpreter::ProcessVersion(int argc, char *argv[])
|
||||
{
|
||||
otStringPtr version(otGetVersionString());
|
||||
@@ -2646,15 +2659,6 @@ void Interpreter::ProcessVersion(int argc, char *argv[])
|
||||
OT_UNUSED_VARIABLE(argv);
|
||||
}
|
||||
|
||||
#ifndef OTDLL
|
||||
void Interpreter::ProcessUdp(int argc, char *argv[])
|
||||
{
|
||||
otError error;
|
||||
error = mUdp.Process(argc, argv);
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
void Interpreter::ProcessCommissioner(int argc, char *argv[])
|
||||
|
||||
Reference in New Issue
Block a user