Skip to content

Implement stream_events() rpc call #4

@gavv

Description

@gavv

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 interface
  • driver/driver_service.cpp - implements RPC interface on driver side
  • driver/device_manager.cpp - implements adding/removing/updating devices; we need to add subscribe/unsubscribe feature here and use it from DriverService
  • tool/cmd_logcat.cpp - implements roc-vad logcat command

See also documentation in README and HACKING.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-grpccategory: gRPC supportgood first issueTask good for newcomershelp wantedLooking for contributors

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions