comp-manager: Monitor Invited device
[platform/core/api/multi-device-group.git] / src / companion-manager / include / comp_context.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (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://www.apache.org/licenses/LICENSE-2.0
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
18 #ifndef __COMP_CONTEXT_H__
19 #define __COMP_CONTEXT_H__
20
21 #include <glib.h>
22 #include <comp_log.h>
23 #include <unistd.h>
24 #include <gio/gio.h>
25 #include <companion_gdbus.h>
26 #include <sys/types.h>
27 #include <sqlite3.h>
28
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33
34 typedef struct {
35         GMainLoop *main_loop;
36         //GDBusConnection *connection;
37         int ref_count;
38
39         // resource list
40         GList *resource_list[COMP_RESOURCE_TYPE_MAX];
41
42         char *device_uuid;
43         bool mot_me; /**< Indicator whether mot local comp-manager */
44         GList *grp_list;
45         GList *pairwise_list;
46
47         bool monitor_started;
48
49         //sqlite3 db
50         sqlite3 *db;
51 } comp_context_t;
52
53 typedef struct {
54         char *conn_name;
55         int conn_id;
56         GDBusConnection *connection;
57 } comp_conn_destroy_data;
58
59 int comp_context_create();
60 int comp_context_destroy();
61 void comp_context_mutex_lock();
62 void comp_context_mutex_unlock();
63
64 comp_context_t *comp_context_get_context();
65
66 #ifdef __cplusplus
67 }
68 #endif
69 #endif /* __COMP_CONTEXT_H__ */