4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 * GirishAshok Joshi <girish.joshi@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 #ifndef _BLUETOOTH_AUDIO_API_H_
24 #define _BLUETOOTH_AUDIO_API_H_
30 #include "bluetooth-api.h"
34 #endif /*__cplusplus*/
36 #define BLUETOOTH_AUDIO_ERROR_BASE ((int)0)
37 #define BLUETOOTH_AUDIO_ERROR_NONE ((int)0)
38 #define BLUETOOTH_AUDIO_ERROR_INTERNAL \
39 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x01)
40 #define BLUETOOTH_AUDIO_ERROR_INVALID_PARAM \
41 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x02)
42 #define BLUETOOTH_AG_ERROR_CONNECTION_ERROR \
43 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x03)
44 #define BLUETOOTH_AV_ERROR_CONNECTION_ERROR \
45 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x04)
52 } bt_audio_event_param_t;
55 BLUETOOTH_AG_STATE_NONE,
56 BLUETOOTH_AG_STATE_CONNECTING,
57 BLUETOOTH_AG_STATE_CONNECTED,
58 BLUETOOTH_AG_STATE_DISCONNECTED,
59 BLUETOOTH_AG_STATE_PLAYING,
60 } bt_ag_conn_status_t;
63 BLUETOOTH_AV_STATE_NONE,
64 BLUETOOTH_AV_STATE_CONNECTING,
65 BLUETOOTH_AV_STATE_CONNECTED,
66 BLUETOOTH_AV_STATE_DISCONNECTED,
67 } bt_av_conn_status_t;
69 typedef void (*bt_audio_func_ptr) (int, bt_audio_event_param_t *, void *);
72 bt_ag_conn_status_t ag_state;
73 bt_av_conn_status_t av_state;
74 unsigned int ag_audio_flag;
75 unsigned int ag_spkr_gain;
76 bluetooth_device_address_t local_address;
77 bluetooth_device_address_t remote_address;
78 bt_audio_func_ptr audio_cb;
83 BLUETOOTH_STATE_NONE = 0x0000,
84 BLUETOOTH_STATE_HEADSET_CONNECTED = 0x0004,
85 BLUETOOTH_STATE_A2DP_HEADSET_CONNECTED = 0x0010,
86 } bluetooth_device_state_t;
89 * @brief The function bluetooth_audio_init called to initializes the Audio
90 * service to bluetoothD and Global data related to audio.
91 * @param[in] cb Callback function
92 * @param[in] user_data Data sent by application, which will be
93 * returned in event handler.
94 * @return int Zero on Success or reason for error if any.
97 int bluetooth_audio_init(bt_audio_func_ptr cb, void *user_data);
100 * @brief The function bluetooth_audio_deinit is called to free the Audio
101 * related Global data.
103 * @return int Zero on Success or reason for error if any.
106 int bluetooth_audio_deinit(void);
109 * @brief The function bluetooth_audio_connect is called to establish an
110 * AG connection with the specified device.
112 * @param[in] remote_address Bluetooth device address.
113 * @return int Zero on Success or reason for error if any.
116 int bluetooth_audio_connect(bluetooth_device_address_t *remote_address);
119 * @brief The function bluetooth_audio_disconnect is called to disconnect
120 * an existing AG connection with the specified device.
122 * @param[in] remote_address Bluetooth device address.
123 * @return int Zero on Success or reason for error if any.
126 int bluetooth_audio_disconnect(bluetooth_device_address_t *remote_address);
129 * @brief The function bluetooth_ag_connect is called to establish an AG
130 * connection with the specified device.
132 * @param[in] remote_address Bluetooth device address.
133 * @return int Zero on Success or reason for error if any.
136 int bluetooth_ag_connect(bluetooth_device_address_t *remote_address);
139 * @brief The function bluetooth_ag_disconnect is called to disconnect an
140 * existing AG connection with the specified device.
142 * @param[in] remote_address Bluetooth device address.
143 * @return int Zero on Success or reason for error if any.
146 int bluetooth_ag_disconnect(bluetooth_device_address_t *remote_address);
149 * @brief The function bluetooth_av_connect is called to establish an AV
150 * connection with the specified device.
152 * @param[in] remote_address Bluetooth device address.
153 * @return int Zero on Success or reason for error if any.
156 int bluetooth_av_connect(bluetooth_device_address_t *remote_address);
159 * @brief The function bluetooth_av_source_connect is called to establish an AV Source
160 * connection with the specified device.
162 * @param[in] remote_address Bluetooth device address.
163 * @return int Zero on Success or reason for error if any.
166 int bluetooth_av_source_connect(bluetooth_device_address_t *remote_address);
169 * @brief The function bluetooth_av_disconnect is called to disconnect an
170 * existing AV connection with the specified device.
172 * @param[in] remote_address Bluetooth device address.
173 * @return int Zero on Success or reason for error if any.
176 int bluetooth_av_disconnect(bluetooth_device_address_t *remote_address);
179 * @brief The function bluetooth_av_source_disconnect is called to disconnect an
180 * existing AV connection with the specified device.
182 * @param[in] remote_address Bluetooth device address.
183 * @return int Zero on Success or reason for error if any.
186 int bluetooth_av_source_disconnect(bluetooth_device_address_t *remote_address);
189 * @brief The function bluetooth_ag_get_headset_volume is called to get
190 * the changed Volume on AG.
192 * @param[in] speaker_gain Speaker gain/loss.
193 * @return int Zero on Success or reason for error if any.
196 int bluetooth_ag_get_headset_volume(unsigned int *speaker_gain);
199 * @brief The function bluetooth_ag_set_speaker_gain is called to indicate
200 * that the Volume on AG is changed.
202 * @param[in] speaker_gain Speaker gain/loss.
203 * @return int Zero on Success or reason for error if any.
206 int bluetooth_ag_set_speaker_gain(unsigned int speaker_gain);
213 } bt_hf_event_param_t;
215 typedef void (*bt_hf_func_ptr) (int, bt_hf_event_param_t *, void *);
218 int bluetooth_hf_init(bt_hf_func_ptr cb, void *user_data);
220 int bluetooth_hf_deinit(void);
222 int bluetooth_hf_connect(bluetooth_device_address_t *remote_address);
224 int bluetooth_hf_disconnect(bluetooth_device_address_t *remote_address);
226 int bluetooth_hf_answer_call();
228 int bluetooth_hf_terminate_call();
230 int bluetooth_hf_initiate_call(char *number);
232 int bluetooth_hf_voice_recognition(unsigned int status);
234 int bluetooth_hf_audio_disconnect(void);
236 int bluetooth_hf_set_speaker_gain(unsigned int speaker_gain);
238 int bluetooth_hf_send_dtmf(char *dtmf);
240 int bluetooth_hf_send_xsat_cmd(int app_id, char *xsat_cmd);
242 int bluetooth_hf_swap_call(void);
244 int bluetooth_hf_release_all_call(void);
246 int bluetooth_hf_release_and_accept(void);
248 int bluetooth_hf_join_call(void);
250 int bluetooth_hf_get_call_list(void *call_list, bt_hf_call_status_info_t **call_status);
252 int bluetooth_hf_free_call_list(bt_hf_call_list_s *call_list);
254 int bluetooth_hf_request_call_list(bt_hf_call_list_s **call_list);
256 int bluetooth_hf_get_codec(unsigned int *codec_id);
258 int bluetooth_hf_get_audio_connected(unsigned int *audio_connected);
260 int bluetooth_hf_is_connected(gboolean *hf_connected);
264 #endif /*__cplusplus*/
265 #endif/*_BLUETOOTH_AUDIO_API_H_*/