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;
88 } media_player_control_cmd;
95 unsigned int total_tracks;
98 } media_metadata_attributes_t;
101 media_player_equalizer_status equalizer;
102 media_player_repeat_status repeat;
103 media_player_shuffle_status shuffle;
104 media_player_scan_status scan;
105 media_player_status status;
106 unsigned int position;
107 media_metadata_attributes_t metadata;
108 } media_player_settings_t;
115 } media_event_param_t;
117 typedef void (*media_cb_func_ptr)(int, media_event_param_t*, void*);
121 * @fn int bluetooth_media_player_init(media_cb_func_ptr callback_ptr, void *user_data)
122 * @brief Initialize AVRCP service and register the callback
124 * This function is a synchronous call.
126 * @param[in] callback_ptr - Callback function (A2DP connected / Disconnected)
127 * @param[in] user_data - User data
129 * @return BT_MEDIA_ERROR_NONE - Success \n
130 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
131 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
136 int bluetooth_media_player_init(media_cb_func_ptr callback_ptr,
140 * @fn int bluetooth_media_player_deinit(void)
141 * @brief Deinitialize AVRCP service and register the callback
143 * This function is a synchronous call.
145 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
146 * BT_MEDIA_CONTROL_ERROR - Error \n
151 int bluetooth_media_player_deinit(void);
154 * @fn int bluetooth_media_player_set_properties(media_player_settings_t *setting)
155 * @brief Notifies the remote bluetooth headset with change in music player settings
157 * This function is a asynchronous call.
158 * No event for this api..
160 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
161 * BT_MEDIA_CONTROL_ERROR - Error \n
164 * @param[in] setting - The music player properties
169 int bluetooth_media_player_set_properties(
170 media_player_settings_t *setting);
173 * @fn int bluetooth_media_player_change_property(media_player_property_type type,
174 * unsigned int value);
175 * @brief Notifies the remote bluetooth headset with change in music player settings
177 * This function is a asynchronous call.
178 * No event for this api..
180 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
181 * BT_MEDIA_CONTROL_ERROR - Error \n
184 * @param[in] type - Type of the music player property
185 * value - Value of the property which is changed
190 int bluetooth_media_player_change_property(
191 media_player_property_type type,
195 * @fn int bluetooth_media_player_change_track(media_metadata_attributes_t metadata)
196 * @briefNotifies the remote bluetooth headset with change in media attributes of the track
198 * This function is a asynchronous call.
199 * No event for this api..
201 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
202 * BT_MEDIA_CONTROL_ERROR - Error \n
205 * @param[in] metadata -Meida attributes
210 int bluetooth_media_player_change_track(
211 media_metadata_attributes_t *metadata);
214 * @fn int bluetooth_media_control_init(media_cb_func_ptr callback_ptr, void *user_data)
215 * @brief Initialize AVRCP control and register the callback
217 * This function is a synchronous call.
219 * @param[in] callback_ptr - Callback function (AVRCP connected / Disconnected)
220 * @param[in] user_data - User data
222 * @return BT_MEDIA_ERROR_NONE - Success \n
223 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
224 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
229 int bluetooth_media_control_init(media_cb_func_ptr callback_ptr,
233 * @fn int bluetooth_media_control_deinit(void)
234 * @brief Deinitialize AVRCP Control and deregister callback
236 * This function is a synchronous call.
238 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
239 * BT_MEDIA_CONTROL_ERROR - Error \n
244 int bluetooth_media_control_deinit(void);
247 * @brief The function bluetooth_media_control_connect is called to establish an AVRCP
248 * control role connection with the specified device.
250 * @param[in] remote_address Bluetooth device address.
251 * @return int Zero on Success or reason for error if any.
254 int bluetooth_media_control_connect(bluetooth_device_address_t *remote_address);
257 * @brief The function bluetooth_media_control_disconnect is called to disconnect an
258 * existing AVRCP Control role connection with the specified device.
260 * @param[in] remote_address Bluetooth device address.
261 * @return int Zero on Success or reason for error if any.
264 int bluetooth_media_control_disconnect(bluetooth_device_address_t *remote_address);
267 * @brief The function bluetooth_media_control_command is called to send
268 * the AVRCP Control command like Play, Pause, FF, Rewind to the target device.
270 * @param[in] type media_player_control_cmd.
271 * @return int Zero on Success or reason for error if any.
274 int bluetooth_media_control_command(media_player_control_cmd type);
277 * @fn int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value)
278 * @brief Notifies the remote bluetooth target with change in music control settings
280 * This function is a asynchronous call.
281 * No event for this api.
283 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
284 * BT_MEDIA_CONTROL_ERROR - Error \n
287 * @param[in] setting - The music control properties
292 int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value);
295 * @fn int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value)
296 * @brief reads the setting of the remote bluetooth target with change in music control settings
298 * This function is a asynchronous call.
299 * No event for this api.
301 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
302 * BT_MEDIA_CONTROL_ERROR - Error \n
305 * @param[in] setting - The music control properties
310 int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value);
313 * @fn int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata)
314 * @brief reads the track metadata from the remote target player.
316 * This function is a asynchronous call.
317 * No event for this api.
319 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
320 * BT_MEDIA_CONTROL_ERROR - Error \n
323 * @param[in] metadata - The music meta data information.
328 int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata);
332 #endif /*__cplusplus*/
334 #endif /*_BT_MP_CONTROL_H_*/