2 * bluetooth-media-control
4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 * Girishashok Joshi <girish.joshi@samsung.com>
8 * Chanyeol Park <chanyeol.park@samsung.com>
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
25 #ifndef _BT_MP_CONTROL_H_
26 #define _BT_MP_CONTROL_H_
30 #endif /*__cplusplus*/
32 #define BT_MEDIA_ERROR_NONE ((int)0)
34 #define BT_MEDIA_ERROR_BASE ((int)0)
35 #define BT_MEDIA_ERROR_INTERNAL ((int)BT_MEDIA_ERROR_BASE - 0x01)
36 #define BT_MEDIA_ERROR_ALREADY_INITIALIZED ((int)BT_MEDIA_ERROR_BASE - 0x02)
37 #define BT_MEDIA_ERROR_NOT_CONNECTED ((int)BT_MEDIA_ERROR_BASE - 0x15)
47 } media_player_property_type;
53 } media_player_equalizer_status;
56 REPEAT_MODE_OFF = 0x01,
61 } media_player_repeat_status;
64 STATUS_STOPPED = 0x00,
71 } media_player_status;
74 SHUFFLE_MODE_OFF = 0x01,
78 } media_player_shuffle_status;
86 } media_player_scan_status;
96 } media_player_control_cmd;
103 unsigned int total_tracks;
106 } media_metadata_attributes_t;
109 media_player_equalizer_status equalizer;
110 media_player_repeat_status repeat;
111 media_player_shuffle_status shuffle;
112 media_player_scan_status scan;
113 media_player_status status;
114 unsigned int position;
115 media_metadata_attributes_t metadata;
116 } media_player_settings_t;
123 } media_event_param_t;
125 typedef void (*media_cb_func_ptr)(int, media_event_param_t*, void*);
129 * @fn int bluetooth_media_player_init(media_cb_func_ptr callback_ptr, void *user_data)
130 * @brief Initialize AVRCP service and register the callback
132 * This function is a synchronous call.
134 * @param[in] callback_ptr - Callback function (A2DP connected / Disconnected)
135 * @param[in] user_data - User data
137 * @return BT_MEDIA_ERROR_NONE - Success \n
138 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
139 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
144 int bluetooth_media_player_init(media_cb_func_ptr callback_ptr,
148 * @fn int bluetooth_media_player_deinit(void)
149 * @brief Deinitialize AVRCP service and register the callback
151 * This function is a synchronous call.
153 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
154 * BT_MEDIA_CONTROL_ERROR - Error \n
159 int bluetooth_media_player_deinit(void);
162 * @fn int bluetooth_media_player_set_properties(media_player_settings_t *setting)
163 * @brief Notifies the remote bluetooth headset with change in music player settings
165 * This function is a asynchronous call.
166 * No event for this api..
168 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
169 * BT_MEDIA_CONTROL_ERROR - Error \n
172 * @param[in] setting - The music player properties
177 int bluetooth_media_player_set_properties(
178 media_player_settings_t *setting);
181 * @fn int bluetooth_media_player_change_property(media_player_property_type type,
182 * unsigned int value);
183 * @brief Notifies the remote bluetooth headset with change in music player settings
185 * This function is a asynchronous call.
186 * No event for this api..
188 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
189 * BT_MEDIA_CONTROL_ERROR - Error \n
192 * @param[in] type - Type of the music player property
193 * value - Value of the property which is changed
198 int bluetooth_media_player_change_property(
199 media_player_property_type type,
203 * @fn int bluetooth_media_player_change_track(media_metadata_attributes_t metadata)
204 * @briefNotifies the remote bluetooth headset with change in media attributes of the track
206 * This function is a asynchronous call.
207 * No event for this api..
209 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
210 * BT_MEDIA_CONTROL_ERROR - Error \n
213 * @param[in] metadata -Meida attributes
218 int bluetooth_media_player_change_track(
219 media_metadata_attributes_t *metadata);
222 * @fn int bluetooth_media_control_init(media_cb_func_ptr callback_ptr, void *user_data)
223 * @brief Initialize AVRCP control and register the callback
225 * This function is a synchronous call.
227 * @param[in] callback_ptr - Callback function (AVRCP connected / Disconnected)
228 * @param[in] user_data - User data
230 * @return BT_MEDIA_ERROR_NONE - Success \n
231 * BT_MEDIA_ERROR_ALREADY_INITIALIZED - Already initialized \n
232 * BT_MEDIA_ERROR_INTERNAL - Internal error \n
237 int bluetooth_media_control_init(media_cb_func_ptr callback_ptr,
241 * @fn int bluetooth_media_control_deinit(void)
242 * @brief Deinitialize AVRCP Control and deregister callback
244 * This function is a synchronous call.
246 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
247 * BT_MEDIA_CONTROL_ERROR - Error \n
252 int bluetooth_media_control_deinit(void);
255 * @brief The function bluetooth_media_control_connect is called to establish an AVRCP
256 * control role connection with the specified device.
258 * @param[in] remote_address Bluetooth device address.
259 * @return int Zero on Success or reason for error if any.
262 int bluetooth_media_control_connect(bluetooth_device_address_t *remote_address);
265 * @brief The function bluetooth_media_control_disconnect is called to disconnect an
266 * existing AVRCP Control role connection with the specified device.
268 * @param[in] remote_address Bluetooth device address.
269 * @return int Zero on Success or reason for error if any.
272 int bluetooth_media_control_disconnect(bluetooth_device_address_t *remote_address);
275 * @brief The function bluetooth_media_control_command is called to send
276 * the AVRCP Control command like Play, Pause, FF, Rewind to the target device.
278 * @param[in] type media_player_control_cmd.
279 * @return int Zero on Success or reason for error if any.
282 int bluetooth_media_control_command(media_player_control_cmd type);
285 * @fn int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value)
286 * @brief Notifies the remote bluetooth target with change in music control settings
288 * This function is a asynchronous call.
289 * No event for this api.
291 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
292 * BT_MEDIA_CONTROL_ERROR - Error \n
295 * @param[in] setting - The music control properties
300 int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value);
303 * @fn int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value)
304 * @brief reads the setting of the remote bluetooth target with change in music control settings
306 * This function is a asynchronous call.
307 * No event for this api.
309 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
310 * BT_MEDIA_CONTROL_ERROR - Error \n
313 * @param[in] setting - The music control properties
318 int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value);
321 * @fn int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata)
322 * @brief reads the track metadata from the remote target player.
324 * This function is a asynchronous call.
325 * No event for this api.
327 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
328 * BT_MEDIA_CONTROL_ERROR - Error \n
331 * @param[in] metadata - The music meta data information.
336 int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata);
340 #endif /*__cplusplus*/
342 #endif /*_BT_MP_CONTROL_H_*/