[sensors](CrOS/Linux) Implement Sensor device manager for sensors
This cl introduces a SensorDeviceManager for Linux and ChromeOS platforms. Manager: 1) PlatformSensorProviderLinux owns a SensorDeviceManager that uses DeviceMonitorLinux to enumerate iio devices and get removed/add udev events. Once device is enumerated, added or removed, it is identified and all the necessary information is put to SensorInfoLinux structure and passed to the provider. If there is no such a device, it is added to cache. In case of removal, manager checks if there was such a device and updates it's cache accordingly + notifies the provider about a removed device, which update own cache. 2) Requests: when a request for a sensor comes, it can be processed immediately or asynchronously once service is up and running. Reader: 1) There will be two strategies for a reader. At the moment only polling read is supported. 2) The reader doesn't search for sensor files any more, those are passed to it in SensorInfoLinux structure. Unittests: 1) In order to make it possible to test the whole path, I've made SensorDeviceManager's methods virtual, which allowed me to mock and override them. 2) Unittests implement own udev methods that just read values from files. If read is successful, the manager adds this type of sensor associated with the files that have been read to it's cache and notifies the provider. BUG=606766 Review-Url: https://codereview.chromium.org/2533793002 Cr-Commit-Position: refs/heads/master@{#437550}
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment