-
-
Notifications
You must be signed in to change notification settings - Fork 6
Description
We need to given clients a way to subscribe for driver events, such as adding, deleting, or updating virtual devices. So that if one client (e.g. command-line tool) adds a device, another client (e.g. GUI) will be notified of that.
In driver_protocol.proto, we already have stream_logs() call that sends a stream of log entries from driver to client. Similarly, we can add stream_events() call, that would send a stream of event entry.
Each event entry could contain two fields:
- event type (e.g.: DEVICE_ADDED, DEVICE_DELETED, DEVICE_UPDATED)
- device uid
When a client calls stream_events(), we first should generate DEVICE_ADDED event for every device that is already present. That would allow client to monitor devices without race conditions (otherwise, if client gets device list before streaming, it can miss devices that appeared between device list request and streaming request).
In addition to RPC call, we need to add a command to CLI tool, say, roc-vad events. It should be similar to roc-vad logcat: connect to driver, call stream_events(), and print received events to console.
Related files:
rpc/driver_protocol.proto- defines RPC interfacedriver/driver_service.cpp- implements RPC interface on driver sidedriver/device_manager.cpp- implements adding/removing/updating devices; we need to add subscribe/unsubscribe feature here and use it from DriverServicetool/cmd_logcat.cpp- implementsroc-vad logcatcommand
See also documentation in README and HACKING.md.