2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef _BLUETOOTH_AUDIO_API_H_
19 #define _BLUETOOTH_AUDIO_API_H_
25 #include "bluetooth-api.h"
29 #endif /*__cplusplus*/
31 #define BLUETOOTH_AUDIO_ERROR_BASE ((int)0)
32 #define BLUETOOTH_AUDIO_ERROR_NONE ((int)0)
33 #define BLUETOOTH_AUDIO_ERROR_INTERNAL \
34 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x01)
35 #define BLUETOOTH_AUDIO_ERROR_INVALID_PARAM \
36 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x02)
37 #define BLUETOOTH_AG_ERROR_CONNECTION_ERROR \
38 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x03)
39 #define BLUETOOTH_AV_ERROR_CONNECTION_ERROR \
40 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x04)
47 } bt_audio_event_param_t;
50 BLUETOOTH_AG_STATE_NONE,
51 BLUETOOTH_AG_STATE_CONNECTING,
52 BLUETOOTH_AG_STATE_CONNECTED,
53 BLUETOOTH_AG_STATE_DISCONNECTED,
54 BLUETOOTH_AG_STATE_PLAYING,
55 } bt_ag_conn_status_t;
58 BLUETOOTH_AV_STATE_NONE,
59 BLUETOOTH_AV_STATE_CONNECTING,
60 BLUETOOTH_AV_STATE_CONNECTED,
61 BLUETOOTH_AV_STATE_DISCONNECTED,
62 } bt_av_conn_status_t;
65 BLUETOOTH_HF_CIEV_BATTCHG, /* BT_HF_REMOTE_DEVICE_STATE_BATTERY_LEVEL */
66 BLUETOOTH_HF_CIEV_SIGNAL, /* BT_HF_REMOTE_DEVICE_STATE_SIGNAL_STRENGTH */
67 BLUETOOTH_HF_CIEV_SERVICE, /* BT_HF_REMOTE_DEVICE_STATE_NETWORK_SERVICE */
68 BLUETOOTH_HF_VR_STATUS, /* BT_HF_REMOTE_DEVICE_STATE_VOICE_RECOGNITON */
69 } bt_hf_ciev_device_state_t;
71 typedef void (*bt_audio_func_ptr) (int, bt_audio_event_param_t *, void *);
74 bt_ag_conn_status_t ag_state;
75 bt_av_conn_status_t av_state;
76 unsigned int ag_audio_flag;
77 unsigned int ag_spkr_gain;
78 bluetooth_device_address_t local_address;
79 bluetooth_device_address_t remote_address;
80 bt_audio_func_ptr audio_cb;
85 BLUETOOTH_STATE_NONE = 0x0000,
86 BLUETOOTH_STATE_HEADSET_CONNECTED = 0x0004,
87 BLUETOOTH_STATE_A2DP_HEADSET_CONNECTED = 0x0010,
88 } bluetooth_device_state_t;
91 BLUETOOTH_A2DP_SOURCE,
93 } bluetooth_audio_role_t;
96 * @brief The function bluetooth_audio_init called to initializes the Audio
97 * service to bluetoothD and Global data related to audio.
98 * @param[in] cb Callback function
99 * @param[in] user_data Data sent by application, which will be
100 * returned in event handler.
101 * @return int Zero on Success or reason for error if any.
104 int bluetooth_audio_init(bt_audio_func_ptr cb, void *user_data);
107 * @brief The function bluetooth_audio_deinit is called to free the Audio
108 * related Global data.
110 * @return int Zero on Success or reason for error if any.
113 int bluetooth_audio_deinit(void);
116 * @brief The function bluetooth_audio_connect is called to establish an
117 * AG connection with the specified device.
119 * @param[in] remote_address Bluetooth device address.
120 * @return int Zero on Success or reason for error if any.
123 int bluetooth_audio_connect(bluetooth_device_address_t *remote_address);
126 * @brief The function bluetooth_audio_disconnect is called to disconnect
127 * an existing AG connection with the specified device.
129 * @param[in] remote_address Bluetooth device address.
130 * @return int Zero on Success or reason for error if any.
133 int bluetooth_audio_disconnect(bluetooth_device_address_t *remote_address);
136 * @brief The function bluetooth_ag_connect is called to establish an AG
137 * connection with the specified device.
139 * @param[in] remote_address Bluetooth device address.
140 * @return int Zero on Success or reason for error if any.
143 int bluetooth_ag_connect(bluetooth_device_address_t *remote_address);
146 * @brief The function bluetooth_ag_disconnect is called to disconnect an
147 * existing AG connection with the specified device.
149 * @param[in] remote_address Bluetooth device address.
150 * @return int Zero on Success or reason for error if any.
153 int bluetooth_ag_disconnect(bluetooth_device_address_t *remote_address);
156 * @brief The function bluetooth_av_connect is called to establish an AV
157 * connection with the specified device.
159 * @param[in] remote_address Bluetooth device address.
160 * @return int Zero on Success or reason for error if any.
163 int bluetooth_av_connect(bluetooth_device_address_t *remote_address);
166 * @brief The function bluetooth_av_source_connect is called to establish an AV Source
167 * connection with the specified device.
169 * @param[in] remote_address Bluetooth device address.
170 * @return int Zero on Success or reason for error if any.
173 int bluetooth_av_source_connect(bluetooth_device_address_t *remote_address);
176 * @brief The function bluetooth_av_disconnect is called to disconnect an
177 * existing AV connection with the specified device.
179 * @param[in] remote_address Bluetooth device address.
180 * @return int Zero on Success or reason for error if any.
183 int bluetooth_av_disconnect(bluetooth_device_address_t *remote_address);
186 * @brief The function bluetooth_av_source_disconnect is called to disconnect an
187 * existing AV connection with the specified device.
189 * @param[in] remote_address Bluetooth device address.
190 * @return int Zero on Success or reason for error if any.
193 int bluetooth_av_source_disconnect(bluetooth_device_address_t *remote_address);
196 * @brief The function bluetooth_ag_get_headset_volume is called to get
197 * the changed Volume on AG.
199 * @param[in] speaker_gain Speaker gain/loss.
200 * @return int Zero on Success or reason for error if any.
203 int bluetooth_ag_get_headset_volume(unsigned int *speaker_gain);
206 * @brief The function bluetooth_ag_set_speaker_gain is called to indicate
207 * that the Volume on AG is changed.
209 * @param[in] speaker_gain Speaker gain/loss.
210 * @return int Zero on Success or reason for error if any.
213 int bluetooth_ag_set_speaker_gain(unsigned int speaker_gain);
216 * @brief The function bluetooth_audio_select_role is called to set
217 * A2DP to Source or Sink.
219 * @param[in] role SINK/SOURCE.
220 * @return int Zero on Success or reason for error if any.
223 int bluetooth_audio_select_role(bluetooth_audio_role_t role);
230 } bt_hf_event_param_t;
232 typedef void (*bt_hf_func_ptr) (int, bt_hf_event_param_t *, void *);
235 int bluetooth_hf_init(bt_hf_func_ptr cb, void *user_data);
237 int bluetooth_hf_deinit(void);
239 int bluetooth_hf_connect(bluetooth_device_address_t *remote_address);
241 int bluetooth_hf_disconnect(bluetooth_device_address_t *remote_address);
243 int bluetooth_hf_answer_call();
245 int bluetooth_hf_terminate_call();
247 int bluetooth_hf_initiate_call(char *number);
249 int bluetooth_hf_voice_recognition(unsigned int status);
251 int bluetooth_hf_audio_disconnect(void);
253 int bluetooth_hf_set_speaker_gain(unsigned int speaker_gain);
255 int bluetooth_hf_send_dtmf(char *dtmf);
257 int bluetooth_hf_send_xsat_cmd(int app_id, char *xsat_cmd);
259 int bluetooth_hf_swap_call(void);
261 int bluetooth_hf_release_all_call(void);
263 int bluetooth_hf_release_and_accept(void);
265 int bluetooth_hf_join_call(void);
267 int bluetooth_hf_get_call_list(void *call_list, bt_hf_call_status_info_t **call_status);
269 int bluetooth_hf_free_call_list(bt_hf_call_list_s *call_list);
271 int bluetooth_hf_request_call_list(bt_hf_call_list_s **call_list);
273 int bluetooth_hf_request_call_list_async(void);
275 int bluetooth_hf_get_codec(unsigned int *codec_id);
277 int bluetooth_hf_get_audio_connected(unsigned int *audio_connected);
279 int bluetooth_hf_is_connected(gboolean *hf_connected);
281 int bluetooth_hf_is_ibr_supported(gboolean*ibr_supported);
285 #endif /*__cplusplus*/
286 #endif/*_BLUETOOTH_AUDIO_API_H_*/