3451a15f3aa9ae95e56563d12289d610ec47f432
[platform/core/connectivity/bluetooth-frwk.git] / include / plugin.h
1 /*
2  * Copyright (c) 2015 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 __BLUETOOTH_PLUGIN_H
19 #define __BLUETOOTH_PLUGIN_H
20
21 #include <dlog.h>
22 #include <glib.h>
23
24 #undef LOG_TAG
25 #define LOG_TAG "BLUETOOTH_FRWK_PLUGIN"
26
27 #define LOG_COLOR_RESET    "\033[0m"
28 #define LOG_COLOR_RED      "\033[31m"
29 #define LOG_COLOR_YELLOW   "\033[33m"
30 #define LOG_COLOR_GREEN         "\033[32m"
31 #define LOG_COLOR_BLUE          "\033[36m"
32 #define LOG_COLOR_PURPLE   "\033[35m"
33
34 #define BT_DBG(fmt, args...) \
35         ((SLOGD(fmt, ##args)))
36 #define BT_INFO(fmt, args...) \
37         ((SLOGI(fmt, ##args)))
38 #define BT_ERR(fmt, args...) \
39         ((SLOGE(fmt, ##args)))
40
41 #define BT_INFO_C(fmt, arg...) \
42         SLOGI_IF(TRUE,  LOG_COLOR_GREEN" "fmt" "LOG_COLOR_RESET, ##arg)
43 #define BT_ERR_C(fmt, arg...) \
44         SLOGI_IF(TRUE,  LOG_COLOR_RED" "fmt" "LOG_COLOR_RESET, ##arg)
45
46 #define ret_if(expr) \
47         do { \
48                 if (expr) { \
49                         BT_ERR("(%s) return", #expr); \
50                         return; \
51                 } \
52         } while (0)
53
54 #define retv_if(expr, val) \
55         do { \
56                 if (expr) { \
57                         BT_ERR("(%s) return", #expr); \
58                         return (val); \
59                 } \
60         } while (0)
61
62 typedef enum {
63         BT_AGENT_EVENT_PIN_REQUEST,
64         BT_AGENT_EVENT_PASSKEY_CONFIRM_REQUEST,
65         BT_AGENT_EVENT_PASSKEY_AUTO_ACCEPTED,
66         BT_AGENT_EVENT_PASSKEY_REQUEST,
67         BT_AGENT_EVENT_PASSKEY_DISPLAY_REQUEST,
68         BT_AGENT_EVENT_AUTHORIZE_REQUEST,
69         BT_AGENT_EVENT_CONFIRM_MODE_REQUEST,
70         BT_AGENT_EVENT_APP_CONFIRM_REQUEST,
71         BT_AGENT_EVENT_FILE_RECEIVED,
72         BT_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST,
73         BT_AGENT_EVENT_SECURITY,
74         BT_AGENT_EVENT_TERMINATE,
75         BT_AGENT_EVENT_EXCHANGE_REQUEST,
76         BT_AGENT_EVENT_PBAP_REQUEST,
77         BT_AGENT_EVENT_MAP_REQUEST,
78         BT_AGENT_EVENT_SYSTEM_RESET_REQUEST,
79         BT_AGENT_EVENT_LEGACY_PAIR_FAILED_FROM_REMOTE,
80 } bt_agent_event_type_t;
81
82 struct bluetooth_headed_plugin_t {
83         int (*bt_launch_dpmpopup) (char *mode);
84         int (*bt_launch_system_popup)(bt_agent_event_type_t event_type,
85                                                         const char *device_name,
86                                                         const unsigned char *auth_info,
87                                                         char *passkey,
88                                                         const char *filename,
89                                                         const char *agent_path);
90
91         void (*bt_destroy_popup_all)(void);
92         gboolean (*bt_launch_unable_to_pairing_syspopup)(int result);
93 };
94
95 #ifdef TIZEN_FEATURE_BT_DPM
96 #define BT_DPM_SYSPOPUP "dpm-syspopup"
97 #endif
98
99
100
101 #endif /* __BLUETOOTH_PLUGIN_H */