906be7c3603177fea094fcf66ffeb3503e3acf5b
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-media-control.h
1 /*
2  * bluetooth-frwk
3  *
4  *Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *              http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef _BT_MP_CONTROL_H_
21 #define _BT_MP_CONTROL_H_
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /*__cplusplus*/
26
27 #include <glib.h>
28
29 #define BT_MEDIA_ERROR_NONE ((int)0)
30
31 #define BT_MEDIA_ERROR_BASE ((int)0)
32 #define BT_MEDIA_ERROR_INTERNAL ((int)BT_MEDIA_ERROR_BASE - 0x01)
33 #define BT_MEDIA_ERROR_ALREADY_INITIALIZED ((int)BT_MEDIA_ERROR_BASE - 0x02)
34
35 typedef enum {
36         PLAYBACKSTATUS = 0x1,
37         SHUFFLE,
38         LOOPSTATUS,
39         POSITION,
40         METADATA,
41         EQUALIZER = 0x02,       /* bluez 4.101 */
42         REPEAT,                 /* bluez 4.101 */
43         SCAN,                   /* bluez 4.101 */
44         STATUS,                 /* bluez 4.101 */
45 } media_player_property_type;
46
47 /* bluez 4.101 */
48 typedef enum {
49         EQUALIZER_OFF = 0x01,
50         EQUALIZER_ON,
51         EQUALIZER_INVALID,
52 } media_player_equalizer_status;
53
54 typedef enum {
55         REPEAT_MODE_OFF = 0x01,
56         REPEAT_SINGLE_TRACK,
57         REPEAT_ALL_TRACK,
58         REPEAT_GROUP,           /* bluez 4.101 */
59         REPEAT_INVALID,
60 } media_player_repeat_status;
61
62 typedef enum {
63         STATUS_STOPPED = 0x00,
64         STATUS_PLAYING,
65         STATUS_PAUSED,
66         STATUS_FORWARD_SEEK,    /* bluez 4.101 */
67         STATUS_REVERSE_SEEK,    /* bluez 4.101 */
68         STATUS_ERROR,           /* bluez 4.101 */
69         STATUS_INVALID
70 } media_player_status;
71
72 typedef enum {
73         SHUFFLE_MODE_OFF = 0x01,
74         SHUFFLE_ALL_TRACK,
75         SHUFFLE_GROUP,
76         SHUFFLE_INVALID,
77 } media_player_shuffle_status;
78
79 /* bluez 4.101 */
80 typedef enum {
81         SCAN_MODE_OFF = 0x01,
82         SCAN_ALL_TRACK,
83         SCAN_GROUP,
84         SCAN_INVALID,
85 } media_player_scan_status;
86
87 typedef struct {
88         const char *title;
89         const char **artists;
90         const char *album;
91         const char **genres;
92         unsigned int tracknumber;
93         const char *artist;             /* bluez 4.101 */
94         const char *genre;              /* bluez 4.101 */
95         unsigned int total_tracks;      /* bluez 4.101 */
96         unsigned int number;            /* bluez 4.101 */
97         unsigned int duration;
98 } media_metadata_attributes_t;
99
100 typedef struct {
101         media_player_repeat_status      loopstatus;
102         media_player_status     playbackstatus;
103         gboolean        shuffle_mode;
104         gint64  position;
105         media_metadata_attributes_t     metadata;
106         media_player_equalizer_status equalizer;        /* bluez 4.101 */
107         media_player_repeat_status  repeat;             /* bluez 4.101 */
108         media_player_shuffle_status  shuffle;           /* bluez 4.101 */
109         media_player_scan_status scan;                  /* bluez 4.101 */
110         media_player_status status;                     /* bluez 4.101 */
111 } media_player_settings_t;
112
113 typedef struct {
114         int event;
115         int result;
116         void *param_data;
117         void *user_data;
118 } media_event_param_t;
119
120 typedef void (*media_cb_func_ptr)(int, media_event_param_t*, void*);
121
122
123 /**
124  * @fn int bluetooth_media_player_init(media_cb_func_ptr callback_ptr, void *user_data)
125  * @brief Initialize AVRCP service and register the callback
126  *
127  * This function is a synchronous call.
128  *
129  * @param[in]   callback_ptr - Callback function (A2DP connected / Disconnected)
130  * @param[in]   user_data - User data
131  *
132  * @return  BT_MEDIA_ERROR_NONE  - Success \n
133  *              BT_MEDIA_ERROR_ALREADY_INITIALIZED   - Already initialized \n
134  *              BT_MEDIA_ERROR_INTERNAL  - Internal error \n
135  *
136  * @remark      None
137  *
138  */
139 int bluetooth_media_player_init(media_cb_func_ptr callback_ptr,
140                                         void *user_data);
141
142 /**
143  * @fn int bluetooth_media_player_deinit(void)
144  * @brief Deinitialize AVRCP service and register the callback
145  *
146  * This function is a synchronous call.
147  *
148  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
149  *              BT_MEDIA_CONTROL_ERROR - Error \n
150  *
151  * @remark      None
152  *
153  */
154 int bluetooth_media_player_deinit(void);
155
156 /**
157  * @fn int bluetooth_media_player_set_properties(media_player_settings_t *setting)
158  * @brief Notifies the remote bluetooth headset with change in music player settings
159  *
160  * This function is a asynchronous call.
161  * No event for this api..
162  *
163  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
164  *              BT_MEDIA_CONTROL_ERROR - Error \n
165  *
166  * @exception   None
167  * @param[in]   setting - The music player properties
168  *
169  * @remark       None
170  * @see          None
171  */
172 int bluetooth_media_player_set_properties(
173                         media_player_settings_t *setting);
174
175 /**
176  * @fn int bluetooth_media_player_change_property(media_player_property_type type,
177  *                              unsigned int value);
178  * @brief Notifies the remote bluetooth headset with change in music player settings
179  *
180  * This function is a asynchronous call.
181  * No event for this api..
182  *
183  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
184  *              BT_MEDIA_CONTROL_ERROR - Error \n
185  *
186  * @exception   None
187  * @param[in]   type - Type of the music player property
188  *                       value - Value of the property which is changed
189  *
190  * @remark       None
191  * @see          None
192  */
193 int bluetooth_media_player_change_property(
194                         media_player_property_type type,
195                         unsigned int value);
196
197 /**
198  * @fn int bluetooth_media_player_change_track(media_metadata_attributes_t metadata)
199  * @briefNotifies the remote bluetooth headset with change in media attributes of the track
200  *
201  * This function is a asynchronous call.
202  * No event for this api..
203  *
204  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
205  *              BT_MEDIA_CONTROL_ERROR - Error \n
206  *
207  * @exception   None
208  * @param[in]     metadata -Meida attributes
209  *
210  * @remark       None
211  * @see          None
212  */
213 int bluetooth_media_player_change_track(
214                         media_metadata_attributes_t *metadata);
215
216 #ifdef __cplusplus
217 }
218 #endif /*__cplusplus*/
219
220 #endif /*_BT_MP_CONTROL_H_*/