Cody sync.: merge tizen 2.4 code from spin git
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / include / bt-service-agent.h
1 /*
2  * Bluetooth-frwk
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
7  *               Girishashok Joshi <girish.joshi@samsung.com>
8  *               Chanyeol Park <chanyeol.park@samsung.com>
9  *
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
13  *
14  *              http://www.apache.org/licenses/LICENSE-2.0
15  *
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.
21  *
22  */
23
24 #ifndef BT_SERVICE_AGENT_H
25 #define BT_SERVICE_AGENT_H
26
27 #include <stdint.h>
28 #include <glib.h>
29 #include <unistd.h>
30 #include <dlog.h>
31 #include <stdio.h>
32
33 #undef LOG_TAG
34 #define LOG_TAG "BLUETOOTH_FRWK_SERVICE"
35 #define ERR(fmt, args...) SLOGE(fmt, ##args)
36
37 #define BT_MAX_EVENT_STR_LENGTH 50
38
39 #ifndef TIZEN_WEARABLE
40 #define BT_FILE_VISIBLE_TIME "file/private/libug-setting-bluetooth-efl/visibility_time"
41 #endif
42
43 typedef enum {
44         HS_PROFILE_UUID = ((unsigned short)0x1108),             /**<HS*/
45         AUDIO_SOURCE_UUID = ((unsigned short)0x110A),           /**<AUDIO SOURCE*/
46         AUDIO_SINK_UUID = ((unsigned short)0x110B),             /**<AUDIO SINK*/
47         AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C),/**<AV REMOTE CONTROL TARGET*/
48         ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D), /**<A2DP*/
49         AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E),      /**<AV REMOTE CONTROL UUID*/
50         HF_PROFILE_UUID = ((unsigned short)0x111E),             /**<HF*/
51 } bt_agent_service_uuid_list_t;
52
53 typedef enum {
54         BT_AGENT_EVENT_PIN_REQUEST,
55         BT_AGENT_EVENT_PASSKEY_CONFIRM_REQUEST,
56         BT_AGENT_EVENT_PASSKEY_AUTO_ACCEPTED,
57         BT_AGENT_EVENT_PASSKEY_REQUEST,
58         BT_AGENT_EVENT_PASSKEY_DISPLAY_REQUEST,
59         BT_AGENT_EVENT_AUTHORIZE_REQUEST,
60         BT_AGENT_EVENT_CONFIRM_MODE_REQUEST,
61         BT_AGENT_EVENT_APP_CONFIRM_REQUEST,
62         BT_AGENT_EVENT_FILE_RECEIVED,
63         BT_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST,
64         BT_AGENT_EVENT_SECURITY,
65         BT_AGENT_EVENT_TERMINATE,
66         BT_AGENT_EVENT_EXCHANGE_REQUEST,
67         BT_AGENT_EVENT_PBAP_REQUEST,
68         BT_AGENT_EVENT_MAP_REQUEST,
69         BT_AGENT_EVENT_SYSTEM_RESET_REQUEST,
70         BT_AGENT_EVENT_LEGACY_PAIR_FAILED_FROM_REMOTE,
71 } bt_agent_event_type_t;
72
73 typedef struct {
74         int type;
75         char *uuid;
76         char *path;
77         int fd;
78 } bt_agent_osp_server_t;
79
80 void* _bt_create_agent(const char *path, gboolean adapter);
81
82 void _bt_destroy_agent(void *agent);
83
84 gboolean _bt_agent_is_canceled(void);
85 void _bt_agent_set_canceled(gboolean value);
86
87 gboolean _bt_agent_register_osp_server(const gint type,
88                 const char *uuid, char *path, int fd);
89
90 gboolean _bt_agent_unregister_osp_server(const gint type, const char *uuid);
91
92 gboolean _bt_agent_reply_authorize(gboolean accept);
93
94 int _bt_agent_reply_cancellation(void);
95
96 int _bt_launch_system_popup(bt_agent_event_type_t event_type,
97                                                         const char *device_name,
98                                                         char *passkey,
99                                                         const char *filename,
100                                                         const char *agent_path);
101 #endif