Temp devicefound events are sent after DISCOVERY_STARTED
[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 } media_player_property_type;
42
43 typedef enum {
44         REPEAT_MODE_OFF = 0x01,
45         REPEAT_SINGLE_TRACK,
46         REPEAT_ALL_TRACK,
47         REPEAT_INVALID,
48 } media_player_repeat_status;
49
50 typedef enum {
51         STATUS_STOPPED = 0x00,
52         STATUS_PLAYING,
53         STATUS_PAUSED,
54         STATUS_INVALID
55 } media_player_status;
56
57 typedef enum {
58         SHUFFLE_MODE_OFF = 0x01,
59         SHUFFLE_ALL_TRACK,
60         SHUFFLE_GROUP,
61         SHUFFLE_INVALID,
62 } media_player_shuffle_status;
63
64 typedef struct {
65         const char *title;
66         const char **artist;
67         const char *album;
68         const char **genre;
69         unsigned int tracknumber;
70         unsigned int duration;
71 } media_metadata_attributes_t;
72
73 typedef struct {
74         media_player_repeat_status      loopstatus;
75         media_player_status     playbackstatus;
76         gboolean        shuffle;
77         gint64  position;
78         media_metadata_attributes_t     metadata;
79 } media_player_settings_t;
80
81 typedef struct {
82         int event;
83         int result;
84         void *param_data;
85         void *user_data;
86 } media_event_param_t;
87
88 typedef void (*media_cb_func_ptr)(int, media_event_param_t*, void*);
89
90
91 /**
92  * @fn int bluetooth_media_player_init(media_cb_func_ptr callback_ptr, void *user_data)
93  * @brief Initialize AVRCP service and register the callback
94  *
95  * This function is a synchronous call.
96  *
97  * @param[in]   callback_ptr - Callback function (A2DP connected / Disconnected)
98  * @param[in]   user_data - User data
99  *
100  * @return  BT_MEDIA_ERROR_NONE  - Success \n
101  *              BT_MEDIA_ERROR_ALREADY_INITIALIZED   - Already initialized \n
102  *              BT_MEDIA_ERROR_INTERNAL  - Internal error \n
103  *
104  * @remark      None
105  *
106  */
107 int bluetooth_media_player_init(media_cb_func_ptr callback_ptr,
108                                         void *user_data);
109
110 /**
111  * @fn int bluetooth_media_player_deinit(void)
112  * @brief Deinitialize AVRCP service and register the callback
113  *
114  * This function is a synchronous call.
115  *
116  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
117  *              BT_MEDIA_CONTROL_ERROR - Error \n
118  *
119  * @remark      None
120  *
121  */
122 int bluetooth_media_player_deinit(void);
123
124 /**
125  * @fn int bluetooth_media_player_set_properties(media_player_settings_t *setting)
126  * @brief Notifies the remote bluetooth headset with change in music player settings
127  *
128  * This function is a asynchronous call.
129  * No event for this api..
130  *
131  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
132  *              BT_MEDIA_CONTROL_ERROR - Error \n
133  *
134  * @exception   None
135  * @param[in]   setting - The music player properties
136  *
137  * @remark       None
138  * @see          None
139  */
140 int bluetooth_media_player_set_properties(
141                         media_player_settings_t *setting);
142
143 /**
144  * @fn int bluetooth_media_player_change_property(media_player_property_type type,
145  *                              unsigned int value);
146  * @brief Notifies the remote bluetooth headset with change in music player settings
147  *
148  * This function is a asynchronous call.
149  * No event for this api..
150  *
151  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
152  *              BT_MEDIA_CONTROL_ERROR - Error \n
153  *
154  * @exception   None
155  * @param[in]   type - Type of the music player property
156  *                       value - Value of the property which is changed
157  *
158  * @remark       None
159  * @see          None
160  */
161 int bluetooth_media_player_change_property(
162                         media_player_property_type type,
163                         unsigned int value);
164
165 /**
166  * @fn int bluetooth_media_player_change_track(media_metadata_attributes_t metadata)
167  * @briefNotifies the remote bluetooth headset with change in media attributes of the track
168  *
169  * This function is a asynchronous call.
170  * No event for this api..
171  *
172  * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
173  *              BT_MEDIA_CONTROL_ERROR - Error \n
174  *
175  * @exception   None
176  * @param[in]     metadata -Meida attributes
177  *
178  * @remark       None
179  * @see          None
180  */
181 int bluetooth_media_player_change_track(
182                         media_metadata_attributes_t *metadata);
183
184 #ifdef __cplusplus
185 }
186 #endif /*__cplusplus*/
187
188 #endif /*_BT_MP_CONTROL_H_*/