With nRF5 SDK v14.0.0, we have significantly refactored the Command Line Interface (CLI) module to make it more useful and user friendly.
The new CLI has the following features:
The module can be connected to any transport. At this point, the following transport layers
More details can be found in the documentation.
We noticed that the CLI that was provided in nRF5 SDK v13.0.0 had great potential to simplify work with our nRF5 chips. Unfortunately, in its previous shape, it only allowed for adding some simple commands, the handling of which required a lot of manual and repetitive work.
The main drawbacks that we noticed were:
if - else if
Taking these assumptions into consideration, we started our work to deliver a new command line interface.
Commands in the new CLI are organized in a tree structure. Each module can register root commands (level 0) and corresponding dynamic or static subcommands (level > 0). Thanks to this approach, you can now use the Tab key to auto-complete or view all commands and their subcommands.
What is more, each and every command or subcommand can have or not have a handler. CLI will analyze the entered command line and it will execute the command or subcommand that has a handler and highest level. Higher-level subcommands without a handler will be passed as arguments.
An example command may look like that:
log enable info app
In such case, CLI will execute the handler for subcommand enable and it will pass info and app as arguments to it. Despite the fact that info and app are subcommands without a handler, they can still be completed or prompted with the Tab key.
Another innovation we have introduced is the concept of dynamic subcommands. The advantage of using them is that their number and syntax might not be known during compile time.
Below, we present a practical example how you can use the new CLI with dynamic commands. Let us assume that we would like to scan for the available Bluetooth devices and then connect to one of them. To realize that, we can implement the following command trees:
Example presentation: (download: ble_cli_demo_nrf52832.hex, ble_cli_demo_nrf52840.hex)
After typing connect and hitting the Tab button, nothing happens because the list of dynamic commands is empty.
We need to scan for advertising devices first:
Now, dynamic subcommands are available and can be prompted with the Tab button.
Next, we can also connect to the selected device:
To be continued...
Please, please, please do not use the tab key as a command. On a mac (and I think Windows), the tab key means to change focus. Using SES, if I run the cli using RTT, or the Terminal Emulator, and press the tab key, the cursor jumps to a different window. It does not send the tab key to the cli software. Running a terminal emulator program, same thing happens. Plus, you hard-coded the tab key into the SDK. If you can't change the tab key, at least make it a define or something so the programmer can change it.
Bselekar logger and cli are part of nrf5 sdk. You can find examples there: peripheral/cli, ble_central_and_peripheral/experimental/ble_app_interactive or ble_peripheral\experimental\ble_app_cli
Krzysztof Chruscinski Is it possible to get the hex file for the project in part 2.
Try here: devzone.nordicsemi.com/.../new-command-line-interface-and-enhanced-logger-par
"Unfortunately the page you have requested no longer exists"