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 } avrcp_ct_pass_cmd_key_code_t;
47 * @brief Current State of remote key(pressed/released)
49 * @see avrcp_ct_fforward
50 * @see avrcp_ct_rewind
55 } avrcp_ct_pass_state_t;
58 avrcp_ct_pass_cmd_key_code_t key_code;
59 avrcp_ct_pass_state_t key_state;
60 } avrcp_ct_pass_cmd_t;
64 } avrcp_ct_playersetting_t;
73 } avrcp_ct_player_property_type_t;
76 avrcp_ct_player_property_type_t type;
78 } avrcp_ct_property_value_t;
83 } avrcp_ct_play_position_t;
86 * @brief Enable AVRCP Controller Feature
88 * @remarks Devices supporting AVRCP Target will be able to connect.
89 * @remarks Used in conjunction with a2dp_sink_enable.
91 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
92 * @retval #OAL_STATUS_SUCCESS Successful
94 * @pre OAL API must be initialized with oal_bt_init().
96 * @see avrcp_ct_disable
97 * @see a2dp_sink_enable
99 oal_status_t avrcp_ct_enable(void);
102 * @brief Disable AVRCP Controller Feature
104 * @remarks Devices supporting AVRCP Target will not be able to connect.
105 * @remarks Used in conjunction with a2dp_sink_disable.
107 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
108 * @retval #OAL_STATUS_SUCCESS Successful
110 * @pre AVRCP Controller should be enabled with avrcp_ct_enable().
112 * @see avrcp_ct_enable
113 * @see a2dp_sink_disable
115 oal_status_t avrcp_ct_disable(void);
118 * @brief Initiate a connection with a BT Sound device
120 * @details Result will be notified through an OAL event
122 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
123 * @retval #OAL_STATUS_SUCCESS Successful
125 * @pre BT Audio should be enabled with avrcp_ct_enable().
127 * @see OAL_EVENT_AVRCP_CT_CONNECTED
130 oal_status_t avrcp_ct_connect(bt_address_t *device_address);
134 * @brief Remove a connection with a BT Sound device
136 * @details Result will be notified through an OAL event
138 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
139 * @retval #OAL_STATUS_SUCCESS Successful
141 * @pre BT Audio should be connected with a BT Sound device.
143 * @see OAL_EVENT_AVRCP_CT_DISCONNECTED
146 oal_status_t avrcp_ct_disconnect(bt_address_t *device_address);
149 * @brief Play audio on the connected remote device.
151 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
152 * @retval #OAL_STATUS_SUCCESS Successful
154 * @pre A2DP Sink should be connected with a device.
155 * @pre AVRCP connection should exist with the device.
157 oal_status_t avrcp_ct_play(bt_address_t *device_address);
160 * @brief Stop audio on the connected remote device.
162 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
163 * @retval #OAL_STATUS_SUCCESS Successful
165 * @pre A2DP Sink should be connected with a device.
166 * @pre AVRCP connection should exist with the device.
168 oal_status_t avrcp_ct_stop(bt_address_t *device_address);
171 * @brief Pause audio on the connected remote device.
173 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
174 * @retval #OAL_STATUS_SUCCESS Successful
176 * @pre A2DP Sink should be connected with a device.
177 * @pre AVRCP connection should exist with the device.
179 oal_status_t avrcp_ct_pause(bt_address_t *device_address);
182 * @brief Fast Forward audio on the connected remote device.
184 * @remarks PRESS_STATE - Start Fast Forward
185 * RELEASE_STATE - Stop Fast Forward
187 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
188 * @retval #OAL_STATUS_SUCCESS Successful
190 * @pre A2DP Sink should be connected with a device.
191 * @pre AVRCP connection should exist with the device.
193 oal_status_t avrcp_ct_fforward(bt_address_t *device_address, avrcp_ct_pass_state_t press_state);
196 * @brief Rewind audio on the connected remote device.
198 * @remarks PRESS_STATE - Start Rewind
199 * RELEASE_STATE - Stop Rewind
201 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
202 * @retval #OAL_STATUS_SUCCESS Successful
204 * @pre A2DP Sink should be connected with a device.
205 * @pre AVRCP connection should exist with the device.
207 oal_status_t avrcp_ct_rewind(bt_address_t *device_address, avrcp_ct_pass_state_t press_state);
210 * @brief Play next track on the connected remote device.
212 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
213 * @retval #OAL_STATUS_SUCCESS Successful
215 * @pre A2DP Sink should be connected with a device.
216 * @pre AVRCP connection should exist with the device.
218 oal_status_t avrcp_ct_next_track(bt_address_t *device_address);
222 * @brief Play prev track on the connected remote device.
224 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
225 * @retval #OAL_STATUS_SUCCESS Successful
227 * @pre A2DP Sink should be connected with a device.
228 * @pre AVRCP connection should exist with the device.
230 oal_status_t avrcp_ct_prev_track(bt_address_t *device_address);
233 * @brief Set media player properties to target device
235 * @remarks Target device will receive media player properties.
237 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
238 * @retval #OAL_STATUS_SUCCESS Successful
240 * @pre OAL API must be initialize with avrcp_ct_enable().
243 oal_status_t avrcp_ct_set_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type, uint32_t value);
246 * @brief Set media transport properties to target device
248 * @remarks Target device will receive media player properties.
250 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
251 * @retval #OAL_STATUS_SUCCESS Successful
253 * @pre OAL API must be initialize with avrcp_ct_enable().
256 oal_status_t avrcp_transport_set_property(bt_address_t *device_address, int type, unsigned int value);
259 * @brief Get media player properties to target device
261 * @remarks Target device will send media player properties.
263 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
264 * @retval #OAL_STATUS_SUCCESS Successful
266 * @pre OAL API must be initialize with avrcp_ct_enable().
269 oal_status_t avrcp_ct_get_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type);
272 * @brief Set media player properties to target device
274 * @remarks Target device will receive media player properties.
276 * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
277 * @retval #OAL_STATUS_SUCCESS Successful
279 * @pre OAL API must be initialize with avrcp_ct_enable().
282 oal_status_t avrcp_ct_get_media_attribute(bt_address_t *device_address);
285 * @brief Request current status of the media playing on connected Audio source.
287 * @details Result containing - Song Length, Song Position and current status(Stopped/Playing/Paused) will be notified through an OAL event
289 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
290 * @retval #OAL_STATUS_SUCCESS Successful
292 * @pre A2DP Sink should be connected with a device.
293 * @pre AVRCP connection should exist with the device.
295 * @see OAL_EVENT_AVRCP_CT_PLAY_STATUS
296 * @see event_avrcp_ct_play_status_t
298 oal_status_t avrcp_ct_get_play_status(bt_address_t *device_address);
302 #endif /* __cplusplus */
303 #endif /*_OAL_AVRCP_CT_H_*/