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;
64 typedef void (*bt_audio_func_ptr) (int, bt_audio_event_param_t *, void *);
67 bt_ag_conn_status_t ag_state;
68 bt_av_conn_status_t av_state;
69 unsigned int ag_audio_flag;
70 unsigned int ag_spkr_gain;
71 bluetooth_device_address_t local_address;
72 bluetooth_device_address_t remote_address;
73 bt_audio_func_ptr audio_cb;
78 BLUETOOTH_STATE_NONE = 0x0000,
79 BLUETOOTH_STATE_HEADSET_CONNECTED = 0x0004,
80 BLUETOOTH_STATE_A2DP_HEADSET_CONNECTED = 0x0010,
81 } bluetooth_device_state_t;
84 * @brief The function bluetooth_audio_init called to initializes the Audio
85 * service to bluetoothD and Global data related to audio.
86 * @param[in] cb Callback function
87 * @param[in] user_data Data sent by application, which will be
88 * returned in event handler.
89 * @return int Zero on Success or reason for error if any.
92 int bluetooth_audio_init(bt_audio_func_ptr cb, void *user_data);
95 * @brief The function bluetooth_audio_deinit is called to free the Audio
96 * related Global data.
98 * @return int Zero on Success or reason for error if any.
101 int bluetooth_audio_deinit(void);
104 * @brief The function bluetooth_audio_connect is called to establish an
105 * AG connection with the specified device.
107 * @param[in] remote_address Bluetooth device address.
108 * @return int Zero on Success or reason for error if any.
111 int bluetooth_audio_connect(bluetooth_device_address_t *remote_address);
114 * @brief The function bluetooth_audio_disconnect is called to disconnect
115 * an existing AG connection with the specified device.
117 * @param[in] remote_address Bluetooth device address.
118 * @return int Zero on Success or reason for error if any.
121 int bluetooth_audio_disconnect(bluetooth_device_address_t *remote_address);
124 * @brief The function bluetooth_ag_connect is called to establish an AG
125 * connection with the specified device.
127 * @param[in] remote_address Bluetooth device address.
128 * @return int Zero on Success or reason for error if any.
131 int bluetooth_ag_connect(bluetooth_device_address_t *remote_address);
134 * @brief The function bluetooth_ag_disconnect is called to disconnect an
135 * existing AG connection with the specified device.
137 * @param[in] remote_address Bluetooth device address.
138 * @return int Zero on Success or reason for error if any.
141 int bluetooth_ag_disconnect(bluetooth_device_address_t *remote_address);
144 * @brief The function bluetooth_av_connect is called to establish an AV
145 * connection with the specified device.
147 * @param[in] remote_address Bluetooth device address.
148 * @return int Zero on Success or reason for error if any.
151 int bluetooth_av_connect(bluetooth_device_address_t *remote_address);
154 * @brief The function bluetooth_av_source_connect is called to establish an AV Source
155 * connection with the specified device.
157 * @param[in] remote_address Bluetooth device address.
158 * @return int Zero on Success or reason for error if any.
161 int bluetooth_av_source_connect(bluetooth_device_address_t *remote_address);
164 * @brief The function bluetooth_av_disconnect is called to disconnect an
165 * existing AV connection with the specified device.
167 * @param[in] remote_address Bluetooth device address.
168 * @return int Zero on Success or reason for error if any.
171 int bluetooth_av_disconnect(bluetooth_device_address_t *remote_address);
174 * @brief The function bluetooth_av_source_disconnect is called to disconnect an
175 * existing AV connection with the specified device.
177 * @param[in] remote_address Bluetooth device address.
178 * @return int Zero on Success or reason for error if any.
181 int bluetooth_av_source_disconnect(bluetooth_device_address_t *remote_address);
184 * @brief The function bluetooth_ag_get_headset_volume is called to get
185 * the changed Volume on AG.
187 * @param[in] speaker_gain Speaker gain/loss.
188 * @return int Zero on Success or reason for error if any.
191 int bluetooth_ag_get_headset_volume(unsigned int *speaker_gain);
194 * @brief The function bluetooth_ag_set_speaker_gain is called to indicate
195 * that the Volume on AG is changed.
197 * @param[in] speaker_gain Speaker gain/loss.
198 * @return int Zero on Success or reason for error if any.
201 int bluetooth_ag_set_speaker_gain(unsigned int speaker_gain);
208 } bt_hf_event_param_t;
210 typedef void (*bt_hf_func_ptr) (int, bt_hf_event_param_t *, void *);
213 int bluetooth_hf_init(bt_hf_func_ptr cb, void *user_data);
215 int bluetooth_hf_deinit(void);
217 int bluetooth_hf_connect(bluetooth_device_address_t *remote_address);
219 int bluetooth_hf_disconnect(bluetooth_device_address_t *remote_address);
221 int bluetooth_hf_answer_call();
223 int bluetooth_hf_terminate_call();
225 int bluetooth_hf_initiate_call(char *number);
227 int bluetooth_hf_voice_recognition(unsigned int status);
229 int bluetooth_hf_audio_disconnect(void);
231 int bluetooth_hf_set_speaker_gain(unsigned int speaker_gain);
233 int bluetooth_hf_send_dtmf(char *dtmf);
235 int bluetooth_hf_send_xsat_cmd(int app_id, char *xsat_cmd);
237 int bluetooth_hf_swap_call(void);
239 int bluetooth_hf_release_all_call(void);
241 int bluetooth_hf_release_and_accept(void);
243 int bluetooth_hf_join_call(void);
245 int bluetooth_hf_get_call_list(void *call_list, bt_hf_call_status_info_t **call_status);
247 int bluetooth_hf_free_call_list(bt_hf_call_list_s *call_list);
249 int bluetooth_hf_request_call_list(bt_hf_call_list_s **call_list);
251 int bluetooth_hf_get_codec(unsigned int *codec_id);
253 int bluetooth_hf_get_audio_connected(unsigned int *audio_connected);
255 int bluetooth_hf_is_connected(gboolean *hf_connected);
259 #endif /*__cplusplus*/
260 #endif/*_BLUETOOTH_AUDIO_API_H_*/