54716d28e8c06077dbe36ea9ab7498ded433dab7
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / include / bt-service-agent.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *              http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #ifndef BT_SERVICE_AGENT_H
19 #define BT_SERVICE_AGENT_H
20
21 #include <stdint.h>
22 #include <glib.h>
23 #include <unistd.h>
24 #include <dlog.h>
25 #include <stdio.h>
26
27 #undef LOG_TAG
28 #define LOG_TAG "BLUETOOTH_FRWK_SERVICE"
29 #define ERR(fmt, args...) SLOGE(fmt, ##args)
30
31 #define BT_MAX_EVENT_STR_LENGTH 50
32
33 #ifndef TIZEN_PROFILE_WEARABLE
34 #define BT_FILE_VISIBLE_TIME "file/private/libug-setting-bluetooth-efl/visibility_time"
35 #endif
36
37 typedef enum {
38         HS_PROFILE_UUID = ((unsigned short)0x1108),             /**<HS*/
39         AUDIO_SOURCE_UUID = ((unsigned short)0x110A),           /**<AUDIO SOURCE*/
40         AUDIO_SINK_UUID = ((unsigned short)0x110B),             /**<AUDIO SINK*/
41         AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C),/**<AV REMOTE CONTROL TARGET*/
42         ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D), /**<A2DP*/
43         AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E),      /**<AV REMOTE CONTROL UUID*/
44         HF_PROFILE_UUID = ((unsigned short)0x111E),             /**<HF*/
45 } bt_agent_service_uuid_list_t;
46
47 typedef enum {
48         BT_AGENT_EVENT_PIN_REQUEST,
49         BT_AGENT_EVENT_PASSKEY_CONFIRM_REQUEST,
50         BT_AGENT_EVENT_PASSKEY_AUTO_ACCEPTED,
51         BT_AGENT_EVENT_PASSKEY_REQUEST,
52         BT_AGENT_EVENT_PASSKEY_DISPLAY_REQUEST,
53         BT_AGENT_EVENT_AUTHORIZE_REQUEST,
54         BT_AGENT_EVENT_CONFIRM_MODE_REQUEST,
55         BT_AGENT_EVENT_APP_CONFIRM_REQUEST,
56         BT_AGENT_EVENT_FILE_RECEIVED,
57         BT_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST,
58         BT_AGENT_EVENT_SECURITY,
59         BT_AGENT_EVENT_TERMINATE,
60         BT_AGENT_EVENT_EXCHANGE_REQUEST,
61         BT_AGENT_EVENT_PBAP_REQUEST,
62         BT_AGENT_EVENT_MAP_REQUEST,
63         BT_AGENT_EVENT_SYSTEM_RESET_REQUEST,
64         BT_AGENT_EVENT_LEGACY_PAIR_FAILED_FROM_REMOTE,
65 } bt_agent_event_type_t;
66
67 typedef struct {
68         int type;
69         char *uuid;
70         char *path;
71         int fd;
72 } bt_agent_osp_server_t;
73
74 void* _bt_create_agent(const char *path, gboolean adapter);
75
76 void _bt_destroy_agent(void *agent);
77
78 gboolean _bt_agent_is_canceled(void);
79 void _bt_agent_set_canceled(gboolean value);
80
81 gboolean _bt_agent_register_osp_server(const gint type,
82                 const char *uuid, char *path, int fd);
83
84 gboolean _bt_agent_unregister_osp_server(const gint type, const char *uuid);
85
86 gboolean _bt_agent_reply_authorize(gboolean accept);
87
88 int _bt_agent_reply_cancellation(void);
89
90 int _bt_launch_system_popup(bt_agent_event_type_t event_type,
91                                                         const char *device_name,
92                                                         const unsigned char *auth_info,
93                                                         char *passkey,
94                                                         const char *filename,
95                                                         const char *agent_path);
96
97 int _bt_set_passkey_notification(const char *sender, gboolean enable);
98
99 #endif