4 * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Anupam Roy <anupam.r@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __BT_HAL_GAP_AGENT_H__
23 #define _BT_HAL_GAP_AGENT_H__
35 } bt_hal_agent_osp_server_t;
39 GAP_AGENT_EXEC_NO_OPERATION,
40 GAP_AGENT_EXEC_PAIRING,
41 GAP_AGENT_EXEC_AUTHORZATION,
42 GAP_AGENT_EXEC_CONFIRM_MODE,
45 typedef struct _GapAgentPrivate GapAgentPrivate;
47 typedef gboolean(*GapAgentPasskeyFunc) (GapAgentPrivate *agent,
49 typedef gboolean(*GapAgentDisplayFunc) (GapAgentPrivate *agent, GDBusProxy *device,
51 typedef gboolean(*GapAgentConfirmFunc) (GapAgentPrivate *agent, GDBusProxy *device,
53 typedef gboolean(*GapAgentAuthorizeFunc) (GapAgentPrivate *agent,
54 GDBusProxy *device, const char *uuid);
55 typedef gboolean(*GapAgentConfirmModeFunc) (GapAgentPrivate *agent,
56 const char *mode, const char *sender,
57 gboolean need_popup, void *data);
58 typedef gboolean(*GapAgentCancelFunc) (GapAgentPrivate *agent,
61 typedef uint8_t bool_t;
64 GapAgentPasskeyFunc pincode_func;
65 GapAgentDisplayFunc display_func;
66 GapAgentPasskeyFunc passkey_func;
67 GapAgentConfirmFunc confirm_func;
68 GapAgentAuthorizeFunc authorize_func;
69 GapAgentCancelFunc pairing_cancel_func;
70 GapAgentCancelFunc authorization_cancel_func;
78 GAP_AGENT_ACCEPT_ALWAYS,
79 } GAP_AGENT_ACCEPT_TYPE_T;
81 struct _GapAgentPrivate {
85 GDBusProxy *agent_manager;
86 GDBusProxy *dbus_proxy;
87 GapAgentExecType exec_type;
88 GDBusMethodInvocation *reply_context;
90 char pairing_addr[18];
91 char authorize_addr[18];
98 void _gap_agent_setup_dbus(GapAgentPrivate *agent, GAP_AGENT_FUNC_CB *func_cb,
99 const char *path, GDBusProxy *adapter);
101 gboolean _gap_agent_register(GapAgentPrivate *agent);
103 void _gap_agent_reset_dbus(GapAgentPrivate *agent);
105 gchar* _gap_agent_get_path(GapAgentPrivate *agent);
107 gboolean _gap_agent_is_canceled(GapAgentPrivate *agent);
109 void _gap_agent_set_canceled(GapAgentPrivate *agent, gboolean value);
111 gboolean gap_agent_reply_pin_code(GapAgentPrivate *agent, const guint accept,
112 const char *pin_code,
113 GDBusMethodInvocation *context);
114 gboolean gap_agent_reply_passkey(GapAgentPrivate *agent, const guint accept,
116 GDBusMethodInvocation *context);
117 gboolean gap_agent_reply_confirmation(GapAgentPrivate *agent, const guint accept,
118 GDBusMethodInvocation *context);
120 gboolean gap_agent_reply_authorize(GapAgentPrivate *agent, const guint accept,
121 GDBusMethodInvocation *context);
124 bt_hal_agent_osp_server_t *_bt_hal_gap_agent_find_osp_server_by_type(GSList *servers, unsigned int type, const char *uuid);
126 gboolean _bt_hal_gap_agent_register_osp_server(GapAgentPrivate *agent, unsigned int type, char *uuid, char *path, int fd);
128 gboolean _bt_hal_gap_agent_unregister_osp_server(GapAgentPrivate *agent, unsigned int type, char *uuid);
130 #endif //_BT_HAL_GAP_AGENT_H__