4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef SC_CORE_AGENT_H
21 #define SC_CORE_AGENT_H
25 #include <dbus/dbus-glib.h>
26 #include <dbus/dbus-glib-lowlevel.h>
28 #define BLUEZ_DEVICE_INTERFACE "org.bluez.Device"
30 #define GAP_TYPE_AGENT (gap_agent_get_type())
31 #define GAP_GET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GAP_TYPE_AGENT, GapAgent))
32 #define GAP_IS_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GAP_TYPE_AGENT))
34 #define GAP_AGENT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST((class), GAP_TYPE_AGENT, \
36 #define GAP_GET_AGENT_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GAP_TYPE_AGENT, \
38 #define GAP_IS_AGENT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE((class), GAP_TYPE_AGENT))
40 #define GAP_AGENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GAP_TYPE_AGENT, \
43 typedef struct _GapAgent GapAgent;
44 typedef struct _GapAgentClass GapAgentClass;
46 typedef gboolean(*GapAgentPasskeyFunc) (GapAgent *agent,
48 typedef gboolean(*GapAgentDisplayFunc) (GapAgent *agent, DBusGProxy *device,
50 typedef gboolean(*GapAgentConfirmFunc) (GapAgent *agent, DBusGProxy *device,
52 typedef gboolean(*GapAgentAuthorizeFunc) (GapAgent *agent,
55 typedef gboolean(*GapAgentConfirmModeFunc) (GapAgent *agent,
56 const char *mode, const char *sender,
57 gboolean need_popup, void *data);
58 typedef gboolean(*GapAgentCancelFunc) (GapAgent *agent,
60 typedef gboolean(*GapAgentIgnoreAutoPairingFunc) (const char *address);
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_TYPE_T;
84 struct _GapAgentClass {
85 GObjectClass parent_class;
88 GapAgent *_gap_agent_new(void);
89 void _gap_agent_setup_dbus(GapAgent *agent, GAP_AGENT_FUNC_CB *func_cb,
91 gboolean _gap_agent_register(GapAgent *agent);
92 void _gap_agent_reset_dbus(GapAgent *agent);
94 gboolean gap_agent_reply_pin_code(GapAgent *agent, const guint accept,
96 DBusGMethodInvocation *context);
97 gboolean gap_agent_reply_passkey(GapAgent *agent, const guint accept,
99 DBusGMethodInvocation *context);
100 gboolean gap_agent_reply_confirmation(GapAgent *agent, const guint accept,
101 DBusGMethodInvocation *context);
102 gboolean gap_agent_reply_authorize(GapAgent *agent, const guint accept,
103 DBusGMethodInvocation *context);
105 gboolean _gap_agent_exist_osp_server(GapAgent *agent, int type, char *uuid);
107 gchar* _gap_agent_get_path(GapAgent *agent);
109 gboolean _gap_agent_is_canceled(GapAgent *agent);
111 gboolean _gap_agent_register_osp_server(GapAgent *agent,
115 gboolean _gap_agent_unregister_osp_server(GapAgent *agent,