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 _BT_MP_CONTROL_H_
19 #define _BT_MP_CONTROL_H_
23 #endif /*__cplusplus*/
25 #define BT_MEDIA_ERROR_NONE ((int)0)
27 #define BT_MEDIA_ERROR_BASE ((int)0)
28 #define BT_MEDIA_ERROR_INTERNAL ((int)BT_MEDIA_ERROR_BASE - 0x01)
29 #define BT_MEDIA_ERROR_ALREADY_INITIALIZED ((int)BT_MEDIA_ERROR_BASE - 0x02)
30 #define BT_MEDIA_ERROR_NOT_CONNECTED ((int)BT_MEDIA_ERROR_BASE - 0x15)
40 } media_player_property_type;
46 } media_player_equalizer_status;
49 REPEAT_MODE_OFF = 0x01,
54 } media_player_repeat_status;
57 SHUFFLE_MODE_OFF = 0x01,
61 } media_player_shuffle_status;
68 } media_player_scan_status;
71 STATUS_STOPPED = 0x00,
78 } media_player_status;
90 } media_player_control_cmd;
97 unsigned int total_tracks;
100 } media_metadata_attributes_t;
103 media_player_equalizer_status equalizer;
104 media_player_repeat_status repeat;
105 media_player_shuffle_status shuffle;
106 media_player_scan_status scan;
107 media_player_status status;
108 unsigned int position;
109 media_metadata_attributes_t metadata;
110 } media_player_settings_t;
117 } media_event_param_t;
119 typedef void (*media_cb_func_ptr)(int, media_event_param_t*, void*);
123 * @fn int bluetooth_media_player_init(media_cb_func_ptr callback_ptr, void *user_data)
124 * @brief Initialize AVRCP service and register the callback
126 * This function is a synchronous call.
128 * @param[in] callback_ptr - Callback function (A2DP connected / Disconnected)
129 * @param[in] user_data - User data
131 * @return BT_MEDIA_ERROR_NONE - Success \n
132 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
133 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
138 int bluetooth_media_player_init(media_cb_func_ptr callback_ptr,
142 * @fn int bluetooth_media_player_deinit(void)
143 * @brief Deinitialize AVRCP service and register the callback
145 * This function is a synchronous call.
147 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
148 * BT_MEDIA_CONTROL_ERROR - Error \n
153 int bluetooth_media_player_deinit(void);
156 * @fn int bluetooth_media_player_set_properties(media_player_settings_t *setting)
157 * @brief Notifies the remote bluetooth headset with change in music player settings
159 * This function is a asynchronous call.
160 * No event for this api..
162 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
163 * BT_MEDIA_CONTROL_ERROR - Error \n
166 * @param[in] setting - The music player properties
171 int bluetooth_media_player_set_properties(
172 media_player_settings_t *setting);
175 * @fn int bluetooth_media_player_change_property(media_player_property_type type,
176 * unsigned int value);
177 * @brief Notifies the remote bluetooth headset with change in music player settings
179 * This function is a asynchronous call.
180 * No event for this api..
182 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
183 * BT_MEDIA_CONTROL_ERROR - Error \n
186 * @param[in] type - Type of the music player property
187 * value - Value of the property which is changed
192 int bluetooth_media_player_change_property(
193 media_player_property_type type,
197 * @fn int bluetooth_media_player_change_track(media_metadata_attributes_t metadata)
198 * @briefNotifies the remote bluetooth headset with change in media attributes of the track
200 * This function is a asynchronous call.
201 * No event for this api..
203 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
204 * BT_MEDIA_CONTROL_ERROR - Error \n
207 * @param[in] metadata -Meida attributes
212 int bluetooth_media_player_change_track(
213 media_metadata_attributes_t *metadata);
216 * @fn int bluetooth_media_control_init(media_cb_func_ptr callback_ptr, void *user_data)
217 * @brief Initialize AVRCP control and register the callback
219 * This function is a synchronous call.
221 * @param[in] callback_ptr - Callback function (AVRCP connected / Disconnected)
222 * @param[in] user_data - User data
224 * @return BT_MEDIA_ERROR_NONE - Success \n
225 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
226 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
231 int bluetooth_media_control_init(media_cb_func_ptr callback_ptr,
235 * @fn int bluetooth_media_control_deinit(void)
236 * @brief Deinitialize AVRCP Control and deregister callback
238 * This function is a synchronous call.
240 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
241 * BT_MEDIA_CONTROL_ERROR - Error \n
246 int bluetooth_media_control_deinit(void);
249 * @brief The function bluetooth_media_control_connect is called to establish an AVRCP
250 * control role connection with the specified device.
252 * @param[in] remote_address Bluetooth device address.
253 * @return int Zero on Success or reason for error if any.
256 int bluetooth_media_control_connect(bluetooth_device_address_t *remote_address);
259 * @brief The function bluetooth_media_control_disconnect is called to disconnect an
260 * existing AVRCP Control role connection with the specified device.
262 * @param[in] remote_address Bluetooth device address.
263 * @return int Zero on Success or reason for error if any.
266 int bluetooth_media_control_disconnect(bluetooth_device_address_t *remote_address);
269 * @brief The function bluetooth_media_target_connect is called to establish an AVRCP
270 * target role connection with the specified device.
272 * @param[in] remote_address Bluetooth device address.
273 * @return int Zero on Success or reason for error if any.
276 int bluetooth_media_target_connect(bluetooth_device_address_t *remote_address);
279 * @brief The function bluetooth_media_target_disconnect is called to disconnect an
280 * existing AVRCP target role connection with the specified device.
282 * @param[in] remote_address Bluetooth device address.
283 * @return int Zero on Success or reason for error if any.
286 int bluetooth_media_target_disconnect(bluetooth_device_address_t *remote_address);
289 * @brief The function bluetooth_media_control_command is called to send
290 * the AVRCP Control command like Play, Pause, FF, Rewind to the target device.
292 * @param[in] type media_player_control_cmd.
293 * @return int Zero on Success or reason for error if any.
296 int bluetooth_media_control_command(media_player_control_cmd type);
299 * @fn int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value)
300 * @brief Notifies the remote bluetooth target with change in music control settings
302 * This function is a asynchronous call.
303 * No event for this api.
305 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
306 * BT_MEDIA_CONTROL_ERROR - Error \n
309 * @param[in] setting - The music control properties
314 int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value);
317 * @fn int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value)
318 * @brief reads the setting of the remote bluetooth target with change in music control settings
320 * This function is a asynchronous call.
321 * No event for this api.
323 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
324 * BT_MEDIA_CONTROL_ERROR - Error \n
327 * @param[in] setting - The music control properties
332 int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value);
335 * @fn int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata)
336 * @brief reads the track metadata from the remote target player.
338 * This function is a asynchronous call.
339 * No event for this api.
341 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
342 * BT_MEDIA_CONTROL_ERROR - Error \n
345 * @param[in] metadata - The music meta data information.
350 int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata);
354 #endif /*__cplusplus*/
356 #endif /*_BT_MP_CONTROL_H_*/