| 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..30f3d1cfbafc65020b92d0a372cd7d9d11191beb
|
| --- /dev/null
|
| +++ b/device/generic_sensor/iio/platform_sensor_utils_iio.h
|
| @@ -0,0 +1,42 @@
|
| +// 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 "base/memory/ptr_util.h"
|
| +
|
| +namespace device {
|
| +
|
| +struct SensorDataIio;
|
| +struct SensorReading;
|
| +
|
| +// 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_
|
|
|