Adding AK8975 geo-sensor info in sensors.xml.in required by geo-plugin
[platform/core/system/sensord.git] / src / shared / iio_common.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef IIO_COMMON_H_
21 #define IIO_COMMON_H_
22
23 struct channel_parameters {
24         char *prefix_str;
25         float scale;
26         float offset;
27         unsigned int index;
28         unsigned int byte_count;
29         unsigned int valid_bits;
30         unsigned int shift;
31         unsigned long long int mask;
32         unsigned int big_endian;
33         unsigned int is_signed;
34         unsigned int is_en;
35         unsigned int buf_index;
36 };
37
38 void sort_channels_by_index(struct channel_parameters *channels, int count);
39 int decode_channel_data_type(const char *device_dir, const char *ch_name, struct channel_parameters *ch_info);
40 int add_channel_to_array(const char *device_dir, const char *ch_name, struct channel_parameters *channel);
41 int get_channel_array_size(struct channel_parameters *channels, int num_channels);
42 int update_sysfs_num(const char *filepath, int val, bool verify = false);
43 int update_sysfs_string(const char *filepath, char *val, bool verify = false);
44 int convert_bytes_to_int(int input, struct channel_parameters *info);
45
46 #endif /* IIO_COMMON_H_ */