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;
97 } media_player_control_cmd;
104 unsigned int total_tracks;
106 unsigned int duration;
107 } media_metadata_attributes_t;
110 media_player_equalizer_status equalizer;
111 media_player_repeat_status repeat;
112 media_player_shuffle_status shuffle;
113 media_player_scan_status scan;
114 media_player_status status;
115 unsigned int position;
116 media_metadata_attributes_t metadata;
117 } media_player_settings_t;
124 } media_event_param_t;
126 typedef void (*media_cb_func_ptr)(int, media_event_param_t*, void*);
130 * @fn int bluetooth_media_player_init(media_cb_func_ptr callback_ptr, void *user_data)
131 * @brief Initialize AVRCP service and register the callback
133 * This function is a synchronous call.
135 * @param[in] callback_ptr - Callback function (A2DP connected / Disconnected)
136 * @param[in] user_data - User data
138 * @return BT_MEDIA_ERROR_NONE - Success \n
139 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
140 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
145 int bluetooth_media_player_init(media_cb_func_ptr callback_ptr,
149 * @fn int bluetooth_media_player_deinit(void)
150 * @brief Deinitialize AVRCP service and register the callback
152 * This function is a synchronous call.
154 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
155 * BT_MEDIA_CONTROL_ERROR - Error \n
160 int bluetooth_media_player_deinit(void);
163 * @fn int bluetooth_media_player_set_properties(media_player_settings_t *setting)
164 * @brief Notifies the remote bluetooth headset with change in music player settings
166 * This function is a asynchronous call.
167 * No event for this api..
169 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
170 * BT_MEDIA_CONTROL_ERROR - Error \n
173 * @param[in] setting - The music player properties
178 int bluetooth_media_player_set_properties(
179 media_player_settings_t *setting);
182 * @fn int bluetooth_media_player_change_property(media_player_property_type type,
183 * unsigned int value);
184 * @brief Notifies the remote bluetooth headset with change in music player settings
186 * This function is a asynchronous call.
187 * No event for this api..
189 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
190 * BT_MEDIA_CONTROL_ERROR - Error \n
193 * @param[in] type - Type of the music player property
194 * value - Value of the property which is changed
199 int bluetooth_media_player_change_property(
200 media_player_property_type type,
204 * @fn int bluetooth_media_player_change_track(media_metadata_attributes_t metadata)
205 * @briefNotifies the remote bluetooth headset with change in media attributes of the track
207 * This function is a asynchronous call.
208 * No event for this api..
210 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
211 * BT_MEDIA_CONTROL_ERROR - Error \n
214 * @param[in] metadata -Meida attributes
219 int bluetooth_media_player_change_track(
220 media_metadata_attributes_t *metadata);
223 * @fn int bluetooth_media_control_init(media_cb_func_ptr callback_ptr, void *user_data)
224 * @brief Initialize AVRCP control and register the callback
226 * This function is a synchronous call.
228 * @param[in] callback_ptr - Callback function (AVRCP connected / Disconnected)
229 * @param[in] user_data - User data
231 * @return BT_MEDIA_ERROR_NONE - Success \n
232 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
233 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
238 int bluetooth_media_control_init(media_cb_func_ptr callback_ptr,
242 * @fn int bluetooth_media_control_deinit(void)
243 * @brief Deinitialize AVRCP Control and deregister callback
245 * This function is a synchronous call.
247 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
248 * BT_MEDIA_CONTROL_ERROR - Error \n
253 int bluetooth_media_control_deinit(void);
256 * @brief The function bluetooth_media_control_connect is called to establish an AVRCP
257 * control role connection with the specified device.
259 * @param[in] remote_address Bluetooth device address.
260 * @return int Zero on Success or reason for error if any.
263 int bluetooth_media_control_connect(bluetooth_device_address_t *remote_address);
266 * @brief The function bluetooth_media_control_disconnect is called to disconnect an
267 * existing AVRCP Control role connection with the specified device.
269 * @param[in] remote_address Bluetooth device address.
270 * @return int Zero on Success or reason for error if any.
273 int bluetooth_media_control_disconnect(bluetooth_device_address_t *remote_address);
276 * @brief The function bluetooth_media_target_connect is called to establish an AVRCP
277 * target role connection with the specified device.
279 * @param[in] remote_address Bluetooth device address.
280 * @return int Zero on Success or reason for error if any.
283 int bluetooth_media_target_connect(bluetooth_device_address_t *remote_address);
286 * @brief The function bluetooth_media_target_disconnect is called to disconnect an
287 * existing AVRCP target role connection with the specified device.
289 * @param[in] remote_address Bluetooth device address.
290 * @return int Zero on Success or reason for error if any.
293 int bluetooth_media_target_disconnect(bluetooth_device_address_t *remote_address);
296 * @brief The function bluetooth_media_control_command is called to send
297 * the AVRCP Control command like Play, Pause, FF, Rewind to the target device.
299 * @param[in] type media_player_control_cmd.
300 * @return int Zero on Success or reason for error if any.
303 int bluetooth_media_control_command(media_player_control_cmd type);
306 * @brief The function bluetooth_media_control_command_to_dest is called to send
307 * the AVRCP Control command like Play, Pause, FF, Rewind to the specific target device.
309 * @param[in] type media_player_control_cmd.
310 * @param[in] remote_address Bluetooth device address.
311 * @return int Zero on Success or reason for error if any.
314 int bluetooth_media_control_command_to_dest(media_player_control_cmd type,
315 bluetooth_device_address_t *remote_address);
318 * @fn int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value)
319 * @brief Notifies the remote bluetooth target with change in music control settings
321 * This function is a asynchronous call.
322 * No event for this api.
324 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
325 * BT_MEDIA_CONTROL_ERROR - Error \n
328 * @param[in] setting - The music control properties
333 int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value);
336 * @fn int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value)
337 * @brief reads the setting of the remote bluetooth target with change in music control settings
339 * This function is a asynchronous call.
340 * No event for this api.
342 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
343 * BT_MEDIA_CONTROL_ERROR - Error \n
346 * @param[in] setting - The music control properties
351 int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value);
354 * @fn int bluetooth_media_transport_set_property(media_transport_property_type type, unsigned int value)
355 * @brief Notifies the remote bluetooth target with change in audio transport settings
357 * This function is a asynchronous call.
358 * No event for this api.
360 * @return BT_MEDIA_TRANSPORT_SUCCESS - Success \n
361 * BT_MEDIA_TRANSPORT_ERROR - Error \n
364 * @param[in] setting - The audio transport properties
369 int bluetooth_media_transport_set_property(media_transport_property_type type, unsigned int value);
372 * @fn int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata)
373 * @brief reads the track metadata from the remote target player.
375 * This function is a asynchronous call.
376 * No event for this api.
378 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
379 * BT_MEDIA_CONTROL_ERROR - Error \n
382 * @param[in] metadata - The music meta data information.
387 int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata);
391 #endif /*__cplusplus*/
393 #endif /*_BT_MP_CONTROL_H_*/