Chromium Code Reviews| Index: device/generic_sensor/iio/platform_sensor_utils_iio.h |
| diff --git a/device/generic_sensor/iio/platform_sensor_utils_iio.h b/device/generic_sensor/iio/platform_sensor_utils_iio.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f8579d3f18581752643b0c9cadca74f2bcfd958b |
| --- /dev/null |
| +++ b/device/generic_sensor/iio/platform_sensor_utils_iio.h |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef DEVICE_GENERIC_SENSOR_IIO_PLATFORM_SENSOR_UTILS_IIO_H_ |
| +#define DEVICE_GENERIC_SENSOR_IIO_PLATFORM_SENSOR_UTILS_IIO_H_ |
| + |
| +#include "base/files/file_path.h" |
| +#include "device/generic_sensor/iio/sensor_data_iio.h" |
|
shalamov
2016/10/19 16:37:11
forward declare
maksims (do not use this acc)
2016/10/20 09:50:36
Done.
|
| +#include "device/generic_sensor/public/cpp/sensor_reading.h" |
|
shalamov
2016/10/19 16:37:11
ditto
maksims (do not use this acc)
2016/10/20 09:50:36
Done.
|
| + |
| +namespace device { |
| + |
| +// Generic reader class that reads sensors data from |
| +// sensors files located in the base iio folder. |
| +class SensorReader { |
| + public: |
| + ~SensorReader(); |
| + |
| + // Creates a new instance of SensorReader if sensor read files |
| + // has been found and |sensor_paths_| are set. |
| + static std::unique_ptr<SensorReader> Create(const SensorDataIio& data); |
| + |
| + // Reads sensor values into |*reading| from sensor files |
| + // specified in |sensor_paths_|. |
| + bool ReadSensorReading(SensorReading* reading); |
| + |
| + private: |
| + explicit SensorReader(std::vector<base::FilePath> sensor_paths); |
| + |
| + // Contains paths to sensor files that are set when |
| + // Create() is called. |
| + const std::vector<base::FilePath> sensor_paths_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SensorReader); |
| +}; |
| + |
| +} // namespace device |
| + |
| +#endif // DEVICE_GENERIC_SENSOR_IIO_PLATFORM_SENSOR_UTILS_IIO_H_ |