xref: /btstack/src/classic/avrcp.h (revision c045af99518e2a8894afc5eb9ef7d888017cd3e5)
1be32e7f1SMilanka Ringwald /*
2be32e7f1SMilanka Ringwald  * Copyright (C) 2016 BlueKitchen GmbH
3be32e7f1SMilanka Ringwald  *
4be32e7f1SMilanka Ringwald  * Redistribution and use in source and binary forms, with or without
5be32e7f1SMilanka Ringwald  * modification, are permitted provided that the following conditions
6be32e7f1SMilanka Ringwald  * are met:
7be32e7f1SMilanka Ringwald  *
8be32e7f1SMilanka Ringwald  * 1. Redistributions of source code must retain the above copyright
9be32e7f1SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer.
10be32e7f1SMilanka Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11be32e7f1SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer in the
12be32e7f1SMilanka Ringwald  *    documentation and/or other materials provided with the distribution.
13be32e7f1SMilanka Ringwald  * 3. Neither the name of the copyright holders nor the names of
14be32e7f1SMilanka Ringwald  *    contributors may be used to endorse or promote products derived
15be32e7f1SMilanka Ringwald  *    from this software without specific prior written permission.
16be32e7f1SMilanka Ringwald  * 4. Any redistribution, use, or modification is done solely for
17be32e7f1SMilanka Ringwald  *    personal benefit and not for any commercial purpose or for
18be32e7f1SMilanka Ringwald  *    monetary gain.
19be32e7f1SMilanka Ringwald  *
20be32e7f1SMilanka Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21be32e7f1SMilanka Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22be32e7f1SMilanka Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23be32e7f1SMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24be32e7f1SMilanka Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25be32e7f1SMilanka Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26be32e7f1SMilanka Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27be32e7f1SMilanka Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28be32e7f1SMilanka Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29be32e7f1SMilanka Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30be32e7f1SMilanka Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31be32e7f1SMilanka Ringwald  * SUCH DAMAGE.
32be32e7f1SMilanka Ringwald  *
33be32e7f1SMilanka Ringwald  * Please inquire about commercial licensing options at
34be32e7f1SMilanka Ringwald  * [email protected]
35be32e7f1SMilanka Ringwald  *
36be32e7f1SMilanka Ringwald  */
37be32e7f1SMilanka Ringwald 
38be32e7f1SMilanka Ringwald /*
39be32e7f1SMilanka Ringwald  * avrcp.h
40be32e7f1SMilanka Ringwald  *
41be32e7f1SMilanka Ringwald  * Audio/Video Remote Control Profile
42be32e7f1SMilanka Ringwald  *
43be32e7f1SMilanka Ringwald  */
44be32e7f1SMilanka Ringwald 
45be32e7f1SMilanka Ringwald #ifndef __AVRCP_H
46be32e7f1SMilanka Ringwald #define __AVRCP_H
47be32e7f1SMilanka Ringwald 
48be32e7f1SMilanka Ringwald #include <stdint.h>
4931a5a745SMatthias Ringwald #include "btstack_run_loop.h"
5031a5a745SMatthias Ringwald #include "btstack_linked_list.h"
51be32e7f1SMilanka Ringwald 
52be32e7f1SMilanka Ringwald #if defined __cplusplus
53be32e7f1SMilanka Ringwald extern "C" {
54be32e7f1SMilanka Ringwald #endif
55be32e7f1SMilanka Ringwald 
56be32e7f1SMilanka Ringwald #define BT_SIG_COMPANY_ID 0x001958
576983e65eSMilanka Ringwald 
586983e65eSMilanka Ringwald typedef enum {
59e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INVALID_COMMAND = 0,           // sent if TG received a PDU that it did not understand.
60e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INVALID_PARAMETER,             // Sent if the TG received a PDU with a parameter ID that it did not understand, or, if there is only one parameter ID in the PDU.
61e0bbf3edSMilanka Ringwald     AVRCP_STATUS_SPECIFIED_PARAMETER_NOT_FOUND, // sent if the parameter ID is understood, but content is wrong or corrupted.
62e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INTERNAL_ERROR,                // sent if there are error conditions not covered by a more specific error code.
63e0bbf3edSMilanka Ringwald     AVRCP_STATUS_SUCCESS,                       // sent if the operation was successful.
64e0bbf3edSMilanka Ringwald     AVRCP_STATUS_UID_CHANGED,                   // sent if the UIDs on the device have changed.
65e0bbf3edSMilanka Ringwald     AVRCP_STATUS_RESERVED_6,
66e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INVALID_DIRECTION,             // The Direction parameter is invalid. Valid for command: Change Path
67e0bbf3edSMilanka Ringwald     AVRCP_STATUS_NOT_A_DIRECTORY,               // The UID provided does not refer to a folder item. Valid for command: Change Path
68e0bbf3edSMilanka Ringwald     AVRCP_STATUS_DOES_NOT_EXIST,                // The UID provided does not refer to any currently valid. Valid for command: Change Path, PlayItem, AddToNowPlaying, GetItemAttributes
69e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INVALID_SCOPE,                 // The scope parameter is invalid. Valid for command: GetFolderItems, PlayItem, AddToNowPlayer, GetItemAttributes,
70e0bbf3edSMilanka Ringwald     AVRCP_STATUS_RANGE_OUT_OF_BOUNDS,           // The start of range provided is not valid. Valid for command: GetFolderItems
71e0bbf3edSMilanka Ringwald     AVRCP_STATUS_UID_IS_A_DIRECTORY,            // The UID provided refers to a directory, which cannot be handled by this media player. Valid for command: PlayItem, AddToNowPlaying
72e0bbf3edSMilanka Ringwald     AVRCP_STATUS_MEDIA_IN_USE,                  // The media is not able to be used for this operation at this time. Valid for command: PlayItem, AddToNowPlaying
73e0bbf3edSMilanka Ringwald     AVRCP_STATUS_NOW_PLAYING_LIST_FULL,         // No more items can be added to the Now Playing List. Valid for command: AddToNowPlaying
74e0bbf3edSMilanka Ringwald     AVRCP_STATUS_SEARCH_NOT_SUPPORTED,          // The Browsed Media Player does not support search. Valid for command: Search
75e0bbf3edSMilanka Ringwald     AVRCP_STATUS_SEARCH_IN_PROGRESS,            // A search operation is already in progress. Valid for command: Search
76e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INVALID_PLAYER_ID,             // The specified Player Id does not refer to a valid player. Valid for command: SetAddressedPlayer, SetBrowsedPlayer
77e0bbf3edSMilanka Ringwald     AVRCP_STATUS_PLAYER_NOT_BROWSABLE,          // The Player Id supplied refers to a Media Player which does not support browsing. Valid for command: SetBrowsedPlayer
78e0bbf3edSMilanka Ringwald     AVRCP_STATUS_PLAYER_NOT_ADDRESSED,          // The Player Id supplied refers to a player which is not currently addressed, and the command is not able to be performed if the player is not set as addressed. Valid for command: Search SetBrowsedPlayer
79e0bbf3edSMilanka Ringwald     AVRCP_STATUS_NO_VALID_SEARCH_RESULTS,       // The Search result list does not contain valid entries, e.g. after being invalidated due to change of browsed player. Valid for command: GetFolderItems
80e0bbf3edSMilanka Ringwald     AVRCP_STATUS_NO_AVAILABLE_PLAYERS,
81e0bbf3edSMilanka Ringwald     AVRCP_STATUS_ADDRESSED_PLAYER_CHANGED,       // Valid for command: Register Notification
82e0bbf3edSMilanka Ringwald     AVRCP_STATUS_RESERVED                       // 0x17 - 0xFF
83e0bbf3edSMilanka Ringwald } avrcp_status_code_t;
84e0bbf3edSMilanka Ringwald 
85e0bbf3edSMilanka Ringwald typedef enum {
866983e65eSMilanka Ringwald     AVRCP_SINGLE_PACKET= 0,
876983e65eSMilanka Ringwald     AVRCP_START_PACKET    ,
886983e65eSMilanka Ringwald     AVRCP_CONTINUE_PACKET ,
896983e65eSMilanka Ringwald     AVRCP_END_PACKET
906983e65eSMilanka Ringwald } avrcp_packet_type_t;
916983e65eSMilanka Ringwald 
926983e65eSMilanka Ringwald typedef enum {
936983e65eSMilanka Ringwald     AVRCP_COMMAND_FRAME = 0,
946983e65eSMilanka Ringwald     AVRCP_RESPONSE_FRAME
956983e65eSMilanka Ringwald } avrcp_frame_type_t;
966983e65eSMilanka Ringwald 
97be32e7f1SMilanka Ringwald 
98be32e7f1SMilanka Ringwald typedef enum {
99be32e7f1SMilanka Ringwald     AVRCP_CAPABILITY_ID_COMPANY = 0x02,
100be32e7f1SMilanka Ringwald     AVRCP_CAPABILITY_ID_EVENT = 0x03
101be32e7f1SMilanka Ringwald } avrcp_capability_id_t;
102be32e7f1SMilanka Ringwald 
103be32e7f1SMilanka Ringwald typedef enum {
104be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_TITLE = 1,
105be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_ARTIST,
106be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_ALBUM,
107be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_TRACK,
108be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_TOTAL_TRACKS,
109be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_GENRE,
110be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_SONG_LENGTH
111be32e7f1SMilanka Ringwald } avrcp_media_attribute_id_t;
112be32e7f1SMilanka Ringwald 
113be32e7f1SMilanka Ringwald #define AVRCP_MEDIA_ATTR_COUNT 7
114be32e7f1SMilanka Ringwald 
115be32e7f1SMilanka Ringwald typedef enum {
116be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_GET_CAPABILITIES = 0x10,
117be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_GetCurrentPlayerApplicationSettingValue = 0x13,
118be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_SetPlayerApplicationSettingValue = 0x14,
119be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_GET_ELEMENT_ATTRIBUTES = 0x20,
120be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_GET_PLAY_STATUS = 0x30,
121be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_REGISTER_NOTIFICATION = 0x31,
122*c045af99SMilanka Ringwald     AVRCP_PDU_ID_SET_ABSOLUTE_VOLUME = 0x50,
123*c045af99SMilanka Ringwald     AVRCP_PDU_ID_UNDEFINED = 0xFF
124be32e7f1SMilanka Ringwald } avrcp_pdu_id_t;
125be32e7f1SMilanka Ringwald 
126be32e7f1SMilanka Ringwald typedef enum {
127be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED = 0x01,            // Change in playback status of the current track.
128be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED = 0x02,                      // Change of current track
129be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END = 0x03,                  // Reached end of a track
130be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_START = 0x04,                // Reached start of a track
131be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED = 0x05,               // Change in playback position. Returned after the specified playback notification change notification interval
132be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_BATT_STATUS_CHANGED = 0x06,                // Change in battery status
133be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED = 0x07,              // Change in system status
134be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED = 0x08, // Change in player application setting
135be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_NOW_PLAYING_CONTENT_CHANGED = 0x09,        // The content of the Now Playing list has changed, see 6.9.5.
136be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_AVAILABLE_PLAYERS_CHANGED = 0x0a,          // The available players have changed, see 6.9.4.
137be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED = 0x0b,           // The Addressed Player has been changed, see 6.9.2.
138be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED = 0x0c,                       // The UIDs have changed, see 6.10.3.3.
139be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED = 0x0d                      // The volume has been changed locally on the TG, see 6.13.3.
140be32e7f1SMilanka Ringwald } avrcp_notification_event_id_t;
141be32e7f1SMilanka Ringwald 
142be32e7f1SMilanka Ringwald typedef enum {
143be32e7f1SMilanka Ringwald     AVRCP_CTYPE_CONTROL = 0,
144be32e7f1SMilanka Ringwald     AVRCP_CTYPE_STATUS,
145be32e7f1SMilanka Ringwald     AVRCP_CTYPE_SPECIFIC_INQUIRY,
146be32e7f1SMilanka Ringwald     AVRCP_CTYPE_NOTIFY,
147be32e7f1SMilanka Ringwald     AVRCP_CTYPE_GENERAL_INQUIRY,
148be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESERVED5,
149be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESERVED6,
150be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESERVED7,
151be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_NOT_IMPLEMENTED = 8,
152be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_ACCEPTED,
153be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_REJECTED,
154be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_IN_TRANSITION, // target state is in transition. A subsequent STATUS command, may result in the return of a STABLE status
155be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_IMPLEMENTED_STABLE,
156be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_CHANGED_STABLE,
157be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_RESERVED,
158be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_INTERIM            // target is unable to respond with either ACCEPTED or REJECTED within 100 millisecond
159be32e7f1SMilanka Ringwald } avrcp_command_type_t;
160be32e7f1SMilanka Ringwald 
161be32e7f1SMilanka Ringwald // control command response: accepted, rejected, interim
162be32e7f1SMilanka Ringwald // status command response: not implemented, rejected, in transiiton, stable
163be32e7f1SMilanka Ringwald // notify command response: not implemented, rejected, changed
164be32e7f1SMilanka Ringwald typedef enum {
165be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_MONITOR = 0,
166be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_AUDIO = 1,
167be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_PRINTER,
168be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_DISC,
169be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_TAPE_RECORDER_PLAYER,
170be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_TUNER,
171be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_CA,
172be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_CAMERA,
173be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_RESERVED,
174be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_PANEL = 9,
175be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_BULLETIN_BOARD,
176be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_CAMERA_STORAGE,
177be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_VENDOR_UNIQUE = 0x1C,
178be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_RESERVED_FOR_ALL_SUBUNIT_TYPES,
179be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_EXTENDED_TO_NEXT_BYTE, // The unit_type field may take value 1E16, which means that the field is extended to the following byte. In that case, an additional byte for extended_unit_type will be added immediately following operand[1].
180be32e7f1SMilanka Ringwald                                               // Further extension is possible when the value of extended_unit_type is FF16, in which case another byte will be added.
181be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_UNIT = 0x1F
182be32e7f1SMilanka Ringwald } avrcp_subunit_type_t;
183be32e7f1SMilanka Ringwald 
184be32e7f1SMilanka Ringwald typedef enum {
185be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_ID = 0,
186be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_ID_IGNORE = 7
187be32e7f1SMilanka Ringwald } avrcp_subunit_id_t;
188be32e7f1SMilanka Ringwald 
189be32e7f1SMilanka Ringwald typedef enum {
190be32e7f1SMilanka Ringwald     AVRCP_CMD_OPCODE_VENDOR_DEPENDENT = 0x00,
1919cc1f3ceSMilanka Ringwald     // AVRCP_CMD_OPCODE_RESERVE = 0x01,
192be32e7f1SMilanka Ringwald     AVRCP_CMD_OPCODE_UNIT_INFO = 0x30,
1934b338011SMilanka Ringwald     AVRCP_CMD_OPCODE_SUBUNIT_INFO = 0x31,
194be32e7f1SMilanka Ringwald     AVRCP_CMD_OPCODE_PASS_THROUGH = 0x7C,
1959cc1f3ceSMilanka Ringwald     // AVRCP_CMD_OPCODE_VERSION = 0xB0,
1969cc1f3ceSMilanka Ringwald     // AVRCP_CMD_OPCODE_POWER = 0xB2,
1979cc1f3ceSMilanka Ringwald     AVRCP_CMD_OPCODE_UNDEFINED = 0xFF
198be32e7f1SMilanka Ringwald } avrcp_command_opcode_t;
199be32e7f1SMilanka Ringwald 
200be32e7f1SMilanka Ringwald typedef enum {
201be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_SKIP = 0x3C,
202be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_VOLUME_UP = 0x41,
203be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_VOLUME_DOWN = 0x42,
204be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_MUTE = 0x43,
205be32e7f1SMilanka Ringwald 
206be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_PLAY = 0x44,
207be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_STOP = 0x45,
208be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_PAUSE = 0x46,
209be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_REWIND = 0x48,
210be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_FAST_FORWARD = 0x49,
211be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_FORWARD = 0x4B,
2129cc1f3ceSMilanka Ringwald     AVRCP_OPERATION_ID_BACKWARD = 0x4C,
2139cc1f3ceSMilanka Ringwald     AVRCP_OPERATION_ID_UNDEFINED = 0xFF
214be32e7f1SMilanka Ringwald } avrcp_operation_id_t;
215be32e7f1SMilanka Ringwald 
216be32e7f1SMilanka Ringwald typedef enum{
217*c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_STOPPED = 0x00,
218*c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_PLAYING,
219*c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_PAUSED,
220*c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_FWD_SEEK,
221*c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_REV_SEEK,
222*c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_ERROR = 0xFF
223*c045af99SMilanka Ringwald } avrcp_play_status_t;
224*c045af99SMilanka Ringwald 
225*c045af99SMilanka Ringwald typedef enum {
226be32e7f1SMilanka Ringwald     AVCTP_CONNECTION_IDLE,
2276086246cSMilanka Ringwald     AVCTP_SIGNALING_W4_SDP_QUERY_COMPLETE,
228be32e7f1SMilanka Ringwald     AVCTP_CONNECTION_W4_L2CAP_CONNECTED,
229be32e7f1SMilanka Ringwald     AVCTP_CONNECTION_OPENED,
230be32e7f1SMilanka Ringwald     AVCTP_W2_SEND_PRESS_COMMAND,
231be32e7f1SMilanka Ringwald     AVCTP_W2_SEND_RELEASE_COMMAND,
232be32e7f1SMilanka Ringwald     AVCTP_W4_STOP,
233be32e7f1SMilanka Ringwald     AVCTP_W2_SEND_COMMAND,
2344b338011SMilanka Ringwald     AVCTP_W2_SEND_RESPONSE,
235be32e7f1SMilanka Ringwald     AVCTP_W2_RECEIVE_PRESS_RESPONSE,
236294335f1SMilanka Ringwald     AVCTP_W2_RECEIVE_RESPONSE
237be32e7f1SMilanka Ringwald } avctp_connection_state_t;
238be32e7f1SMilanka Ringwald 
239be32e7f1SMilanka Ringwald typedef struct {
240be32e7f1SMilanka Ringwald     btstack_linked_item_t    item;
241be32e7f1SMilanka Ringwald     bd_addr_t remote_addr;
242be32e7f1SMilanka Ringwald     uint16_t l2cap_signaling_cid;
2436086246cSMilanka Ringwald     uint16_t avrcp_cid;
244be32e7f1SMilanka Ringwald 
245be32e7f1SMilanka Ringwald     avctp_connection_state_t state;
246be32e7f1SMilanka Ringwald     uint8_t wait_to_send;
247be32e7f1SMilanka Ringwald 
248be32e7f1SMilanka Ringwald     // command
249be32e7f1SMilanka Ringwald     uint8_t transaction_label;
2509cc1f3ceSMilanka Ringwald     avrcp_command_opcode_t command_opcode;
251be32e7f1SMilanka Ringwald     avrcp_command_type_t command_type;
252be32e7f1SMilanka Ringwald     avrcp_subunit_type_t subunit_type;
253be32e7f1SMilanka Ringwald     avrcp_subunit_id_t   subunit_id;
254be32e7f1SMilanka Ringwald     uint8_t cmd_operands[20];
255adcdded9SMilanka Ringwald     uint8_t cmd_operands_length;
256be32e7f1SMilanka Ringwald     btstack_timer_source_t press_and_hold_cmd_timer;
257d1845da3SMilanka Ringwald     uint8_t  continuous_fast_forward_cmd;
258be32e7f1SMilanka Ringwald     uint16_t notifications_enabled;
259be32e7f1SMilanka Ringwald     uint16_t notifications_to_register;
260be32e7f1SMilanka Ringwald     uint16_t notifications_to_deregister;
261be32e7f1SMilanka Ringwald } avrcp_connection_t;
262be32e7f1SMilanka Ringwald 
263be32e7f1SMilanka Ringwald typedef enum {
264d5ff3b26SMatthias Ringwald     AVRCP_SHUFFLE_MODE_INVALID,
265d5ff3b26SMatthias Ringwald     AVRCP_SHUFFLE_MODE_OFF,
266be32e7f1SMilanka Ringwald     AVRCP_SHUFFLE_MODE_ALL_TRACKS,
267be32e7f1SMilanka Ringwald     AVRCP_SHUFFLE_MODE_GROUP
268be32e7f1SMilanka Ringwald } avrcp_shuffle_mode_t;
269be32e7f1SMilanka Ringwald 
270be32e7f1SMilanka Ringwald typedef enum {
271d5ff3b26SMatthias Ringwald     AVRCP_REPEAT_MODE_INVALID,
272d5ff3b26SMatthias Ringwald     AVRCP_REPEAT_MODE_OFF,
273be32e7f1SMilanka Ringwald     AVRCP_REPEAT_MODE_SINGLE_TRACK,
274be32e7f1SMilanka Ringwald     AVRCP_REPEAT_MODE_ALL_TRACKS,
275be32e7f1SMilanka Ringwald     AVRCP_REPEAT_MODE_GROUP
276be32e7f1SMilanka Ringwald } avrcp_repeat_mode_t;
277be32e7f1SMilanka Ringwald 
2786086246cSMilanka Ringwald typedef enum{
2796086246cSMilanka Ringwald     AVRCP_CONTROLLER = 0,
2806086246cSMilanka Ringwald     AVRCP_TARGET
2816086246cSMilanka Ringwald } avrcp_role_t;
2826086246cSMilanka Ringwald 
2836086246cSMilanka Ringwald typedef struct {
2846086246cSMilanka Ringwald     avrcp_role_t role;
2856086246cSMilanka Ringwald     btstack_linked_list_t connections;
2866086246cSMilanka Ringwald     btstack_packet_handler_t avrcp_callback;
2876086246cSMilanka Ringwald     btstack_packet_handler_t packet_handler;
2886086246cSMilanka Ringwald 
2896983e65eSMilanka Ringwald     // SDP query
2906983e65eSMilanka Ringwald     uint16_t avrcp_cid;
291df642728SMilanka Ringwald     uint16_t avrcp_l2cap_psm;
292df642728SMilanka Ringwald     uint16_t avrcp_version;
293227d16a5SMatthias Ringwald     uint16_t avrcp_browsing_l2cap_psm;
294227d16a5SMatthias Ringwald     uint16_t avrcp_browsing_version;
295df642728SMilanka Ringwald     uint8_t  role_supported;
2966983e65eSMilanka Ringwald } avrcp_context_t;
297be32e7f1SMilanka Ringwald 
298be32e7f1SMilanka Ringwald const char * avrcp_subunit2str(uint16_t index);
299be32e7f1SMilanka Ringwald const char * avrcp_event2str(uint16_t index);
300be32e7f1SMilanka Ringwald const char * avrcp_operation2str(uint8_t index);
301be32e7f1SMilanka Ringwald const char * avrcp_attribute2str(uint8_t index);
302be32e7f1SMilanka Ringwald const char * avrcp_play_status2str(uint8_t index);
303be32e7f1SMilanka Ringwald const char * avrcp_ctype2str(uint8_t index);
304be32e7f1SMilanka Ringwald const char * avrcp_repeat2str(uint8_t index);
305be32e7f1SMilanka Ringwald const char * avrcp_shuffle2str(uint8_t index);
306be32e7f1SMilanka Ringwald 
3076983e65eSMilanka Ringwald void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, avrcp_context_t * context);
3086983e65eSMilanka Ringwald 
3096983e65eSMilanka Ringwald void avrcp_create_sdp_record(uint8_t controller, uint8_t * service, uint32_t service_record_handle, uint8_t browsing, uint16_t supported_features, const char * service_name, const char * service_provider_name);
3106983e65eSMilanka Ringwald uint8_t avrcp_connect(bd_addr_t bd_addr, avrcp_context_t * context, uint16_t * avrcp_cid);
3116983e65eSMilanka Ringwald void avrcp_emit_connection_established(btstack_packet_handler_t callback, uint16_t avrcp_cid, bd_addr_t addr, uint8_t status);
3126983e65eSMilanka Ringwald void avrcp_emit_connection_closed(btstack_packet_handler_t callback, uint16_t avrcp_cid);
3136983e65eSMilanka Ringwald 
3144b338011SMilanka Ringwald uint8_t avrcp_cmd_opcode(uint8_t *packet, uint16_t size);
3156983e65eSMilanka Ringwald avrcp_connection_t * get_avrcp_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid, avrcp_context_t * context);
31601dc6e35SMilanka Ringwald avrcp_connection_t * get_avrcp_connection_for_avrcp_cid(uint16_t avrcp_cid, avrcp_context_t * context);
3176983e65eSMilanka Ringwald void avrcp_request_can_send_now(avrcp_connection_t * connection, uint16_t l2cap_cid);
3186983e65eSMilanka Ringwald 
319be32e7f1SMilanka Ringwald #if defined __cplusplus
320be32e7f1SMilanka Ringwald }
321be32e7f1SMilanka Ringwald #endif
322be32e7f1SMilanka Ringwald 
323be32e7f1SMilanka Ringwald #endif // __AVRCP_H