commit | 06f09b07cb0bfe7f63b748354a8fbc1b223b9bcd | [log] [tgz] |
---|---|---|
author | Harvey Yang <chenghaoyang@chromium.org> | Thu Dec 03 06:42:37 2020 |
committer | Copybara-Service <copybara-worker@google.com> | Fri Dec 04 10:23:07 2020 |
tree | 60e26de8bc6892854363569783aad22e2003ad4a | |
parent | 2c4fbc1a55e8454a05d60e5bf1d472529847b22b [diff] |
libmems: Set default values for raw pointers As raw pointers are not default initialized in C++, we should initialize them as nullptr or else there will be some errors in unit tests. BUG=none TEST=unit tests of iioservice Change-Id: I3e7a2f22f574cb6df5bde302d7adeeeb66f51838 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2570873 Reviewed-by: Cheng-Hao Yang <chenghaoyang@chromium.org> Reviewed-by: Heng-ruey Hsu <henryhsu@chromium.org> Tested-by: Cheng-Hao Yang <chenghaoyang@chromium.org> Commit-Queue: Cheng-Hao Yang <chenghaoyang@chromium.org> GitOrigin-RevId: 7f5c89f169dfb3f74c4afddf318dbfbb03413769
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.