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 * @brief The function bluetooth_audio_init called to initializes the Audio
92 * service to bluetoothD and Global data related to audio.
93 * @param[in] cb Callback function
94 * @param[in] user_data Data sent by application, which will be
95 * returned in event handler.
96 * @return int Zero on Success or reason for error if any.
99 int bluetooth_audio_init(bt_audio_func_ptr cb, void *user_data);
102 * @brief The function bluetooth_audio_deinit is called to free the Audio
103 * related Global data.
105 * @return int Zero on Success or reason for error if any.
108 int bluetooth_audio_deinit(void);
111 * @brief The function bluetooth_audio_connect is called to establish an
112 * AG connection with the specified device.
114 * @param[in] remote_address Bluetooth device address.
115 * @return int Zero on Success or reason for error if any.
118 int bluetooth_audio_connect(bluetooth_device_address_t *remote_address);
121 * @brief The function bluetooth_audio_disconnect is called to disconnect
122 * an existing AG connection with the specified device.
124 * @param[in] remote_address Bluetooth device address.
125 * @return int Zero on Success or reason for error if any.
128 int bluetooth_audio_disconnect(bluetooth_device_address_t *remote_address);
131 * @brief The function bluetooth_ag_connect is called to establish an AG
132 * connection with the specified device.
134 * @param[in] remote_address Bluetooth device address.
135 * @return int Zero on Success or reason for error if any.
138 int bluetooth_ag_connect(bluetooth_device_address_t *remote_address);
141 * @brief The function bluetooth_ag_disconnect is called to disconnect an
142 * existing AG connection with the specified device.
144 * @param[in] remote_address Bluetooth device address.
145 * @return int Zero on Success or reason for error if any.
148 int bluetooth_ag_disconnect(bluetooth_device_address_t *remote_address);
151 * @brief The function bluetooth_av_connect is called to establish an AV
152 * connection with the specified device.
154 * @param[in] remote_address Bluetooth device address.
155 * @return int Zero on Success or reason for error if any.
158 int bluetooth_av_connect(bluetooth_device_address_t *remote_address);
161 * @brief The function bluetooth_av_source_connect is called to establish an AV Source
162 * connection with the specified device.
164 * @param[in] remote_address Bluetooth device address.
165 * @return int Zero on Success or reason for error if any.
168 int bluetooth_av_source_connect(bluetooth_device_address_t *remote_address);
171 * @brief The function bluetooth_av_disconnect is called to disconnect an
172 * existing AV connection with the specified device.
174 * @param[in] remote_address Bluetooth device address.
175 * @return int Zero on Success or reason for error if any.
178 int bluetooth_av_disconnect(bluetooth_device_address_t *remote_address);
181 * @brief The function bluetooth_av_source_disconnect is called to disconnect an
182 * existing AV connection with the specified device.
184 * @param[in] remote_address Bluetooth device address.
185 * @return int Zero on Success or reason for error if any.
188 int bluetooth_av_source_disconnect(bluetooth_device_address_t *remote_address);
191 * @brief The function bluetooth_ag_get_headset_volume is called to get
192 * the changed Volume on AG.
194 * @param[in] speaker_gain Speaker gain/loss.
195 * @return int Zero on Success or reason for error if any.
198 int bluetooth_ag_get_headset_volume(unsigned int *speaker_gain);
201 * @brief The function bluetooth_ag_set_speaker_gain is called to indicate
202 * that the Volume on AG is changed.
204 * @param[in] speaker_gain Speaker gain/loss.
205 * @return int Zero on Success or reason for error if any.
208 int bluetooth_ag_set_speaker_gain(unsigned int speaker_gain);
215 } bt_hf_event_param_t;
217 typedef void (*bt_hf_func_ptr) (int, bt_hf_event_param_t *, void *);
220 int bluetooth_hf_init(bt_hf_func_ptr cb, void *user_data);
222 int bluetooth_hf_deinit(void);
224 int bluetooth_hf_connect(bluetooth_device_address_t *remote_address);
226 int bluetooth_hf_disconnect(bluetooth_device_address_t *remote_address);
228 int bluetooth_hf_answer_call();
230 int bluetooth_hf_terminate_call();
232 int bluetooth_hf_initiate_call(char *number);
234 int bluetooth_hf_voice_recognition(unsigned int status);
236 int bluetooth_hf_audio_disconnect(void);
238 int bluetooth_hf_set_speaker_gain(unsigned int speaker_gain);
240 int bluetooth_hf_send_dtmf(char *dtmf);
242 int bluetooth_hf_send_xsat_cmd(int app_id, char *xsat_cmd);
244 int bluetooth_hf_swap_call(void);
246 int bluetooth_hf_release_all_call(void);
248 int bluetooth_hf_release_and_accept(void);
250 int bluetooth_hf_join_call(void);
252 int bluetooth_hf_get_call_list(void *call_list, bt_hf_call_status_info_t **call_status);
254 int bluetooth_hf_free_call_list(bt_hf_call_list_s *call_list);
256 int bluetooth_hf_request_call_list(bt_hf_call_list_s **call_list);
258 int bluetooth_hf_get_codec(unsigned int *codec_id);
260 int bluetooth_hf_get_audio_connected(unsigned int *audio_connected);
262 int bluetooth_hf_is_connected(gboolean *hf_connected);
264 int bluetooth_hf_is_ibr_supported(gboolean*ibr_supported);
268 #endif /*__cplusplus*/
269 #endif/*_BLUETOOTH_AUDIO_API_H_*/