5a5ff113a52848df42a9eba95ae8704ecab2c196
[apps/native/tizen-things-daemon.git] / lib / things-service / include / things-service.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.1 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __LIB_THINGS_SERVICE_H__
18 #define __LIB_THINGS_SERVICE_H__
19
20 typedef enum {
21         TS_VALUE_TYPE_INT,
22         TS_VALUE_TYPE_BOOLEAN,
23         TS_VALUE_TYPE_DOUBLE,
24         TS_VALUE_TYPE_STRING,
25 } ts_value_type_e;
26
27 typedef struct _ts_data *ts_handle;
28 typedef struct __timebased_data timebased_data;
29
30 int things_service_init(ts_handle *handle, const char *project);
31 int things_service_fini(ts_handle handle);
32
33 timebased_data *things_service_timebased_data_new(ts_value_type_e type);
34 int things_service_timebased_data_reset(
35         timebased_data *tb_data, ts_value_type_e type);
36 void things_service_timebased_data_free(timebased_data *tb_data);
37
38 int things_service_timebased_data_get_length(timebased_data *tb_data);
39
40 int things_service_timebased_data_append_int(
41         timebased_data *tb_data, int ivalue);
42 int things_service_timebased_data_append_double(
43         timebased_data *tb_data, double dvalue);
44
45 int things_service_send_data(ts_handle handle, const char *json_data);
46 int things_service_send_timebased_data(
47         ts_handle handle, timebased_data *tb_data, const char *project_key);
48
49 #endif /* __LIB_THINGS_SERVICE_H__ */