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 SHUFFLE_MODE_OFF = 0x01,
68 } media_player_shuffle_status;
75 } media_player_scan_status;
78 STATUS_STOPPED = 0x00,
85 } media_player_status;
95 } media_player_control_cmd;
102 unsigned int total_tracks;
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_control_command is called to send
275 * the AVRCP Control command like Play, Pause, FF, Rewind to the target device.
277 * @param[in] type media_player_control_cmd.
278 * @return int Zero on Success or reason for error if any.
281 int bluetooth_media_control_command(media_player_control_cmd type);
284 * @fn int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value)
285 * @brief Notifies the remote bluetooth target with change in music control settings
287 * This function is a asynchronous call.
288 * No event for this api.
290 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
291 * BT_MEDIA_CONTROL_ERROR - Error \n
294 * @param[in] setting - The music control properties
299 int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value);
302 * @fn int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value)
303 * @brief reads the setting of the remote bluetooth target with change in music control settings
305 * This function is a asynchronous call.
306 * No event for this api.
308 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
309 * BT_MEDIA_CONTROL_ERROR - Error \n
312 * @param[in] setting - The music control properties
317 int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value);
320 * @fn int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata)
321 * @brief reads the track metadata from the remote target player.
323 * This function is a asynchronous call.
324 * No event for this api.
326 * @return BT_MEDIA_CONTROL_SUCCESS - Success \n
327 * BT_MEDIA_CONTROL_ERROR - Error \n
330 * @param[in] metadata - The music meta data information.
335 int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata);
339 #endif /*__cplusplus*/
341 #endif /*_BT_MP_CONTROL_H_*/