Skip to content

Commit 677ccf1

Browse files
[diag] Move otPlatDiagModeGet() check to ProcessCmd
All diagnostic commands (instead of `diag start`) should fail if device is not in diagnostic mode. Previously it was verified by each command's process method (with a missing check in `ProcessEcho` and `ProcessGpio`). This commit moves the check directly to `ProcessCmd` and cleans up redundant code. Additionally clean the documentation and align the code as for some commands `status 0x00` was added on success and for some not. Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
1 parent 971f05f commit 677ccf1

File tree

6 files changed

+44
-100
lines changed

6 files changed

+44
-100
lines changed

src/core/diags/README.md

+14-27
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Start diagnostics mode.
3838
```bash
3939
> diag start
4040
start diagnostics mode
41-
status 0x00
41+
Done
4242
```
4343

4444
### diag channel
@@ -48,6 +48,7 @@ Get the IEEE 802.15.4 Channel value for diagnostics module.
4848
```bash
4949
> diag channel
5050
channel: 11
51+
Done
5152
```
5253

5354
### diag channel \<channel\>
@@ -57,7 +58,7 @@ Set the IEEE 802.15.4 Channel value for diagnostics module.
5758
```bash
5859
> diag channel 11
5960
set channel to 11
60-
status 0x00
61+
Done
6162
```
6263

6364
### diag cw start
@@ -123,6 +124,7 @@ Get the tx power value(dBm) for diagnostics module.
123124
```bash
124125
> diag power
125126
tx power: -10 dBm
127+
Done
126128
```
127129

128130
### diag power \<power\>
@@ -132,7 +134,7 @@ Set the tx power value(dBm) for diagnostics module.
132134
```bash
133135
> diag power -10
134136
set tx power to -10 dBm
135-
status 0x00
137+
Done
136138
```
137139

138140
### diag powersettings
@@ -173,7 +175,7 @@ Send the frame set by `diag frame` if length is omitted. Otherwise overwrite the
173175
```bash
174176
> diag send 20 100
175177
sending 0x14 packet(s), length 0x64
176-
status 0x00
178+
Done
177179
```
178180

179181
### diag repeat \<delay\> [length]
@@ -185,7 +187,7 @@ Send the frame set by `diag frame` if length is omitted. Otherwise overwrite the
185187
```bash
186188
> diag repeat 100 100
187189
sending packets of length 0x64 at the delay of 0x64 ms
188-
status 0x00
190+
Done
189191
```
190192

191193
### diag repeat stop
@@ -195,7 +197,7 @@ Stop repeated packet transmission.
195197
```bash
196198
> diag repeat stop
197199
repeated packet transmission is stopped
198-
status 0x00
200+
Done
199201
```
200202

201203
### diag radio sleep
@@ -205,7 +207,7 @@ Enter radio sleep mode.
205207
```bash
206208
> diag radio sleep
207209
set radio from receive to sleep
208-
status 0x00
210+
Done
209211
```
210212

211213
### diag radio receive
@@ -215,7 +217,7 @@ Set radio from sleep mode to receive mode.
215217
```bash
216218
> diag radio receive
217219
set radio from sleep to receive on channel 11
218-
status 0x00
220+
Done
219221
```
220222

221223
### diag radio receive \[async\] \<number\> \[lpr\]
@@ -245,6 +247,7 @@ Return the state of the radio.
245247
```bash
246248
> diag radio state
247249
sleep
250+
Done
248251
```
249252

250253
### diag radio enable
@@ -312,6 +315,7 @@ received packets: 10
312315
sent packets: 10
313316
first received packet: rssi=-65, lqi=101
314317
last received packet: rssi=-64, lqi=98
318+
Done
315319
```
316320

317321
### diag stats clear
@@ -321,6 +325,7 @@ Clear statistics during diagnostics mode.
321325
```bash
322326
> diag stats clear
323327
stats cleared
328+
Done
324329
```
325330

326331
### diag gpio get \<gpio\>
@@ -384,31 +389,13 @@ first received packet: rssi=-65, lqi=101
384389
last received packet: rssi=-61, lqi=98
385390

386391
stop diagnostics mode
387-
status 0x00
392+
Done
388393
```
389394

390395
### diag rcp
391396

392397
RCP-related diagnostics commands. These commands are used for debugging and testing only.
393398

394-
#### diag rcp start
395-
396-
Start RCP diagnostics mode.
397-
398-
```bash
399-
> diag rcp start
400-
Done
401-
```
402-
403-
#### diag rcp stop
404-
405-
Stop RCP diagnostics mode.
406-
407-
```bash
408-
> diag rcp stop
409-
Done
410-
```
411-
412399
#### diag rcp channel \<channel\>
413400

414401
Set the RCP IEEE 802.15.4 Channel value for diagnostics module.

0 commit comments

Comments
 (0)