d6b3001a9fe73d971c35cdecc59792239478fa45
[apps/native/st-things-blind.git] / inc / sensor-data.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Contact: Jin Yoon <jinny.yoon@samsung.com>
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 #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__ */