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;
45 } media_transport_property_type;
51 } media_player_equalizer_status;
54 REPEAT_MODE_OFF = 0x01,
59 } media_player_repeat_status;
62 SHUFFLE_MODE_OFF = 0x01,
66 } media_player_shuffle_status;
73 } media_player_scan_status;
76 STATUS_STOPPED = 0x00,
83 } media_player_status;
95 } media_player_control_cmd;
102 unsigned int total_tracks;
104 unsigned int duration;
105 } media_metadata_attributes_t;
108 media_player_equalizer_status equalizer;
109 media_player_repeat_status repeat;
110 media_player_shuffle_status shuffle;
111 media_player_scan_status scan;
112 media_player_status status;
113 unsigned int position;
114 media_metadata_attributes_t metadata;
115 } media_player_settings_t;
122 } media_event_param_t;
124 typedef void (*media_cb_func_ptr)(int, media_event_param_t*, void*);
128 * @fn int bluetooth_media_player_init(media_cb_func_ptr callback_ptr, void *user_data)
129 * @brief Initialize AVRCP service and register the callback
131 * This function is a synchronous call.
133 * @param[in] callback_ptr - Callback function (A2DP connected / Disconnected)
134 * @param[in] user_data - User data
136 * @return BT_MEDIA_ERROR_NONE - Success \n
137 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
138 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
143 int bluetooth_media_player_init(media_cb_func_ptr callback_ptr,
147 * @fn int bluetooth_media_player_deinit(void)
148 * @brief Deinitialize AVRCP service and register the callback
150 * This function is a synchronous call.
152 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
153 * BT_MEDIA_CONTROL_ERROR - Error \n
158 int bluetooth_media_player_deinit(void);
161 * @fn int bluetooth_media_player_set_properties(media_player_settings_t *setting)
162 * @brief Notifies the remote bluetooth headset with change in music player settings
164 * This function is a asynchronous call.
165 * No event for this api..
167 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
168 * BT_MEDIA_CONTROL_ERROR - Error \n
171 * @param[in] setting - The music player properties
176 int bluetooth_media_player_set_properties(
177 media_player_settings_t *setting);
180 * @fn int bluetooth_media_player_change_property(media_player_property_type type,
181 * unsigned int value);
182 * @brief Notifies the remote bluetooth headset with change in music player settings
184 * This function is a asynchronous call.
185 * No event for this api..
187 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
188 * BT_MEDIA_CONTROL_ERROR - Error \n
191 * @param[in] type - Type of the music player property
192 * value - Value of the property which is changed
197 int bluetooth_media_player_change_property(
198 media_player_property_type type,
202 * @fn int bluetooth_media_player_change_track(media_metadata_attributes_t metadata)
203 * @briefNotifies the remote bluetooth headset with change in media attributes of the track
205 * This function is a asynchronous call.
206 * No event for this api..
208 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
209 * BT_MEDIA_CONTROL_ERROR - Error \n
212 * @param[in] metadata -Meida attributes
217 int bluetooth_media_player_change_track(
218 media_metadata_attributes_t *metadata);
221 * @fn int bluetooth_media_control_init(media_cb_func_ptr callback_ptr, void *user_data)
222 * @brief Initialize AVRCP control and register the callback
224 * This function is a synchronous call.
226 * @param[in] callback_ptr - Callback function (AVRCP connected / Disconnected)
227 * @param[in] user_data - User data
229 * @return BT_MEDIA_ERROR_NONE - Success \n
230 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
231 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
236 int bluetooth_media_control_init(media_cb_func_ptr callback_ptr,
240 * @fn int bluetooth_media_control_deinit(void)
241 * @brief Deinitialize AVRCP Control and deregister callback
243 * This function is a synchronous call.
245 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
246 * BT_MEDIA_CONTROL_ERROR - Error \n
251 int bluetooth_media_control_deinit(void);
254 * @brief The function bluetooth_media_control_connect is called to establish an AVRCP
255 * control role connection with the specified device.
257 * @param[in] remote_address Bluetooth device address.
258 * @return int Zero on Success or reason for error if any.
261 int bluetooth_media_control_connect(bluetooth_device_address_t *remote_address);
264 * @brief The function bluetooth_media_control_disconnect is called to disconnect an
265 * existing AVRCP Control role connection with the specified device.
267 * @param[in] remote_address Bluetooth device address.
268 * @return int Zero on Success or reason for error if any.
271 int bluetooth_media_control_disconnect(bluetooth_device_address_t *remote_address);
274 * @brief The function bluetooth_media_target_connect is called to establish an AVRCP
275 * target role connection with the specified device.
277 * @param[in] remote_address Bluetooth device address.
278 * @return int Zero on Success or reason for error if any.
281 int bluetooth_media_target_connect(bluetooth_device_address_t *remote_address);
284 * @brief The function bluetooth_media_target_disconnect is called to disconnect an
285 * existing AVRCP target role connection with the specified device.
287 * @param[in] remote_address Bluetooth device address.
288 * @return int Zero on Success or reason for error if any.
291 int bluetooth_media_target_disconnect(bluetooth_device_address_t *remote_address);
294 * @brief The function bluetooth_media_control_command is called to send
295 * the AVRCP Control command like Play, Pause, FF, Rewind to the target device.
297 * @param[in] type media_player_control_cmd.
298 * @return int Zero on Success or reason for error if any.
301 int bluetooth_media_control_command(media_player_control_cmd type);
304 * @fn int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value)
305 * @brief Notifies the remote bluetooth target with change in music control settings
307 * This function is a asynchronous call.
308 * No event for this api.
310 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
311 * BT_MEDIA_CONTROL_ERROR - Error \n
314 * @param[in] setting - The music control properties
319 int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value);
322 * @fn int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value)
323 * @brief reads the setting of the remote bluetooth target with change in music control settings
325 * This function is a asynchronous call.
326 * No event for this api.
328 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
329 * BT_MEDIA_CONTROL_ERROR - Error \n
332 * @param[in] setting - The music control properties
337 int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value);
340 * @fn int bluetooth_media_transport_set_property(media_transport_property_type type, unsigned int value)
341 * @brief Notifies the remote bluetooth target with change in audio transport settings
343 * This function is a asynchronous call.
344 * No event for this api.
346 * @return BT_MEDIA_TRANSPORT_SUCCESS - Success \n
347 * BT_MEDIA_TRANSPORT_ERROR - Error \n
350 * @param[in] setting - The audio transport properties
355 int bluetooth_media_transport_set_property(media_transport_property_type type, unsigned int value);
358 * @fn int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata)
359 * @brief reads the track metadata from the remote target player.
361 * This function is a asynchronous call.
362 * No event for this api.
364 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
365 * BT_MEDIA_CONTROL_ERROR - Error \n
368 * @param[in] metadata - The music meta data information.
373 int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata);
377 #endif /*__cplusplus*/
379 #endif /*_BT_MP_CONTROL_H_*/