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 Set media player properties to target device
237 * @remarks Target device will receive media player properties.
239 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
240 * @retval #OAL_STATUS_SUCCESS Successful
242 * @pre OAL API must be initialize with avrcp_ct_enable().
245 oal_status_t avrcp_ct_set_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type, uint32_t value);
248 * @brief Set media transport properties to target device
250 * @remarks Target device will receive media player properties.
252 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
253 * @retval #OAL_STATUS_SUCCESS Successful
255 * @pre OAL API must be initialize with avrcp_ct_enable().
258 oal_status_t avrcp_transport_set_property(bt_address_t *device_address, int type, unsigned int value);
261 * @brief Get media player properties to target device
263 * @remarks Target device will send media player properties.
265 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
266 * @retval #OAL_STATUS_SUCCESS Successful
268 * @pre OAL API must be initialize with avrcp_ct_enable().
271 oal_status_t avrcp_ct_get_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type);
274 * @brief Set media player properties to target device
276 * @remarks Target device will receive media player properties.
278 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
279 * @retval #OAL_STATUS_SUCCESS Successful
281 * @pre OAL API must be initialize with avrcp_ct_enable().
284 oal_status_t avrcp_ct_get_media_attribute(bt_address_t *device_address);
287 * @brief Request current status of the media playing on connected Audio source.
289 * @details Result containing - Song Length, Song Position and current status(Stopped/Playing/Paused) will be notified through an OAL event
291 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
292 * @retval #OAL_STATUS_SUCCESS Successful
294 * @pre A2DP Sink should be connected with a device.
295 * @pre AVRCP connection should exist with the device.
297 * @see OAL_EVENT_AVRCP_CT_PLAY_STATUS
298 * @see event_avrcp_ct_play_status_t
300 oal_status_t avrcp_ct_get_play_status(bt_address_t *device_address);
304 #endif /* __cplusplus */
305 #endif /*_OAL_AVRCP_CT_H_*/