libmems: replace base::size by std::size

Will be removed from libchrome r979799 onwards.

BUG=b:228144902
TEST=FEATURES=test emerge-hatch libmems

Change-Id: If0dd56755169c3a5ab1fde705a4c1e9bf5e5a061
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/3600980
Tested-by: Grace Cham <hscham@chromium.org>
Auto-Submit: Grace Cham <hscham@chromium.org>
Reviewed-by: Cheng-Hao Yang <chenghaoyang@chromium.org>
Commit-Queue: Cheng-Hao Yang <chenghaoyang@chromium.org>
Tested-by: Cheng-Hao Yang <chenghaoyang@chromium.org>
NOKEYCHECK=True
GitOrigin-RevId: b98a342e4ce3ec98324f6a6ac3a6ee6486c35538
1 file changed
tree: 91a270072b83432192d094249cada40554b6056b
  1. BUILD.gn
  2. common_types.cc
  3. common_types.h
  4. export.h
  5. iio_channel.h
  6. iio_channel_impl.cc
  7. iio_channel_impl.h
  8. iio_context.h
  9. iio_context_impl.cc
  10. iio_context_impl.h
  11. iio_device.cc
  12. iio_device.h
  13. iio_device_impl.cc
  14. iio_device_impl.h
  15. iio_device_test.cc
  16. iio_device_trigger_impl.cc
  17. iio_device_trigger_impl.h
  18. iio_event.cc
  19. iio_event.h
  20. iio_event_impl.cc
  21. iio_event_impl.h
  22. iio_event_test.cc
  23. libmems.pc
  24. libmems_test_support.pc
  25. OWNERS
  26. README.md
  27. test_fakes.cc
  28. test_fakes.h
README.md

Chrome OS IIO Sensor Utility Library

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:

  • a strong emphasis on testability;
  • readable code, with the ergonomics typical of platform2;
  • high performance.

Class hierarchy

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 IioChannels, which can individually be enabled and disabled.

Test mocks

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.