template <class Report, size_t kMaxUnreadReports = 0, size_t kMaxBatchSize = 1, zx_duration_t kMaxBatchDelayNs = 0>

class InputReportReaderManager

Defined at line 67 of file ../../sdk/lib/input_report_reader/reader.h

InputReportReaderManager is used to simplify implementation of input drivers. An input driver may

use InputReportReaderManager to keep track of all upstream readers that want to receive reports.

An upstream driver that wants to read input reports from this device may register with

InputReportReaderManager, which calls CreateReader. When an input report arrives, whether in the

form of HID reports or device readings by polling, etc., the report is pushed to all readers

registered by calling SendReportToAllReaders where it is then translated to

fuchsia_input_report::InputReport.

If kMaxUnreadReports is non-zero, then at most that many reports are allowed to accumulate for

any client before reports are dropped, starting with the oldest ones first.

If kMaxBatchSize is greater than 1, then multiple reports may be batched together before being

sent to clients.

If kMaxBatchSize is greater than 1, then kMaxBatchDelayNs must be set. This is the time in

nanoseconds from receiving the first input report that we will wait before sending a batch to

clients.

This class creates and manages the InputReportReaders. It is able to send reports

to all existing InputReportReaders.

When this class is destructed, all of the InputReportReaders will be freed.

This class is thread-safe.

Typical Usage:

An InputReport Driver should have one InputReportReaderManager member object.

The Driver should also have some form of InputReport object that can be converted to Fidl.

Eg:

class MyTouchScreenDriver {

...

private:

struct TouchScreenReport {

int64_t x;

int64_t y;

void ToFidlInputReport(fidl::WireTableBuilder

<

::fuchsia_input_report::wire::InputReport>

&

input_report, fidl::AnyArena

&

allocator) const;

};

InputReportReaderManager

<TouchScreenReport

> input_report_readers_;

};

See

https://fuchsia.dev/fuchsia-src/development/drivers/concepts/driver_architectures/input_drivers/input?hl=en

Public Methods

void InputReportReaderManager<Report, kMaxUnreadReports, kMaxBatchSize, kMaxBatchDelayNs> ()

Defined at line 72 of file ../../sdk/lib/input_report_reader/reader.h

void InputReportReaderManager<Report, kMaxUnreadReports, kMaxBatchSize, kMaxBatchDelayNs> (const InputReportReaderManager<Report, kMaxUnreadReports, kMaxBatchSize, kMaxBatchDelayNs> & )

This object can't be moved, because InputReportReaders point to this object.

Defined at line 74 of file ../../sdk/lib/input_report_reader/reader.h

void InputReportReaderManager<Report, kMaxUnreadReports, kMaxBatchSize, kMaxBatchDelayNs> (InputReportReaderManager<Report, kMaxUnreadReports, kMaxBatchSize, kMaxBatchDelayNs> && )

Defined at line 75 of file ../../sdk/lib/input_report_reader/reader.h

InputReportReaderManager<Report, kMaxUnreadReports, kMaxBatchSize, kMaxBatchDelayNs> & operator= (const InputReportReaderManager<Report, kMaxUnreadReports, kMaxBatchSize, kMaxBatchDelayNs> & )

Defined at line 76 of file ../../sdk/lib/input_report_reader/reader.h

InputReportReaderManager<Report, kMaxUnreadReports, kMaxBatchSize, kMaxBatchDelayNs> & operator= (InputReportReaderManager<Report, kMaxUnreadReports, kMaxBatchSize, kMaxBatchDelayNs> && )

Defined at line 77 of file ../../sdk/lib/input_report_reader/reader.h

zx_status_t CreateReader (async_dispatcher_t * dispatcher, fidl::ServerEnd<fuchsia_input_report::InputReportsReader> server, std::optional<Report> initial_report)

Create a new InputReportReader that is managed by this InputReportReaderManager. If

initial_report exists, InputReportReaderManager will send initial_report to the new reader.

Defined at line 81 of file ../../sdk/lib/input_report_reader/reader.h

size_t SendReportToAllReaders (const Report & report)

Send a report to all InputReportReaders. Returns the total number of reports that are dropped

due to InputReportReader report queues being full.

Defined at line 101 of file ../../sdk/lib/input_report_reader/reader.h

void RemoveReaderFromList (InputReportReader * reader)

Remove a given reader from the list. This is called by the InputReportReader itself

when it wishes to be removed.

Defined at line 112 of file ../../sdk/lib/input_report_reader/reader.h

Records