916ce6c033dedbffce62a2f70057f8cb0f492110
[apps/native/st-things-co2-meter.git] / inc / sensor-data.h
1 /* ****************************************************************
2  *
3  * Copyright 2017 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  ******************************************************************/
18
19 #ifndef __SENSOR_DATA_H__
20 #define  __SENSOR_DATA_H__
21
22 #include <stdbool.h>
23
24 typedef enum {
25         SENSOR_DATA_TYPE_NONE = 0,
26         SENSOR_DATA_TYPE_INT,
27         SENSOR_DATA_TYPE_UINT,
28         SENSOR_DATA_TYPE_BOOL,
29         SENSOR_DATA_TYPE_DOUBLE,
30         SENSOR_DATA_TYPE_STR,
31 } sensor_data_type_e;
32
33 typedef struct __sensor_data_s sensor_data;
34
35 sensor_data *sensor_data_new(sensor_data_type_e type);
36 void sensor_data_free(sensor_data *data);
37
38 int sensor_data_set_int(sensor_data *data, int value);
39 int sensor_data_set_uint(sensor_data *data, unsigned int value);
40 int sensor_data_set_bool(sensor_data *data, bool value);
41 int sensor_data_set_double(sensor_data *data, double value);
42 int sensor_data_set_string(sensor_data *data, const char *value, unsigned int size);
43
44 int sensor_data_get_int(sensor_data *data, int *value);
45 int sensor_data_get_uint(sensor_data *data, unsigned int *value);
46 int sensor_data_get_bool(sensor_data *data, bool *value);
47 int sensor_data_get_double(sensor_data *data, double *value);
48 int sensor_data_get_string(sensor_data *data, const char **value);
49
50 #endif /* __SENSOR_DATA_H__ */
51