#include <linux/input.h>
#include <cconfig.h>
#include <geo_sensor_hal.h>
+#include <iio_common.h>
using std::ifstream;
using std::string;
#include <sensor_hal.h>
#include <string>
-#include <fstream>
#define IIO_DIR "/sys/bus/iio/devices/"
#define X_RAW_VAL_NODE "/in_magn_x_raw"
#define NAME_NODE "/name"
using std::string;
-using std::ifstream;
class geo_sensor_hal : public sensor_hal
{
bool update_value(void);
bool is_sensorhub_supported(void);
bool init_resources(void);
-
- template <typename value_t>
- bool read_node_value(string node_path, value_t &value)
- {
- ifstream handle;
- handle.open(node_path.c_str());
- if (!handle)
- {
- ERR("Failed to open handle(%s)", node_path.c_str());
- return false;
- }
- handle >> value;
- handle.close();
-
- return true;
- }
};
#endif /*_GEO_SENSOR_HAL_H_*/
#include <linux/input.h>
#include <cconfig.h>
#include <light_sensor_hal.h>
+#include <iio_common.h>
using std::ifstream;
using config::CConfig;
#include <sensor_hal.h>
#include <string>
-#include <fstream>
-#define IIO_DIR "/sys/bus/iio/devices/"
-#define NAME_NODE "/name"
-#define ILL_CLEAR_NODE "/in_illuminance_clear_raw"
+#define IIO_DIR "/sys/bus/iio/devices/"
+#define NAME_NODE "/name"
+#define ILL_CLEAR_NODE "/in_illuminance_clear_raw"
#define IIO_DEV_BASE_NAME "iio:device"
#define IIO_DEV_STR_LEN 10
using std::string;
-using std::ifstream;
class light_sensor_hal : public sensor_hal
{
bool update_value(void);
bool is_sensorhub_supported(void);
-
- template <typename value_t>
- bool read_node_value(string node_path, value_t &value)
- {
- ifstream handle;
- handle.open(node_path.c_str());
- if (!handle)
- {
- ERR("Failed to open handle(%s)", node_path.c_str());
- return false;
- }
- handle >> value;
- handle.close();
-
- return true;
- }
};
#endif /*_LIGHT_SENSOR_HAL_H_*/
#include <sensor_hal.h>
#include <string>
-#include <fstream>
#define IIO_DIR "/sys/bus/iio/devices/"
#define NAME_NODE "/name"
#define IIO_DEV_STR_LEN 10
using std::string;
-using std::ifstream;
class pressure_sensor_hal : public sensor_hal
{
bool update_value(bool wait);
bool enable_resource(bool enable);
bool is_sensorhub_supported(void);
-
- template <typename value_t>
- bool read_node_value(string node_path, value_t &value)
- {
- ifstream handle;
- handle.open(node_path.c_str());
- if (!handle)
- {
- ERR("Failed to open handle(%s)", node_path.c_str());
- return false;
- }
- handle >> value;
- handle.close();
-
- return true;
- }
};
#endif /*_PRESSURE_SENSOR_HAL_CLASS_H_*/
#define IIO_COMMON_H_
#include <linux/ioctl.h>
+#include <fstream>
+#include <string>
+#include <common.h>
+
+using std::string;
+using std::ifstream;
#define NO_OF_ULL_BYTES 8
#define NO_OF_SHORT_VAL 4
int update_sysfs_string(const char *filepath, char *val, bool verify = false);
int convert_bytes_to_int(int input, struct channel_parameters *info);
+template <typename value_t>
+bool read_node_value(string node_path, value_t &value)
+{
+ ifstream handle;
+ handle.open(node_path.c_str());
+ if (!handle)
+ {
+ ERR("Failed to open handle(%s)", node_path.c_str());
+ return false;
+ }
+ handle >> value;
+ handle.close();
+
+ return true;
+}
+
#endif /* IIO_COMMON_H_ */