Skip to content

Commit

Permalink
[diag] Add new command to factory diags radoi command.
Browse files Browse the repository at this point in the history
Commit adds new command to factory diag called `radio`.
	- `enable` for enabling the interface to dfault mode,
	- `disable` for disabling the interface
  • Loading branch information
Przemyslaw Bida committed Dec 10, 2024
1 parent fe7d34f commit dca0448
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/core/diags/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,26 @@ Return the state of the radio.
sleep
```

### diag radio enable

Enable radio interface and put it in receive mode.

```bash
> diag radio enable
Radio link started.
sleep
```

### diag radio disable

Disable radio interface.

```bash
> diag radio disable
Radio link stopped.
sleep
```

### diag rawpowersetting

Show the raw power setting for diagnostics module.
Expand Down
10 changes: 10 additions & 0 deletions src/core/diags/factory_diags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,16 @@ Error Diags::ProcessRadio(uint8_t aArgsLength, char *aArgs[])
break;
}
}
else if (StringMatch(aArgs[0], "enable"))
{
SuccessOrExit(error = Get<Radio>().Enable());
Output("Radio link started.\r\n");
}
else if (StringMatch(aArgs[0], "disable"))
{
SuccessOrExit(error = Get<Radio>().Disable());
Output("Radio link stopped.\r\n");
}

exit:
AppendErrorResult(error);
Expand Down
3 changes: 3 additions & 0 deletions src/core/diags/factory_diags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ class Diags : public InstanceLocator, private NonCopyable
Error ProcessGpio(uint8_t aArgsLength, char *aArgs[]);
Error ProcessPower(uint8_t aArgsLength, char *aArgs[]);
Error ProcessRadio(uint8_t aArgsLength, char *aArgs[]);
#if !OPENTHREAD_RADIO
Error ProcessLinkRaw(uint8_t aArgsLength, char *aArgs[]);
#endif
Error ProcessRepeat(uint8_t aArgsLength, char *aArgs[]);
Error ProcessPowerSettings(uint8_t aArgsLength, char *aArgs[]);
Error ProcessRawPowerSetting(uint8_t aArgsLength, char *aArgs[]);
Expand Down

0 comments on commit dca0448

Please sign in to comment.