4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef _BLUETOOTH_AUDIO_API_H_
21 #define _BLUETOOTH_AUDIO_API_H_
25 #include <dbus/dbus-glib.h>
26 #include <dbus/dbus-glib-lowlevel.h>
29 #include "bluetooth-api.h"
33 #endif /*__cplusplus*/
35 #define BLUETOOTH_AUDIO_ERROR_BASE ((int)0)
36 #define BLUETOOTH_AUDIO_ERROR_NONE ((int)0)
37 #define BLUETOOTH_AUDIO_ERROR_INTERNAL \
38 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x01)
39 #define BLUETOOTH_AUDIO_ERROR_INVALID_PARAM \
40 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x02)
41 #define BLUETOOTH_AG_ERROR_CONNECTION_ERROR \
42 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x03)
43 #define BLUETOOTH_AV_ERROR_CONNECTION_ERROR \
44 ((int)BLUETOOTH_AUDIO_ERROR_BASE - 0x04)
51 } bt_audio_event_param_t;
54 BLUETOOTH_AG_STATE_NONE,
55 BLUETOOTH_AG_STATE_CONNECTING,
56 BLUETOOTH_AG_STATE_CONNECTED,
57 BLUETOOTH_AG_STATE_DISCONNECTED,
58 BLUETOOTH_AG_STATE_PLAYING,
59 } bt_ag_conn_status_t;
62 BLUETOOTH_AV_STATE_NONE,
63 BLUETOOTH_AV_STATE_CONNECTING,
64 BLUETOOTH_AV_STATE_CONNECTED,
65 BLUETOOTH_AV_STATE_DISCONNECTED,
66 } bt_av_conn_status_t;
68 typedef void (*bt_audio_func_ptr) (int, bt_audio_event_param_t *, void *);
71 bt_ag_conn_status_t ag_state;
72 bt_av_conn_status_t av_state;
73 unsigned int ag_audio_flag;
74 unsigned int ag_spkr_gain;
75 bluetooth_device_address_t local_address;
76 bluetooth_device_address_t remote_address;
77 bt_audio_func_ptr audio_cb;
82 BLUETOOTH_STATE_NONE = 0x0000,
83 BLUETOOTH_STATE_HEADSET_CONNECTED = 0x0004,
84 BLUETOOTH_STATE_A2DP_HEADSET_CONNECTED = 0x0010,
85 } bluetooth_device_state_t;
88 * @brief The function bluetooth_audio_init called to initializes the Audio
89 * service to bluetoothD and Global data related to audio.
90 * @param[in] cb Callback function
91 * @param[in] user_data Data sent by application, which will be
92 * returned in event handler.
93 * @return int Zero on Success or reason for error if any.
96 int bluetooth_audio_init(bt_audio_func_ptr cb, void *user_data);
99 * @brief The function bluetooth_audio_deinit is called to free the Audio
100 * related Global data.
102 * @return int Zero on Success or reason for error if any.
105 int bluetooth_audio_deinit(void);
108 * @brief The function bluetooth_audio_connect is called to establish an
109 * AG connection with the specified device.
111 * @param[in] remote_address Bluetooth device address.
112 * @return int Zero on Success or reason for error if any.
115 int bluetooth_audio_connect(bluetooth_device_address_t *remote_address);
118 * @brief The function bluetooth_audio_disconnect is called to disconnect
119 * an existing AG connection with the specified device.
121 * @param[in] remote_address Bluetooth device address.
122 * @return int Zero on Success or reason for error if any.
125 int bluetooth_audio_disconnect(bluetooth_device_address_t *remote_address);
128 * @brief The function bluetooth_ag_connect is called to establish an AG
129 * connection with the specified device.
131 * @param[in] remote_address Bluetooth device address.
132 * @return int Zero on Success or reason for error if any.
135 int bluetooth_ag_connect(bluetooth_device_address_t *remote_address);
138 * @brief The function bluetooth_ag_disconnect is called to disconnect an
139 * existing AG connection with the specified device.
141 * @param[in] remote_address Bluetooth device address.
142 * @return int Zero on Success or reason for error if any.
145 int bluetooth_ag_disconnect(bluetooth_device_address_t *remote_address);
148 * @brief The function bluetooth_av_connect is called to establish an AV
149 * connection with the specified device.
151 * @param[in] remote_address Bluetooth device address.
152 * @return int Zero on Success or reason for error if any.
155 int bluetooth_av_connect(bluetooth_device_address_t *remote_address);
158 * @brief The function bluetooth_av_disconnect is called to disconnect an
159 * existing AV connection with the specified device.
161 * @param[in] remote_address Bluetooth device address.
162 * @return int Zero on Success or reason for error if any.
165 int bluetooth_av_disconnect(bluetooth_device_address_t *remote_address);
168 * @brief The function bluetooth_ag_get_headset_volume is called to get
169 * the changed Volume on AG.
171 * @param[in] speaker_gain Speaker gain/loss.
172 * @return int Zero on Success or reason for error if any.
175 int bluetooth_ag_get_headset_volume(unsigned int *speaker_gain);
178 * @brief The function bluetooth_ag_set_speaker_gain is called to indicate
179 * that the Volume on AG is changed.
181 * @param[in] speaker_gain Speaker gain/loss.
182 * @return int Zero on Success or reason for error if any.
185 int bluetooth_ag_set_speaker_gain(unsigned int speaker_gain);
189 #endif /*__cplusplus*/
190 #endif/*_BLUETOOTH_AUDIO_API_H_*/