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