2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef SC_CORE_AGENT_H
19 #define SC_CORE_AGENT_H
25 #define BLUEZ_DEVICE_INTERFACE "org.bluez.Device"
28 GAP_AGENT_EXEC_NO_OPERATION,
29 GAP_AGENT_EXEC_PAIRING,
30 GAP_AGENT_EXEC_AUTHORZATION,
31 GAP_AGENT_EXEC_CONFIRM_MODE,
34 typedef struct _GapAgentPrivate GapAgentPrivate;
36 typedef gboolean(*GapAgentPasskeyFunc) (GapAgentPrivate *agent,
38 typedef gboolean(*GapAgentDisplayFunc) (GapAgentPrivate *agent, GDBusProxy *device,
40 typedef gboolean(*GapAgentConfirmFunc) (GapAgentPrivate *agent, GDBusProxy *device,
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,
49 typedef gboolean(*GapAgentIgnoreAutoPairingFunc) (const char *address);
50 typedef uint8_t bool_t;
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;
67 GAP_AGENT_ACCEPT_ALWAYS,
68 } GAP_AGENT_ACCEPT_TYPE_T;
70 struct _GapAgentPrivate {
74 GDBusProxy *agent_manager;
76 GDBusProxy *dbus_proxy;
78 GapAgentExecType exec_type;
79 GDBusMethodInvocation *reply_context;
82 char pairing_addr[18];
83 char authorize_addr[18];
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);
96 gboolean gap_agent_reply_pin_code(GapAgentPrivate *agent, const guint accept,
98 GDBusMethodInvocation *context);
99 gboolean gap_agent_reply_passkey(GapAgentPrivate *agent, const guint accept,
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);
107 gboolean _gap_agent_exist_osp_server(GapAgentPrivate *agent, int type, char *uuid);
109 bt_agent_osp_server_t *_gap_agent_get_osp_server(GapAgentPrivate *agent, int type,
112 gchar* _gap_agent_get_path(GapAgentPrivate *agent);
114 gboolean _gap_agent_is_canceled(GapAgentPrivate *agent);
116 void _gap_agent_set_canceled(GapAgentPrivate *agent, gboolean value);
118 gboolean _gap_agent_register_osp_server(GapAgentPrivate *agent,
124 gboolean _gap_agent_unregister_osp_server(GapAgentPrivate *agent,