4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 * Girishashok Joshi <girish.joshi@samsung.com>
8 * Chanyeol Park <chanyeol.park@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
24 #ifndef SC_CORE_AGENT_H
25 #define SC_CORE_AGENT_H
29 #include <dbus/dbus-glib.h>
30 #include <dbus/dbus-glib-lowlevel.h>
32 #define BLUEZ_DEVICE_INTERFACE "org.bluez.Device"
34 #define GAP_TYPE_AGENT (gap_agent_get_type())
35 #define GAP_GET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GAP_TYPE_AGENT, GapAgent))
36 #define GAP_IS_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GAP_TYPE_AGENT))
38 #define GAP_AGENT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST((class), GAP_TYPE_AGENT, \
40 #define GAP_GET_AGENT_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GAP_TYPE_AGENT, \
42 #define GAP_IS_AGENT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE((class), GAP_TYPE_AGENT))
44 #define GAP_AGENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GAP_TYPE_AGENT, \
47 typedef struct _GapAgent GapAgent;
48 typedef struct _GapAgentClass GapAgentClass;
50 typedef gboolean(*GapAgentPasskeyFunc) (GapAgent *agent,
52 typedef gboolean(*GapAgentDisplayFunc) (GapAgent *agent, DBusGProxy *device,
54 typedef gboolean(*GapAgentConfirmFunc) (GapAgent *agent, DBusGProxy *device,
56 typedef gboolean(*GapAgentAuthorizeFunc) (GapAgent *agent,
59 typedef gboolean(*GapAgentConfirmModeFunc) (GapAgent *agent,
60 const char *mode, const char *sender,
61 gboolean need_popup, void *data);
62 typedef gboolean(*GapAgentCancelFunc) (GapAgent *agent,
64 typedef gboolean(*GapAgentIgnoreAutoPairingFunc) (const char *address);
65 typedef uint8_t bool_t;
68 GapAgentPasskeyFunc pincode_func;
69 GapAgentDisplayFunc display_func;
70 GapAgentPasskeyFunc passkey_func;
71 GapAgentConfirmFunc confirm_func;
72 GapAgentAuthorizeFunc authorize_func;
73 GapAgentCancelFunc pairing_cancel_func;
74 GapAgentCancelFunc authorization_cancel_func;
82 GAP_AGENT_ACCEPT_ALWAYS,
83 } GAP_AGENT_ACCEPT_TYPE_T;
89 struct _GapAgentClass {
90 GObjectClass parent_class;
93 GapAgent *_gap_agent_new(void);
94 void _gap_agent_setup_dbus(GapAgent *agent, GAP_AGENT_FUNC_CB *func_cb,
95 const char *path, DBusGProxy *adapter);
96 gboolean _gap_agent_register(GapAgent *agent);
97 void _gap_agent_reset_dbus(GapAgent *agent);
99 gboolean gap_agent_reply_pin_code(GapAgent *agent, const guint accept,
100 const char *pin_code,
101 DBusGMethodInvocation *context);
102 gboolean gap_agent_reply_passkey(GapAgent *agent, const guint accept,
104 DBusGMethodInvocation *context);
105 gboolean gap_agent_reply_confirmation(GapAgent *agent, const guint accept,
106 DBusGMethodInvocation *context);
107 gboolean gap_agent_reply_authorize(GapAgent *agent, const guint accept,
108 DBusGMethodInvocation *context);
110 gboolean _gap_agent_exist_osp_server(GapAgent *agent, int type, char *uuid);
112 bt_agent_osp_server_t *_gap_agent_get_osp_server(GapAgent *agent, int type,
115 gchar* _gap_agent_get_path(GapAgent *agent);
117 gboolean _gap_agent_is_canceled(GapAgent *agent);
119 void _gap_agent_set_canceled(GapAgent *agent, gboolean value);
121 gboolean _gap_agent_register_osp_server(GapAgent *agent,
127 gboolean _gap_agent_unregister_osp_server(GapAgent *agent,