A2DP role change: framework API.
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / include / bt-service-audio.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
19 #ifndef _BT_SERVICE_AUDIO_H_
20 #define _BT_SERVICE_AUDIO_H_
21
22 #include <glib.h>
23 #include <sys/types.h>
24 #include "bluetooth-api.h"
25 #include "bluetooth-audio-api.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef struct {
32         int req_id;
33         int type;
34         int disconnection_type;
35         char *address;
36         gboolean ag_flag;
37 } bt_headset_wait_t;
38
39 typedef struct {
40         int key;
41         const char *property;
42 } bt_player_settinngs_t;
43
44 typedef enum {
45         BT_PENDING_NONE = 0x00,
46         BT_PENDING_CONNECT,
47         BT_PENDING_DISCONNECT
48 } bt_pending_request_t;
49
50 typedef struct {
51         int req_id;
52         char *address;
53         bt_pending_request_t  pending;
54         int type;
55 } bt_audio_function_data_t;
56
57 typedef enum {
58         BT_AUDIO_HSP = 0x01,
59         BT_AUDIO_A2DP,
60         BT_AUDIO_ALL,
61         BT_AVRCP,
62         BT_AUDIO_A2DP_SOURCE,
63         BT_AVRCP_TARGET
64 } bt_audio_type_t;
65
66 typedef enum {
67         BT_STATE_NONE = 0x00,
68         BT_STATE_CONNECTING,
69         BT_STATE_CONNECTED,
70         BT_STATE_DISCONNECTING,
71         BT_STATE_DISCONNECTED
72 } bt_headset_device_state_t;
73
74 #define BT_CONTENT_PROTECTION_PATH "/org/tizen/bluetooth/a2dpcontentprotection"
75 #define BT_CONTENT_PROTECTION_INTERFACE "org.tizen.bluetooth.A2dpContentProtection"
76
77 #ifdef TIZEN_BT_A2DP_SINK_AUTO_CONNECT
78 #define BT_AUTO_CONNECT_TIMEOUT_AFTER_BT_ACTIVATED 2     /* 2 sec */
79 #define BT_AUTO_CONNECT_TIMEOUT_AFTER_LINKLOSS 30     /* 30 sec */
80 #define BT_AUTO_CONNECT_TIMEOUT_RETRY_TIME 3600     /* 60 minute */
81 #endif
82
83 int _bt_audio_select_role(bluetooth_audio_role_t role);
84
85 int _bt_audio_connect(int request_id, int type,
86                 bluetooth_device_address_t *device_address,
87                 GArray *out_param1);
88
89 int _bt_audio_disconnect(int request_id, int type,
90                 bluetooth_device_address_t *device_address,
91                 GArray *out_param1);
92
93 int _bt_hf_connect(int request_id,
94                 bluetooth_device_address_t *device_address,
95                 GArray *out_param1);
96
97 int _bt_hf_disconnect(int request_id,
98                 bluetooth_device_address_t *device_address,
99                 GArray *out_param1);
100
101 int _bt_audio_get_speaker_gain(unsigned int *gain);
102
103 int _bt_audio_set_speaker_gain(unsigned int gain);
104
105 int _bt_audio_set_content_protect(gboolean status);
106
107 void _bt_set_audio_wait_data_flag(gboolean flag);
108
109 bt_headset_wait_t *_bt_get_audio_wait_data(void);
110
111 void _bt_rel_wait_data(void);
112
113 void _bt_add_headset_to_list(int type, int status, const char *address);
114
115 void _bt_remove_headset_from_list(int type, const char *address);
116
117 gboolean _bt_is_headset_type_connected(int type, char *address);
118 #ifdef TIZEN_BT_DUAL_HEADSET_CONNECT
119 void _bt_check_already_connected_headset(int type, char *address);
120 #endif
121 void _bt_remove_from_connected_list(const char *address);
122
123 int _bt_get_device_state_from_list(int type, const char *address);
124
125 void _bt_remove_from_connected_list(const char *address);
126
127 void _bt_audio_check_pending_connect();
128
129 gboolean _bt_is_service_connected(char *address, int type);
130
131 #ifdef TIZEN_BT_A2DP_SINK_AUTO_CONNECT
132 int _bt_audio_start_auto_connect(gboolean linkloss_flag);
133
134 int _bt_audio_stop_auto_connect(void);
135
136 void _bt_audio_set_auto_connect_device_addr(const char *address);
137 #endif
138
139 #ifdef __cplusplus
140 }
141 #endif /* __cplusplus */
142 #endif /*_BT_SERVICE_AUDIO_H_*/
143