Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 5afaf32b authored by Joseph Hwang's avatar Joseph Hwang
Browse files

floss: btclient: run commands only after adapter is ready

When btclient processes a command in a non-interactive mode, it can
only handle the commands that do not require the adapter readiness
for now.

In order to let btclient be able to handle commands that require the
adapter readiness, in this patch, both interactive and non-interactive
modes are processed in handle_client_command().

As one of the differences between the two modes, the interactive
shell is only started in the interactive mode.

In the non-interactive mode, the command is processed immediately
after the adapter becomes ready. If there is no callback to wait for
the command, btclient exits. Otherwise, btclient will need to wait
until the callback is invoked.

One thing worth noting is that any btclient command that has a
follow-up callback has to invoke the callback through
ForegroundActions::RunCallback(callback) so that the foreground
thread is aware of when to exit.

Bug: 288193772
Tag: #floss
Test: mma -j32
Test: Conduct the following manual tests.
  $ btclient -c "media log"
  > It needs the adapter readiness. It is able dump the media debug log.

  $ btclient --command "media log" --timeout 2
  > It needs the adapter readiness. It is able dump the media debug log.
    It runs the command with a timeout of 2 seconds.

  $ btclient -c "help"
  > It does not need the adapter readiness. It shows the help menu
    and exits immediately.

  $ btclient -c "media"
  > It shows “btclient:error: Invalid arguments” and exits immediately.

  $ btclient -c "hello"
  > It shows "'hello' is an invalid command!" and exits immediately.

Change-Id: Ieff642697b4fa5ba986b06ab945bc87d7ddc636a
parent 87d40daf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment