[cli] implement 'rcp version' command (#5051)

This commit is contained in:
Jonathan Hui
2020-06-05 12:24:54 -07:00
committed by GitHub
parent 99a42ccadc
commit 616d8cb8a5
3 changed files with 45 additions and 1 deletions
+15
View File
@@ -75,6 +75,7 @@ Done
- [prefix](#prefix-add-prefix-padcrosnD-prf)
- [promiscuous](#promiscuous)
- [pskc](#pskc--p-keypassphrase)
- [rcp](#rcp)
- [releaserouterid](#releaserouterid-routerid)
- [reset](#reset)
- [rloc16](#rloc16)
@@ -1282,6 +1283,20 @@ Disable radio promiscuous operation.
Done
```
### rcp
RCP-related commands.
### rcp version
Print RCP version string.
```bash
> rcp version
OPENTHREAD/20191113-00825-g82053cc9d-dirty; SIMULATION; Jun 4 2020 17:53:16
Done
```
### releaserouterid \<routerid\>
Release a Router ID that has been allocated by the device in the Leader role.
+27 -1
View File
@@ -214,6 +214,9 @@ const struct Command Interpreter::sCommands[] = {
#if OPENTHREAD_FTD
{"preferrouterid", &Interpreter::ProcessPreferRouterId},
{"pskc", &Interpreter::ProcessPskc},
#endif
{"rcp", &Interpreter::ProcessRcp},
#if OPENTHREAD_FTD
{"releaserouterid", &Interpreter::ProcessReleaseRouterId},
#endif
{"reset", &Interpreter::ProcessReset},
@@ -2792,7 +2795,30 @@ void Interpreter::ProcessPreferRouterId(uint8_t aArgsLength, char *aArgs[])
exit:
AppendResult(error);
}
#endif
void Interpreter::ProcessRcp(uint8_t aArgsLength, char *aArgs[])
{
otError error = OT_ERROR_NONE;
const char *version = otPlatRadioGetVersionString(mInstance);
VerifyOrExit(version != otGetVersionString(), error = OT_ERROR_NOT_IMPLEMENTED);
VerifyOrExit(aArgsLength > 0, error = OT_ERROR_INVALID_ARGS);
if (strcmp(aArgs[0], "version") == 0)
{
mServer->OutputFormat("%s\r\n", version);
}
else
{
ExitNow(error = OT_ERROR_INVALID_ARGS);
}
exit:
AppendResult(error);
}
#if OPENTHREAD_FTD
void Interpreter::ProcessReleaseRouterId(uint8_t aArgsLength, char *aArgs[])
{
otError error = OT_ERROR_NONE;
@@ -2806,7 +2832,7 @@ void Interpreter::ProcessReleaseRouterId(uint8_t aArgsLength, char *aArgs[])
exit:
AppendResult(error);
}
#endif // OPENTHREAD_FTD
#endif
void Interpreter::ProcessReset(uint8_t aArgsLength, char *aArgs[])
{
+3
View File
@@ -328,6 +328,9 @@ private:
#if OPENTHREAD_FTD
void ProcessPreferRouterId(uint8_t aArgsLength, char *aArgs[]);
void ProcessPskc(uint8_t aArgsLength, char *aArgs[]);
#endif
void ProcessRcp(uint8_t aArgsLength, char *aArgs[]);
#if OPENTHREAD_FTD
void ProcessReleaseRouterId(uint8_t aArgsLength, char *aArgs[]);
#endif
void ProcessReset(uint8_t aArgsLength, char *aArgs[]);