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_
28 #include <dbus/dbus-glib.h>
29 #include <dbus/dbus-glib-lowlevel.h>
32 #include "bluetooth-api.h"
36 #endif /*__cplusplus*/
38 #define BLUETOOTH_AUDIO_ERROR_BASE ((int)0)
39 #define BLUETOOTH_AUDIO_ERROR_NONE ((int)0)
40 #define BLUETOOTH_AUDIO_ERROR_INTERNAL \
41 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x01)
42 #define BLUETOOTH_AUDIO_ERROR_INVALID_PARAM \
43 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x02)
44 #define BLUETOOTH_AG_ERROR_CONNECTION_ERROR \
45 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x03)
46 #define BLUETOOTH_AV_ERROR_CONNECTION_ERROR \
47 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x04)
54 } bt_audio_event_param_t;
57 BLUETOOTH_AG_STATE_NONE,
58 BLUETOOTH_AG_STATE_CONNECTING,
59 BLUETOOTH_AG_STATE_CONNECTED,
60 BLUETOOTH_AG_STATE_DISCONNECTED,
61 BLUETOOTH_AG_STATE_PLAYING,
62 } bt_ag_conn_status_t;
65 BLUETOOTH_AV_STATE_NONE,
66 BLUETOOTH_AV_STATE_CONNECTING,
67 BLUETOOTH_AV_STATE_CONNECTED,
68 BLUETOOTH_AV_STATE_DISCONNECTED,
69 } bt_av_conn_status_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_disconnect is called to disconnect an
162 * existing AV 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_disconnect(bluetooth_device_address_t *remote_address);
171 * @brief The function bluetooth_ag_get_headset_volume is called to get
172 * the changed Volume on AG.
174 * @param[in] speaker_gain Speaker gain/loss.
175 * @return int Zero on Success or reason for error if any.
178 int bluetooth_ag_get_headset_volume(unsigned int *speaker_gain);
181 * @brief The function bluetooth_ag_set_speaker_gain is called to indicate
182 * that the Volume on AG is changed.
184 * @param[in] speaker_gain Speaker gain/loss.
185 * @return int Zero on Success or reason for error if any.
188 int bluetooth_ag_set_speaker_gain(unsigned int speaker_gain);
195 } bt_hf_event_param_t;
197 typedef void (*bt_hf_func_ptr) (int, bt_hf_event_param_t *, void *);
200 int bluetooth_hf_init(bt_hf_func_ptr cb, void *user_data);
202 int bluetooth_hf_deinit(void);
204 int bluetooth_hf_connect(bluetooth_device_address_t *remote_address);
206 int bluetooth_hf_disconnect(bluetooth_device_address_t *remote_address);
208 int bluetooth_hf_answer_call();
210 int bluetooth_hf_terminate_call();
212 int bluetooth_hf_initiate_call(char *number);
214 int bluetooth_hf_voice_recognition(unsigned int status);
216 int bluetooth_hf_audio_disconnect(void);
218 int bluetooth_hf_set_speaker_gain(unsigned int speaker_gain);
220 int bluetooth_hf_send_dtmf(char *dtmf);
222 int bluetooth_hf_send_xsat_cmd(int app_id, char *xsat_cmd);
224 int bluetooth_hf_swap_call(void);
226 int bluetooth_hf_release_all_call(void);
228 int bluetooth_hf_release_and_accept(void);
230 int bluetooth_hf_join_call(void);
232 int bluetooth_hf_get_call_list(void *call_list, bt_hf_call_status_info_t **call_status);
234 int bluetooth_hf_free_call_list(bt_hf_call_list_s *call_list);
236 int bluetooth_hf_request_call_list(bt_hf_call_list_s **call_list);
238 int bluetooth_hf_get_codec(unsigned int *codec_id);
240 int bluetooth_hf_get_audio_connected(unsigned int *audio_connected);
242 int bluetooth_hf_is_hf_connected(gboolean *hf_connected);
246 #endif /*__cplusplus*/
247 #endif/*_BLUETOOTH_AUDIO_API_H_*/