Merge "Add default deny policy in conf files" into tizen
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / include / oal-avrcp-ct.h
1 /*
2  * Open Adaptation Layer (OAL)
3  *
4  * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
5  *
6  * Contact: Nilesh Trimbake <t.shripati@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *              http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef _OAL_AVRCP_CT_H_
23 #define _OAL_AVRCP_CT_H_
24
25 #include <glib.h>
26 #include <sys/types.h>
27 #include <oal-manager.h>
28 #include "oal-event.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 typedef enum {
35         OAL_RC_PASS_CMD_PLAY = 0x01,
36         OAL_RC_PASS_CMD_PAUSE,
37         OAL_RC_PASS_CMD_STOP,
38         OAL_RC_PASS_CMD_NEXT,
39         OAL_RC_PASS_CMD_PREVIOUS,
40         OAL_RC_PASS_CMD_PRESS_FAST_FORWARD,
41         OAL_RC_PASS_CMD_RELEASE_FAST_FORWARD,
42         OAL_RC_PASS_CMD_PRESS_REWIND,
43         OAL_RC_PASS_CMD_RELEASE_REWIND
44 } avrcp_ct_pass_cmd_key_code_t;
45
46 /**
47  * @brief Current State of remote key(pressed/released)
48  *
49  * @see  avrcp_ct_fforward
50  * @see  avrcp_ct_rewind
51  */
52 typedef enum {
53         PRESS_STATE = 0x00,
54         RELEASE_STATE = 0x01
55 } avrcp_ct_pass_state_t;
56
57 typedef struct {
58         avrcp_ct_pass_cmd_key_code_t key_code;
59         avrcp_ct_pass_state_t key_state;
60 } avrcp_ct_pass_cmd_t;
61
62 typedef struct {
63         uint8_t accepted;
64 } avrcp_ct_playersetting_t;
65
66 typedef enum {
67         OAL_EQUALIZER = 0x01,
68         OAL_REPEAT,
69         OAL_SHUFFLE,
70         OAL_SCAN,
71         OAL_PLAY_STATUS,
72         OAL_PLAY_POSITION,
73 } avrcp_ct_player_property_type_t;
74
75 typedef struct {
76         avrcp_ct_player_property_type_t type;
77         unsigned int value;
78 } avrcp_ct_property_value_t;
79
80 typedef struct {
81         uint32_t song_len;
82         uint32_t song_pos;
83 } avrcp_ct_play_position_t;
84
85 /**
86  * @brief Enable AVRCP Controller Feature
87  *
88  * @remarks  Devices supporting AVRCP Target will be able to connect.
89  * @remarks  Used in conjunction with a2dp_sink_enable.
90  *
91  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
92  * @retval #OAL_STATUS_SUCCESS  Successful
93  *
94  * @pre OAL API must be initialized with oal_bt_init().
95  *
96  * @see  avrcp_ct_disable
97  * @see  a2dp_sink_enable
98  */
99 oal_status_t avrcp_ct_enable(void);
100
101 /**
102  * @brief Disable AVRCP Controller Feature
103  *
104  * @remarks  Devices supporting AVRCP Target will not be able to connect.
105  * @remarks  Used in conjunction with a2dp_sink_disable.
106  *
107  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
108  * @retval #OAL_STATUS_SUCCESS  Successful
109  *
110  * @pre AVRCP Controller should be enabled with avrcp_ct_enable().
111  *
112  * @see  avrcp_ct_enable
113  * @see  a2dp_sink_disable
114  */
115 oal_status_t avrcp_ct_disable(void);
116
117 /**
118  * @brief Initiate a connection with a BT Sound device
119  *
120  * @details  Result will be notified through an OAL event
121  *
122  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
123  * @retval #OAL_STATUS_SUCCESS  Successful
124  *
125  * @pre BT Audio should be enabled with avrcp_ct_enable().
126  *
127  * @see  OAL_EVENT_AVRCP_CT_CONNECTED
128  */
129
130 oal_status_t avrcp_ct_connect(bt_address_t *device_address);
131
132
133 /**
134  * @brief Remove a connection with a BT Sound device
135  *
136  * @details  Result will be notified through an OAL event
137  *
138  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
139  * @retval #OAL_STATUS_SUCCESS  Successful
140  *
141  * @pre BT Audio should be connected with a BT Sound device.
142  *
143  * @see  OAL_EVENT_AVRCP_CT_DISCONNECTED
144  */
145
146 oal_status_t avrcp_ct_disconnect(bt_address_t *device_address);
147
148 /**
149  * @brief Play audio on the connected remote device.
150  *
151  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
152  * @retval #OAL_STATUS_SUCCESS  Successful
153  *
154  * @pre A2DP Sink should be connected with a device.
155  * @pre AVRCP connection should exist with the device.
156  */
157 oal_status_t avrcp_ct_play(bt_address_t *device_address);
158
159 /**
160  * @brief Stop audio on the connected remote device.
161  *
162  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
163  * @retval #OAL_STATUS_SUCCESS  Successful
164  *
165  * @pre A2DP Sink should be connected with a device.
166  * @pre AVRCP connection should exist with the device.
167  */
168 oal_status_t avrcp_ct_stop(bt_address_t *device_address);
169
170 /**
171  * @brief Pause audio on the connected remote device.
172  *
173  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
174  * @retval #OAL_STATUS_SUCCESS  Successful
175  *
176  * @pre A2DP Sink should be connected with a device.
177  * @pre AVRCP connection should exist with the device.
178  */
179 oal_status_t avrcp_ct_pause(bt_address_t *device_address);
180
181 /**
182  * @brief Fast Forward audio on the connected remote device.
183  *
184  * @remarks  PRESS_STATE   - Start Fast Forward
185  *           RELEASE_STATE - Stop Fast Forward
186  *
187  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
188  * @retval #OAL_STATUS_SUCCESS  Successful
189  *
190  * @pre A2DP Sink should be connected with a device.
191  * @pre AVRCP connection should exist with the device.
192  */
193 oal_status_t avrcp_ct_fforward(bt_address_t *device_address, avrcp_ct_pass_state_t press_state);
194
195 /**
196  * @brief Rewind audio on the connected remote device.
197  *
198  * @remarks  PRESS_STATE   - Start Rewind
199  *           RELEASE_STATE - Stop Rewind
200  *
201  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
202  * @retval #OAL_STATUS_SUCCESS  Successful
203  *
204  * @pre A2DP Sink should be connected with a device.
205  * @pre AVRCP connection should exist with the device.
206  */
207 oal_status_t avrcp_ct_rewind(bt_address_t *device_address, avrcp_ct_pass_state_t press_state);
208
209 /**
210  * @brief Play next track on the connected remote device.
211  *
212  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
213  * @retval #OAL_STATUS_SUCCESS  Successful
214  *
215  * @pre A2DP Sink should be connected with a device.
216  * @pre AVRCP connection should exist with the device.
217  */
218 oal_status_t avrcp_ct_next_track(bt_address_t *device_address);
219
220
221 /**
222  * @brief Play prev track on the connected remote device.
223  *
224  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
225  * @retval #OAL_STATUS_SUCCESS  Successful
226  *
227  * @pre A2DP Sink should be connected with a device.
228  * @pre AVRCP connection should exist with the device.
229  */
230 oal_status_t avrcp_ct_prev_track(bt_address_t *device_address);
231
232 /**
233  * @brief Set media player properties to target device
234  *
235  * @remarks Target device will receive media player properties.
236  *
237  * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
238  * @retval #OAL_STATUS_SUCCESS  Successful
239  *
240  * @pre OAL API must be initialize with avrcp_ct_enable().
241  *
242  */
243 oal_status_t avrcp_ct_set_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type, uint32_t value);
244
245 /**
246  * @brief Set media transport properties to target device
247  *
248  * @remarks Target device will receive media player properties.
249  *
250  * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
251  * @retval #OAL_STATUS_SUCCESS  Successful
252  *
253  * @pre OAL API must be initialize with avrcp_ct_enable().
254  *
255  */
256 oal_status_t avrcp_transport_set_property(bt_address_t *device_address, int type, unsigned int value);
257
258 /**
259  * @brief Get media player properties to target device
260  *
261  * @remarks Target device will send media player properties.
262  *
263  * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
264  * @retval #OAL_STATUS_SUCCESS  Successful
265  *
266  * @pre OAL API must be initialize with avrcp_ct_enable().
267  *
268  */
269 oal_status_t avrcp_ct_get_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type);
270
271 /**
272  * @brief Set media player properties to target device
273  *
274  * @remarks Target device will receive media player properties.
275  *
276  * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
277  * @retval #OAL_STATUS_SUCCESS  Successful
278  *
279  * @pre OAL API must be initialize with avrcp_ct_enable().
280  *
281  */
282 oal_status_t avrcp_ct_get_media_attribute(bt_address_t *device_address);
283
284 /**
285  * @brief Request current status of the media playing on connected Audio source.
286  *
287  * @details Result containing - Song Length, Song Position and current status(Stopped/Playing/Paused) will be notified through an OAL event
288  *
289  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
290  * @retval #OAL_STATUS_SUCCESS  Successful
291  *
292  * @pre A2DP Sink should be connected with a device.
293  * @pre AVRCP connection should exist with the device.
294  *
295  * @see  OAL_EVENT_AVRCP_CT_PLAY_STATUS
296  * @see  event_avrcp_ct_play_status_t
297  */
298 oal_status_t avrcp_ct_get_play_status(bt_address_t *device_address);
299
300 #ifdef __cplusplus
301 }
302 #endif /* __cplusplus */
303 #endif /*_OAL_AVRCP_CT_H_*/