Add the sender name in signal subscribe function
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / include / bt-service-gap-agent.h
1 /*
2  * Copyright (c) 2011 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 SC_CORE_AGENT_H
19 #define SC_CORE_AGENT_H
20
21 #include <stdint.h>
22 #include <glib.h>
23 #include <gio/gio.h>
24
25 #define BLUEZ_DEVICE_INTERFACE  "org.bluez.Device"
26
27 typedef enum {
28         GAP_AGENT_EXEC_NO_OPERATION,
29         GAP_AGENT_EXEC_PAIRING,
30         GAP_AGENT_EXEC_AUTHORZATION,
31         GAP_AGENT_EXEC_CONFIRM_MODE,
32 } GapAgentExecType;
33
34 typedef struct _GapAgentPrivate GapAgentPrivate;
35
36 typedef gboolean(*GapAgentPasskeyFunc) (GapAgentPrivate *agent,
37                                                 GDBusProxy *device);
38 typedef gboolean(*GapAgentDisplayFunc) (GapAgentPrivate *agent, GDBusProxy *device,
39                                                                 guint passkey);
40 typedef gboolean(*GapAgentConfirmFunc) (GapAgentPrivate *agent, GDBusProxy *device,
41                                                                 guint passkey);
42 typedef gboolean(*GapAgentAuthorizeFunc) (GapAgentPrivate *agent,
43                                         GDBusProxy *device, const char *uuid);
44 typedef gboolean(*GapAgentConfirmModeFunc) (GapAgentPrivate *agent,
45                                         const char *mode, const char *sender,
46                                         gboolean need_popup, void *data);
47 typedef gboolean(*GapAgentCancelFunc) (GapAgentPrivate *agent,
48                                                         const char *address);
49 typedef gboolean(*GapAgentIgnoreAutoPairingFunc) (const char *address);
50 typedef uint8_t bool_t;
51
52 typedef struct {
53         GapAgentPasskeyFunc pincode_func;
54         GapAgentDisplayFunc display_func;
55         GapAgentPasskeyFunc passkey_func;
56         GapAgentConfirmFunc confirm_func;
57         GapAgentAuthorizeFunc authorize_func;
58         GapAgentCancelFunc pairing_cancel_func;
59         GapAgentCancelFunc authorization_cancel_func;
60 } GAP_AGENT_FUNC_CB;
61
62 typedef enum {
63         GAP_AGENT_ACCEPT,
64         GAP_AGENT_REJECT,
65         GAP_AGENT_CANCEL,
66         GAP_AGENT_TIMEOUT,
67         GAP_AGENT_ACCEPT_ALWAYS,
68 } GAP_AGENT_ACCEPT_TYPE_T;
69
70 struct _GapAgentPrivate {
71         gchar *busname;
72         gchar *path;
73
74         GDBusProxy *agent_manager;
75
76         GDBusProxy *dbus_proxy;
77
78         GapAgentExecType exec_type;
79         GDBusMethodInvocation *reply_context;
80         char *uuid;
81
82         char pairing_addr[18];
83         char authorize_addr[18];
84
85         GSList *osp_servers;
86
87         GAP_AGENT_FUNC_CB cb;
88         gboolean canceled;
89 };
90
91 void _gap_agent_setup_dbus(GapAgentPrivate *agent, GAP_AGENT_FUNC_CB *func_cb,
92                                         const char *path, GDBusProxy *adapter);
93 gboolean _gap_agent_register(GapAgentPrivate *agent);
94 void _gap_agent_reset_dbus(GapAgentPrivate *agent);
95
96 gboolean gap_agent_reply_pin_code(GapAgentPrivate *agent, const guint accept,
97                                                 const char *pin_code,
98                                                 GDBusMethodInvocation *context);
99 gboolean gap_agent_reply_passkey(GapAgentPrivate *agent, const guint accept,
100                                                 const char *passkey,
101                                                 GDBusMethodInvocation *context);
102 gboolean gap_agent_reply_confirmation(GapAgentPrivate *agent, const guint accept,
103                 GDBusMethodInvocation *context);
104 gboolean gap_agent_reply_authorize(GapAgentPrivate *agent, const guint accept,
105                 GDBusMethodInvocation *context);
106
107 gboolean _gap_agent_exist_osp_server(GapAgentPrivate *agent, int type, char *uuid);
108
109 bt_agent_osp_server_t *_gap_agent_get_osp_server(GapAgentPrivate *agent, int type,
110                                         char *uuid);
111
112 gchar* _gap_agent_get_path(GapAgentPrivate *agent);
113
114 gboolean _gap_agent_is_canceled(GapAgentPrivate *agent);
115
116 void _gap_agent_set_canceled(GapAgentPrivate *agent, gboolean value);
117
118 gboolean _gap_agent_register_osp_server(GapAgentPrivate *agent,
119                                                 const gint type,
120                                                 const char *uuid,
121                                                 const char *path,
122                                                 int fd);
123
124 gboolean _gap_agent_unregister_osp_server(GapAgentPrivate *agent,
125                                                 const gint type,
126                                                 const char *uuid);
127
128 #endif