2 * Open Adaptation Layer (OAL)
4 * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
6 * Contact: Nilesh Trimbake <t.shripati@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef _OAL_AVRCP_CT_H_
23 #define _OAL_AVRCP_CT_H_
26 #include <sys/types.h>
27 #include <oal-manager.h>
28 #include "oal-event.h"
35 OAL_RC_PASS_CMD_PLAY = 0x01,
36 OAL_RC_PASS_CMD_PAUSE,
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 OAL_RC_PASS_CMD_VOLUME_UP,
45 OAL_RC_PASS_CMD_VOLUME_DOWN
46 } avrcp_ct_pass_cmd_key_code_t;
49 * @brief Current State of remote key(pressed/released)
51 * @see avrcp_ct_fforward
52 * @see avrcp_ct_rewind
57 } avrcp_ct_pass_state_t;
60 avrcp_ct_pass_cmd_key_code_t key_code;
61 avrcp_ct_pass_state_t key_state;
62 } avrcp_ct_pass_cmd_t;
66 } avrcp_ct_playersetting_t;
75 } avrcp_ct_player_property_type_t;
78 avrcp_ct_player_property_type_t type;
80 } avrcp_ct_property_value_t;
85 } avrcp_ct_play_position_t;
88 * @brief Enable AVRCP Controller Feature
90 * @remarks Devices supporting AVRCP Target will be able to connect.
91 * @remarks Used in conjunction with a2dp_sink_enable.
93 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
94 * @retval #OAL_STATUS_SUCCESS Successful
96 * @pre OAL API must be initialized with oal_bt_init().
98 * @see avrcp_ct_disable
99 * @see a2dp_sink_enable
101 oal_status_t avrcp_ct_enable(void);
104 * @brief Disable AVRCP Controller Feature
106 * @remarks Devices supporting AVRCP Target will not be able to connect.
107 * @remarks Used in conjunction with a2dp_sink_disable.
109 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
110 * @retval #OAL_STATUS_SUCCESS Successful
112 * @pre AVRCP Controller should be enabled with avrcp_ct_enable().
114 * @see avrcp_ct_enable
115 * @see a2dp_sink_disable
117 oal_status_t avrcp_ct_disable(void);
120 * @brief Initiate a connection with a BT Sound device
122 * @details Result will be notified through an OAL event
124 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
125 * @retval #OAL_STATUS_SUCCESS Successful
127 * @pre BT Audio should be enabled with avrcp_ct_enable().
129 * @see OAL_EVENT_AVRCP_CT_CONNECTED
132 oal_status_t avrcp_ct_connect(bt_address_t *device_address);
136 * @brief Remove a connection with a BT Sound device
138 * @details Result will be notified through an OAL event
140 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
141 * @retval #OAL_STATUS_SUCCESS Successful
143 * @pre BT Audio should be connected with a BT Sound device.
145 * @see OAL_EVENT_AVRCP_CT_DISCONNECTED
148 oal_status_t avrcp_ct_disconnect(bt_address_t *device_address);
151 * @brief Play audio on the connected remote device.
153 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
154 * @retval #OAL_STATUS_SUCCESS Successful
156 * @pre A2DP Sink should be connected with a device.
157 * @pre AVRCP connection should exist with the device.
159 oal_status_t avrcp_ct_play(bt_address_t *device_address);
162 * @brief Stop audio on the connected remote device.
164 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
165 * @retval #OAL_STATUS_SUCCESS Successful
167 * @pre A2DP Sink should be connected with a device.
168 * @pre AVRCP connection should exist with the device.
170 oal_status_t avrcp_ct_stop(bt_address_t *device_address);
173 * @brief Pause audio on the connected remote device.
175 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
176 * @retval #OAL_STATUS_SUCCESS Successful
178 * @pre A2DP Sink should be connected with a device.
179 * @pre AVRCP connection should exist with the device.
181 oal_status_t avrcp_ct_pause(bt_address_t *device_address);
184 * @brief Fast Forward audio on the connected remote device.
186 * @remarks PRESS_STATE - Start Fast Forward
187 * RELEASE_STATE - Stop Fast Forward
189 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
190 * @retval #OAL_STATUS_SUCCESS Successful
192 * @pre A2DP Sink should be connected with a device.
193 * @pre AVRCP connection should exist with the device.
195 oal_status_t avrcp_ct_fforward(bt_address_t *device_address, avrcp_ct_pass_state_t press_state);
198 * @brief Rewind audio on the connected remote device.
200 * @remarks PRESS_STATE - Start Rewind
201 * RELEASE_STATE - Stop Rewind
203 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
204 * @retval #OAL_STATUS_SUCCESS Successful
206 * @pre A2DP Sink should be connected with a device.
207 * @pre AVRCP connection should exist with the device.
209 oal_status_t avrcp_ct_rewind(bt_address_t *device_address, avrcp_ct_pass_state_t press_state);
212 * @brief Play next track on the connected remote device.
214 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
215 * @retval #OAL_STATUS_SUCCESS Successful
217 * @pre A2DP Sink should be connected with a device.
218 * @pre AVRCP connection should exist with the device.
220 oal_status_t avrcp_ct_next_track(bt_address_t *device_address);
224 * @brief Play prev track on the connected remote device.
226 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
227 * @retval #OAL_STATUS_SUCCESS Successful
229 * @pre A2DP Sink should be connected with a device.
230 * @pre AVRCP connection should exist with the device.
232 oal_status_t avrcp_ct_prev_track(bt_address_t *device_address);
235 * @brief Play volume up on the connected remote device.
237 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
238 * @retval #OAL_STATUS_SUCCESS Successful
240 * @pre A2DP Sink should be connected with a device.
241 * @pre AVRCP connection should exist with the device.
243 oal_status_t avrcp_ct_volume_up(bt_address_t *device_address);
246 * @brief Play volume down on the connected remote device.
248 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
249 * @retval #OAL_STATUS_SUCCESS Successful
251 * @pre A2DP Sink should be connected with a device.
252 * @pre AVRCP connection should exist with the device.
254 oal_status_t avrcp_ct_volume_down(bt_address_t *device_address);
258 * @brief Set media player properties to target device
260 * @remarks Target device will receive media player properties.
262 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
263 * @retval #OAL_STATUS_SUCCESS Successful
265 * @pre OAL API must be initialize with avrcp_ct_enable().
268 oal_status_t avrcp_ct_set_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type, uint32_t value);
271 * @brief Set media transport properties to target device
273 * @remarks Target device will receive media player properties.
275 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
276 * @retval #OAL_STATUS_SUCCESS Successful
278 * @pre OAL API must be initialize with avrcp_ct_enable().
281 oal_status_t avrcp_transport_set_property(bt_address_t *device_address, int type, unsigned int value);
284 * @brief Get media player properties to target device
286 * @remarks Target device will send media player properties.
288 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
289 * @retval #OAL_STATUS_SUCCESS Successful
291 * @pre OAL API must be initialize with avrcp_ct_enable().
294 oal_status_t avrcp_ct_get_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type);
297 * @brief Set media player properties to target device
299 * @remarks Target device will receive media player properties.
301 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
302 * @retval #OAL_STATUS_SUCCESS Successful
304 * @pre OAL API must be initialize with avrcp_ct_enable().
307 oal_status_t avrcp_ct_get_media_attribute(bt_address_t *device_address);
310 * @brief Request current status of the media playing on connected Audio source.
312 * @details Result containing - Song Length, Song Position and current status(Stopped/Playing/Paused) will be notified through an OAL event
314 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
315 * @retval #OAL_STATUS_SUCCESS Successful
317 * @pre A2DP Sink should be connected with a device.
318 * @pre AVRCP connection should exist with the device.
320 * @see OAL_EVENT_AVRCP_CT_PLAY_STATUS
321 * @see event_avrcp_ct_play_status_t
323 oal_status_t avrcp_ct_get_play_status(bt_address_t *device_address);
327 #endif /* __cplusplus */
328 #endif /*_OAL_AVRCP_CT_H_*/