commit | cb36f84f0851d5c9e44ffcef850d31a765eba330 | [log] [tgz] |
---|---|---|
author | Gwendal Grignou <gwendal@chromium.org> | Thu Nov 21 00:46:02 2019 |
committer | Commit Bot <commit-bot@chromium.org> | Fri Nov 22 19:40:51 2019 |
tree | 2e4c05d89c2a1c6efddd8e6697c78e9a2e511ced | |
parent | b190cfbc4d2f6d5c5f82e1409026481cc768e839 [diff] |
libmems: Use function templates for fake Read...Attributes Avoid cut and paste code, compiled checked the array types are correct. BUG=chromium:937916 TEST=unit test Change-Id: I86509d610e61f0f69105db3b4e28fd23714fd9a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1928032 Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org> Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 197d5160452abec925d6f2ac63df8d1a89f4fe4d
Project goal and motivation
This library provides a set of wrapper and test helpers around libiio.
It is meant to provide a common foundation for Chrome OS to access and interface IIO sensors, with:
At the root of the hierarchy, there exists the IioContext
, which represents the IIO devices currently available on the system. These can be retrieved by name and inspected, via instances of IioDevice
.
An IioDevice
allows reading and writing attributes of an IIO device via type-safe helper APIs. It also offers support for configuring the buffer and trigger of an IIO device, which we use in order to allow the Chrome UI to read accelerometer data and support screen rotation.
An IioDevice
also exposes a list of IioChannel
s, which can individually be enabled and disabled.
Useful mocks for the core classes are provided, such that a test author can focus on the logic of the unit tests and share a common testing language with other engineers working in this space. Sharing the foundation of testing IIO sensor access helps ensure that any improvement in this area can benefit all clients.