Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement async messages #173

Open
doegox opened this issue Oct 17, 2023 · 2 comments
Open

Implement async messages #173

doegox opened this issue Oct 17, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@doegox
Copy link
Contributor

doegox commented Oct 17, 2023

Current communication is purely synchrone: the client sends a command and the firmware answers.

We'd like to allow async messages to implement the following features:

  • from fw to client

    • allow to send debug messages
    • allow to send progress info from long running commands, such as darkside
    • allow to send critical battery level alerts
    • allow to send button press events to the client
  • from client to fw

    • allow to interrupt a long running command, such as darkside, from the client

Maybe the implementations changes should be done by taking into account a move to asyncio implementations of serial, BLE and TCP communications in the Python client.

@doegox doegox added the enhancement New feature or request label Oct 17, 2023
@doegox
Copy link
Contributor Author

doegox commented Oct 17, 2023

This will require new STATUS and possibly new dummy Command code

  • Command NOP = 0
  • STATUS_ASYNC_DEBUG = 0x100 for debug messages (with the NOP Command code)
  • STATUS_ASYNC_NRFLOG = 0x101 if we manage to stream NRF_LOG messages (with the NOP Command code)
  • STATUS_ASYNC_BATTERY = 0x102 for battery events (with the NOP Command code)
  • STATUS_ASYNC_BUTTON = 0x103 for button events (with the NOP Command code)
  • STATUS_ASYNC_PROGRESS = 0x104 for progress messages (with the running Command code)

@xianglin1998
Copy link
Contributor

Some design ideas for this enhancement:

  1. The data in the receiving buffer is now directly passed to the command function for execution. If need to implement commands similar to canceling the execution of Darkside, maybe need a double buffer, which means we cannot destroy the previous data.

  2. Distinguish between synchronous commands and asynchronous broadcasts using status codes or command codes.

  3. PYTHON CLI already has the ability to handle asynchronous commands, but now it is using implementation functions such as blocking and timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants