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__
32 /* TODO: Add more elements If and when required */
33 } bt_hal_agent_osp_server_t;
37 GAP_AGENT_EXEC_NO_OPERATION,
38 GAP_AGENT_EXEC_PAIRING,
39 GAP_AGENT_EXEC_AUTHORZATION,
40 GAP_AGENT_EXEC_CONFIRM_MODE,
43 typedef struct _GapAgentPrivate GapAgentPrivate;
45 typedef gboolean(*GapAgentPasskeyFunc) (GapAgentPrivate *agent,
47 typedef gboolean(*GapAgentDisplayFunc) (GapAgentPrivate *agent, GDBusProxy *device,
49 typedef gboolean(*GapAgentConfirmFunc) (GapAgentPrivate *agent, GDBusProxy *device,
51 typedef gboolean(*GapAgentAuthorizeFunc) (GapAgentPrivate *agent,
52 GDBusProxy *device, const char *uuid);
53 typedef gboolean(*GapAgentConfirmModeFunc) (GapAgentPrivate *agent,
54 const char *mode, const char *sender,
55 gboolean need_popup, void *data);
56 typedef gboolean(*GapAgentCancelFunc) (GapAgentPrivate *agent,
59 typedef uint8_t bool_t;
62 GapAgentPasskeyFunc pincode_func;
63 GapAgentDisplayFunc display_func;
64 GapAgentPasskeyFunc passkey_func;
65 GapAgentConfirmFunc confirm_func;
66 GapAgentAuthorizeFunc authorize_func;
67 GapAgentCancelFunc pairing_cancel_func;
68 GapAgentCancelFunc authorization_cancel_func;
76 GAP_AGENT_ACCEPT_ALWAYS,
77 } GAP_AGENT_ACCEPT_TYPE_T;
79 struct _GapAgentPrivate {
83 GDBusProxy *agent_manager;
84 GDBusProxy *dbus_proxy;
85 GapAgentExecType exec_type;
86 GDBusMethodInvocation *reply_context;
88 char pairing_addr[18];
89 char authorize_addr[18];
96 void _gap_agent_setup_dbus(GapAgentPrivate *agent, GAP_AGENT_FUNC_CB *func_cb,
97 const char *path, GDBusProxy *adapter);
99 gboolean _gap_agent_register(GapAgentPrivate *agent);
101 void _gap_agent_reset_dbus(GapAgentPrivate *agent);
103 gchar* _gap_agent_get_path(GapAgentPrivate *agent);
105 gboolean _gap_agent_is_canceled(GapAgentPrivate *agent);
107 void _gap_agent_set_canceled(GapAgentPrivate *agent, gboolean value);
109 gboolean gap_agent_reply_pin_code(GapAgentPrivate *agent, const guint accept,
110 const char *pin_code,
111 GDBusMethodInvocation *context);
112 gboolean gap_agent_reply_passkey(GapAgentPrivate *agent, const guint accept,
114 GDBusMethodInvocation *context);
115 gboolean gap_agent_reply_confirmation(GapAgentPrivate *agent, const guint accept,
116 GDBusMethodInvocation *context);
118 gboolean gap_agent_reply_authorize(GapAgentPrivate *agent, const guint accept,
119 GDBusMethodInvocation *context);
122 bt_hal_agent_osp_server_t *_bt_hal_gap_agent_find_osp_server_by_type(GSList *servers, unsigned int type);
124 gboolean _bt_hal_gap_agent_register_osp_server(GapAgentPrivate *agent, unsigned int type);
126 gboolean _bt_hal_gap_agent_unregister_osp_server(GapAgentPrivate *agent, unsigned int type);
128 #endif //_BT_HAL_GAP_AGENT_H__