Rollback changes to submit TIZEN:COMMON project
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / include / bt-service-agent.h
1 /*
2  * bluetooth-frwk
3  *
4  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  *              http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20 #ifndef BT_SERVICE_AGENT_H
21 #define BT_SERVICE_AGENT_H
22
23 #include <stdint.h>
24 #include <glib.h>
25 #include <dbus/dbus-glib.h>
26 #include <dbus/dbus-glib-lowlevel.h>
27
28 #include <unistd.h>
29 #include <dlog.h>
30
31 #include <stdio.h>
32
33 #include <dbus/dbus-glib.h>
34
35 #undef LOG_TAG
36 #define LOG_TAG "BLUETOOTH_FRWK_SERVICE"
37 #define ERR(fmt, args...) SLOGE(fmt, ##args)
38
39 #define BT_AGENT_PADDING_SIZE 4096
40 #define BT_MAX_SERVICES_FOR_DEVICE      20     /**< This specifies maximum number of services a
41                                                 device can support */
42 #define BT_MAX_EVENT_STR_LENGTH 50
43 #define BT_AGENT_ADDR_SIZE      18
44
45 /* Define Error type */
46 #define BT_AGENT_FAIL -1
47 #define BT_AGENT_ERROR_NONE 0
48
49 #define BT_FILE_VISIBLE_TIME "file/private/libug-setting-bluetooth-efl/visibility_time"
50
51 typedef enum {
52         HS_PROFILE_UUID = ((unsigned short)0x1108),             /**<HS*/
53         AUDIO_SOURCE_UUID = ((unsigned short)0x110A),           /**<AUDIO SOURCE*/
54         AUDIO_SINK_UUID = ((unsigned short)0x110B),             /**<AUDIO SINK*/
55         AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C),/**<AV REMOTE CONTROL TARGET*/
56         ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D), /**<A2DP*/
57         AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E),      /**<AV REMOTE CONTROL UUID*/
58         HF_PROFILE_UUID = ((unsigned short)0x111E),             /**<HF*/
59 } bt_agent_service_uuid_list_t;
60
61 typedef enum {
62         BT_AGENT_EVENT_PIN_REQUEST = 0x0001,
63         BT_AGENT_EVENT_PASSKEY_CONFIRM_REQUEST = 0x0002,
64         BT_AGENT_EVENT_PASSKEY_REQUEST = 0x0004,
65         BT_AGENT_EVENT_PASSKEY_DISPLAY_REQUEST = 0x0008,
66         BT_AGENT_EVENT_AUTHORIZE_REQUEST = 0x0010,
67         BT_AGENT_EVENT_CONFIRM_MODE_REQUEST = 0x0020,
68         BT_AGENT_EVENT_APP_CONFIRM_REQUEST = 0x0040,
69         BT_AGENT_EVENT_FILE_RECEIVED = 0x0080,
70         BT_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST = 0x0100,
71         BT_AGENT_EVENT_SECURITY = 0x0200,
72         BT_AGENT_EVENT_TERMINATE = 0x0400,
73         BT_AGENT_EVENT_EXCHANGE_REQUEST = 0x0800,
74         BT_AGENT_EVENT_PBAP_REQUEST = 0x1000,
75         BT_AGENT_EVENT_MAP_REQUEST = 0x2000,
76 } bt_agent_event_type_t;
77
78 typedef enum {
79         BT_AGENT_CHANGED_MODE_ENABLE,
80         BT_AGENT_CHANGED_MODE_DISABLE,
81 } bt_agent_changed_mode_type_t;
82
83 typedef enum {
84         BT_AGENT_RUN_STATUS_NO_CHANGE = 0x00,   /* No Change BT status*/
85         BT_AGENT_RUN_STATUS_ACTIVATE = 0x01,    /* BT Activate*/
86         BT_AGENT_RUN_STATUS_DEACTIVATE = 0x02,  /* BT Deactivate*/
87         BT_AGENT_RUN_STATUS_SEARCH_TEST = 0x03, /* BT Search Test*/
88         BT_AGENT_RUN_STATUS_TERMINATE = 0x04,   /* BT Terminate*/
89         BT_AGENT_RUN_STATUS_MAX = 0x05, /* Max val*/
90 } bt_agent_run_status_t;
91
92 typedef enum {
93         BT_AGENT_ON_CURRENTVIEW = 0x00, /* Run BT on current view*/
94         BT_AGENT_ON_FOREGROUND = 0x01,  /* Run BT on foreground*/
95         BT_AGENT_ON_BACKGROUND = 0x02,  /* Run BT on background*/
96 } bt_agent_on_t;
97
98 typedef enum {
99         BT_AGENT_OBEX_SERVER = 0x00,
100         BT_AGENT_RFCOMM_SERVER = 0x01,
101 } bt_agent_osp_server_type_t;
102
103 typedef struct {
104         int type;
105         char *uuid;
106 } bt_agent_osp_server_t;
107
108 typedef struct {
109         unsigned int service_list_array[BT_MAX_SERVICES_FOR_DEVICE];
110         int service_index;
111 } bt_agent_sdp_info_t;
112
113 void* _bt_create_agent(const char *path, gboolean adapter);
114
115 void _bt_destroy_agent(void *agent);
116
117 gboolean _bt_agent_is_canceled(void *agent);
118
119 gboolean _bt_agent_register_osp_server(const gint type, const char *uuid);
120
121 gboolean _bt_agent_unregister_osp_server(const gint type, const char *uuid);
122
123 gboolean _bt_agent_reply_authorize(gboolean accept);
124
125 #endif