Modify build feature names as Tizen 3.0 build option naming rule
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-media-control.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #ifndef _BT_MP_CONTROL_H_
19 #define _BT_MP_CONTROL_H_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /*__cplusplus*/
24
25 #define BT_MEDIA_ERROR_NONE ((int)0)
26
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)
31
32 typedef enum {
33         EQUALIZER = 0x01,
34         REPEAT,
35         SHUFFLE,
36         SCAN,
37         POSITION,
38         METADATA,
39         STATUS
40 } media_player_property_type;
41
42 typedef enum {
43         EQUALIZER_OFF = 0x01,
44         EQUALIZER_ON,
45         EQUALIZER_INVALID,
46 } media_player_equalizer_status;
47
48 typedef enum {
49         REPEAT_MODE_OFF = 0x01,
50         REPEAT_SINGLE_TRACK,
51         REPEAT_ALL_TRACK,
52         REPEAT_GROUP,
53         REPEAT_INVALID,
54 } media_player_repeat_status;
55
56 typedef enum {
57         SHUFFLE_MODE_OFF = 0x01,
58         SHUFFLE_ALL_TRACK,
59         SHUFFLE_GROUP,
60         SHUFFLE_INVALID,
61 } media_player_shuffle_status;
62
63 typedef enum {
64         SCAN_MODE_OFF = 0x01,
65         SCAN_ALL_TRACK,
66         SCAN_GROUP,
67         SCAN_INVALID,
68 } media_player_scan_status;
69
70 typedef enum {
71         STATUS_STOPPED = 0x00,
72         STATUS_PLAYING,
73         STATUS_PAUSED,
74         STATUS_FORWARD_SEEK,
75         STATUS_REVERSE_SEEK,
76         STATUS_ERROR,
77         STATUS_INVALID
78 } media_player_status;
79
80 typedef enum {
81         PLAY = 0x01,
82         PAUSE,
83         STOP,
84         NEXT,
85         PREVIOUS,
86         PRESS_FAST_FORWARD,
87         RELEASE_FAST_FORWARD,
88         PRESS_REWIND,
89         RELEASE_REWIND
90 } media_player_control_cmd;
91
92 typedef struct {
93         const char *title;
94         const char *artist;
95         const char *album;
96         const char *genre;
97         unsigned int total_tracks;
98         unsigned int number;
99         int64_t duration;
100 } media_metadata_attributes_t;
101
102 typedef struct {
103         media_player_equalizer_status equalizer;
104         media_player_repeat_status  repeat;
105         media_player_shuffle_status  shuffle;
106         media_player_scan_status scan;
107         media_player_status status;
108         unsigned int position;
109         media_metadata_attributes_t metadata;
110 } media_player_settings_t;
111
112 typedef struct {
113         int event;
114         int result;
115         void *param_data;
116         void *user_data;
117 } media_event_param_t;
118
119 typedef void (*media_cb_func_ptr)(int, media_event_param_t*, void*);
120
121
122 /**
123  * @fn int bluetooth_media_player_init(media_cb_func_ptr callback_ptr, void *user_data)
124  * @brief Initialize AVRCP service and register the callback
125  *
126  * This function is a synchronous call.
127  *
128  * @param[in]   callback_ptr - Callback function (A2DP connected / Disconnected)
129  * @param[in]   user_data - User data
130  *
131  * @return  BT_MEDIA_ERROR_NONE  - Success \n
132  *              BT_MEDIA_ERROR_ALREADY_INITIALIZED   - Already initialized \n
133  *              BT_MEDIA_ERROR_INTERNAL  - Internal error \n
134  *
135  * @remark      None
136  *
137  */
138 int bluetooth_media_player_init(media_cb_func_ptr callback_ptr,
139                                         void *user_data);
140
141 /**
142  * @fn int bluetooth_media_player_deinit(void)
143  * @brief Deinitialize AVRCP service and register the callback
144  *
145  * This function is a synchronous call.
146  *
147  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
148  *              BT_MEDIA_CONTROL_ERROR - Error \n
149  *
150  * @remark      None
151  *
152  */
153 int bluetooth_media_player_deinit(void);
154
155 /**
156  * @fn int bluetooth_media_player_set_properties(media_player_settings_t *setting)
157  * @brief Notifies the remote bluetooth headset with change in music player settings
158  *
159  * This function is a asynchronous call.
160  * No event for this api..
161  *
162  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
163  *              BT_MEDIA_CONTROL_ERROR - Error \n
164  *
165  * @exception   None
166  * @param[in]   setting - The music player properties
167  *
168  * @remark       None
169  * @see None
170  */
171 int bluetooth_media_player_set_properties(
172                         media_player_settings_t *setting);
173
174 /**
175  * @fn int bluetooth_media_player_change_property(media_player_property_type type,
176  *                              unsigned int value);
177  * @brief Notifies the remote bluetooth headset with change in music player settings
178  *
179  * This function is a asynchronous call.
180  * No event for this api..
181  *
182  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
183  *              BT_MEDIA_CONTROL_ERROR - Error \n
184  *
185  * @exception   None
186  * @param[in]   type - Type of the music player property
187  *                       value - Value of the property which is changed
188  *
189  * @remark       None
190  * @see None
191  */
192 int bluetooth_media_player_change_property(
193                         media_player_property_type type,
194                         unsigned int value);
195
196 /**
197  * @fn int bluetooth_media_player_change_track(media_metadata_attributes_t metadata)
198  * @briefNotifies the remote bluetooth headset with change in media attributes of the track
199  *
200  * This function is a asynchronous call.
201  * No event for this api..
202  *
203  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
204  *              BT_MEDIA_CONTROL_ERROR - Error \n
205  *
206  * @exception   None
207  * @param[in]   metadata -Meida attributes
208  *
209  * @remark       None
210  * @see None
211  */
212 int bluetooth_media_player_change_track(
213                         media_metadata_attributes_t *metadata);
214
215 /**
216  * @fn int bluetooth_media_control_init(media_cb_func_ptr callback_ptr, void *user_data)
217  * @brief Initialize AVRCP control and register the callback
218  *
219  * This function is a synchronous call.
220  *
221  * @param[in]   callback_ptr - Callback function (AVRCP connected / Disconnected)
222  * @param[in]   user_data - User data
223  *
224  * @return  BT_MEDIA_ERROR_NONE  - Success \n
225  *              BT_MEDIA_ERROR_ALREADY_INITIALIZED   - Already initialized \n
226  *              BT_MEDIA_ERROR_INTERNAL  - Internal error \n
227  *
228  * @remark      None
229  *
230  */
231 int bluetooth_media_control_init(media_cb_func_ptr callback_ptr,
232                                                 void *user_data);
233
234 /**
235  * @fn int bluetooth_media_control_deinit(void)
236  * @brief Deinitialize AVRCP Control and deregister callback
237  *
238  * This function is a synchronous call.
239  *
240  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
241  *              BT_MEDIA_CONTROL_ERROR - Error \n
242  *
243  * @remark      None
244  *
245  */
246 int bluetooth_media_control_deinit(void);
247
248 /**
249  * @brief       The function bluetooth_media_control_connect is called to establish an AVRCP
250  *      control role connection with  the specified device.
251  *
252  * @param[in]   remote_address  Bluetooth device address.
253  * @return      int     Zero on Success or reason for error if any.
254  *
255  */
256 int bluetooth_media_control_connect(bluetooth_device_address_t *remote_address);
257
258 /**
259  * @brief       The function bluetooth_media_control_disconnect is called to disconnect an
260  *      existing AVRCP Control role connection with the specified device.
261  *
262  * @param[in]   remote_address  Bluetooth device address.
263  * @return      int     Zero on Success or reason for error if any.
264  *
265  */
266 int bluetooth_media_control_disconnect(bluetooth_device_address_t *remote_address);
267
268 /**
269  * @brief       The function bluetooth_media_target_connect is called to establish an AVRCP
270  *      target role connection with  the specified device.
271  *
272  * @param[in]   remote_address  Bluetooth device address.
273  * @return      int     Zero on Success or reason for error if any.
274  *
275  */
276 int bluetooth_media_target_connect(bluetooth_device_address_t *remote_address);
277
278 /**
279  * @brief       The function bluetooth_media_target_disconnect is called to disconnect an
280  *      existing AVRCP target role connection with the specified device.
281  *
282  * @param[in]   remote_address  Bluetooth device address.
283  * @return      int     Zero on Success or reason for error if any.
284  *
285  */
286 int bluetooth_media_target_disconnect(bluetooth_device_address_t *remote_address);
287
288 /**
289  * @brief       The function bluetooth_media_control_command is called to send
290  *      the  AVRCP Control command like Play, Pause, FF, Rewind to the target device.
291  *
292  * @param[in]   type    media_player_control_cmd.
293  * @return      int     Zero on Success or reason for error if any.
294  *
295  */
296 int bluetooth_media_control_command(media_player_control_cmd type);
297
298 /**
299  * @fn int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value)
300  * @brief Notifies the remote bluetooth target with change in music control settings
301  *
302  * This function is a asynchronous call.
303  * No event for this api.
304  *
305  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
306  *              BT_MEDIA_CONTROL_ERROR - Error \n
307  *
308  * @exception   None
309  * @param[in]   setting - The music control properties
310  *
311  * @remark       None
312  * @see None
313  */
314 int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value);
315
316 /**
317  * @fn int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value)
318  * @brief reads the setting of the remote bluetooth target with change in music control settings
319  *
320  * This function is a asynchronous call.
321  * No event for this api.
322  *
323  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
324  *              BT_MEDIA_CONTROL_ERROR - Error \n
325  *
326  * @exception   None
327  * @param[in]   setting - The music control properties
328  *
329  * @remark       None
330  * @see None
331  */
332 int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value);
333
334 /**
335  * @fn int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata)
336  * @brief reads the track metadata from the remote target player.
337  *
338  * This function is a asynchronous call.
339  * No event for this api.
340  *
341  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
342  *              BT_MEDIA_CONTROL_ERROR - Error \n
343  *
344  * @exception   None
345  * @param[in]   metadata - The music meta data information.
346  *
347  * @remark       None
348  * @see None
349  */
350 int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata);
351
352 #ifdef __cplusplus
353 }
354 #endif /*__cplusplus*/
355
356 #endif /*_BT_MP_CONTROL_H_*/