xref: /btstack/src/classic/avrcp.h (revision fe8b78009f0d72004cf26aabaf03caf9af3b1ee8)
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
57*fe8b7800SMilanka Ringwald #define AVRCP_MEDIA_ATTR_COUNT 7
586983e65eSMilanka Ringwald 
596983e65eSMilanka Ringwald typedef enum {
60e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INVALID_COMMAND = 0,           // sent if TG received a PDU that it did not understand.
61e0bbf3edSMilanka 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.
62e0bbf3edSMilanka Ringwald     AVRCP_STATUS_SPECIFIED_PARAMETER_NOT_FOUND, // sent if the parameter ID is understood, but content is wrong or corrupted.
63e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INTERNAL_ERROR,                // sent if there are error conditions not covered by a more specific error code.
64e0bbf3edSMilanka Ringwald     AVRCP_STATUS_SUCCESS,                       // sent if the operation was successful.
65e0bbf3edSMilanka Ringwald     AVRCP_STATUS_UID_CHANGED,                   // sent if the UIDs on the device have changed.
66e0bbf3edSMilanka Ringwald     AVRCP_STATUS_RESERVED_6,
67e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INVALID_DIRECTION,             // The Direction parameter is invalid. Valid for command: Change Path
68e0bbf3edSMilanka Ringwald     AVRCP_STATUS_NOT_A_DIRECTORY,               // The UID provided does not refer to a folder item. Valid for command: Change Path
69e0bbf3edSMilanka Ringwald     AVRCP_STATUS_DOES_NOT_EXIST,                // The UID provided does not refer to any currently valid. Valid for command: Change Path, PlayItem, AddToNowPlaying, GetItemAttributes
70e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INVALID_SCOPE,                 // The scope parameter is invalid. Valid for command: GetFolderItems, PlayItem, AddToNowPlayer, GetItemAttributes,
71e0bbf3edSMilanka Ringwald     AVRCP_STATUS_RANGE_OUT_OF_BOUNDS,           // The start of range provided is not valid. Valid for command: GetFolderItems
72e0bbf3edSMilanka 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
73e0bbf3edSMilanka 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
74e0bbf3edSMilanka Ringwald     AVRCP_STATUS_NOW_PLAYING_LIST_FULL,         // No more items can be added to the Now Playing List. Valid for command: AddToNowPlaying
75e0bbf3edSMilanka Ringwald     AVRCP_STATUS_SEARCH_NOT_SUPPORTED,          // The Browsed Media Player does not support search. Valid for command: Search
76e0bbf3edSMilanka Ringwald     AVRCP_STATUS_SEARCH_IN_PROGRESS,            // A search operation is already in progress. Valid for command: Search
77e0bbf3edSMilanka Ringwald     AVRCP_STATUS_INVALID_PLAYER_ID,             // The specified Player Id does not refer to a valid player. Valid for command: SetAddressedPlayer, SetBrowsedPlayer
78e0bbf3edSMilanka Ringwald     AVRCP_STATUS_PLAYER_NOT_BROWSABLE,          // The Player Id supplied refers to a Media Player which does not support browsing. Valid for command: SetBrowsedPlayer
79e0bbf3edSMilanka 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
80e0bbf3edSMilanka 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
81e0bbf3edSMilanka Ringwald     AVRCP_STATUS_NO_AVAILABLE_PLAYERS,
82e0bbf3edSMilanka Ringwald     AVRCP_STATUS_ADDRESSED_PLAYER_CHANGED,       // Valid for command: Register Notification
83e0bbf3edSMilanka Ringwald     AVRCP_STATUS_RESERVED                       // 0x17 - 0xFF
84e0bbf3edSMilanka Ringwald } avrcp_status_code_t;
85e0bbf3edSMilanka Ringwald 
86e0bbf3edSMilanka Ringwald typedef enum {
876983e65eSMilanka Ringwald     AVRCP_SINGLE_PACKET= 0,
886983e65eSMilanka Ringwald     AVRCP_START_PACKET    ,
896983e65eSMilanka Ringwald     AVRCP_CONTINUE_PACKET ,
906983e65eSMilanka Ringwald     AVRCP_END_PACKET
916983e65eSMilanka Ringwald } avrcp_packet_type_t;
926983e65eSMilanka Ringwald 
936983e65eSMilanka Ringwald typedef enum {
946983e65eSMilanka Ringwald     AVRCP_COMMAND_FRAME = 0,
956983e65eSMilanka Ringwald     AVRCP_RESPONSE_FRAME
966983e65eSMilanka Ringwald } avrcp_frame_type_t;
976983e65eSMilanka Ringwald 
98be32e7f1SMilanka Ringwald 
99be32e7f1SMilanka Ringwald typedef enum {
100be32e7f1SMilanka Ringwald     AVRCP_CAPABILITY_ID_COMPANY = 0x02,
101be32e7f1SMilanka Ringwald     AVRCP_CAPABILITY_ID_EVENT = 0x03
102be32e7f1SMilanka Ringwald } avrcp_capability_id_t;
103be32e7f1SMilanka Ringwald 
104be32e7f1SMilanka Ringwald typedef enum {
105be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_TITLE = 1,
106be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_ARTIST,
107be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_ALBUM,
108be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_TRACK,
109be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_TOTAL_TRACKS,
110be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_GENRE,
111be32e7f1SMilanka Ringwald     AVRCP_MEDIA_ATTR_SONG_LENGTH
112be32e7f1SMilanka Ringwald } avrcp_media_attribute_id_t;
113be32e7f1SMilanka Ringwald 
114be32e7f1SMilanka Ringwald typedef enum {
115be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_GET_CAPABILITIES = 0x10,
116be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_GetCurrentPlayerApplicationSettingValue = 0x13,
117be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_SetPlayerApplicationSettingValue = 0x14,
118be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_GET_ELEMENT_ATTRIBUTES = 0x20,
119be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_GET_PLAY_STATUS = 0x30,
120be32e7f1SMilanka Ringwald     AVRCP_PDU_ID_REGISTER_NOTIFICATION = 0x31,
121c045af99SMilanka Ringwald     AVRCP_PDU_ID_SET_ABSOLUTE_VOLUME = 0x50,
122c045af99SMilanka Ringwald     AVRCP_PDU_ID_UNDEFINED = 0xFF
123be32e7f1SMilanka Ringwald } avrcp_pdu_id_t;
124be32e7f1SMilanka Ringwald 
125be32e7f1SMilanka Ringwald typedef enum {
126be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED = 0x01,            // Change in playback status of the current track.
127be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED = 0x02,                      // Change of current track
128be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END = 0x03,                  // Reached end of a track
129be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_START = 0x04,                // Reached start of a track
130be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED = 0x05,               // Change in playback position. Returned after the specified playback notification change notification interval
131be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_BATT_STATUS_CHANGED = 0x06,                // Change in battery status
132be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED = 0x07,              // Change in system status
133be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED = 0x08, // Change in player application setting
134be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_NOW_PLAYING_CONTENT_CHANGED = 0x09,        // The content of the Now Playing list has changed, see 6.9.5.
135be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_AVAILABLE_PLAYERS_CHANGED = 0x0a,          // The available players have changed, see 6.9.4.
136be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED = 0x0b,           // The Addressed Player has been changed, see 6.9.2.
137be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED = 0x0c,                       // The UIDs have changed, see 6.10.3.3.
138be32e7f1SMilanka Ringwald     AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED = 0x0d                      // The volume has been changed locally on the TG, see 6.13.3.
139be32e7f1SMilanka Ringwald } avrcp_notification_event_id_t;
140be32e7f1SMilanka Ringwald 
141be32e7f1SMilanka Ringwald typedef enum {
142be32e7f1SMilanka Ringwald     AVRCP_CTYPE_CONTROL = 0,
143be32e7f1SMilanka Ringwald     AVRCP_CTYPE_STATUS,
144be32e7f1SMilanka Ringwald     AVRCP_CTYPE_SPECIFIC_INQUIRY,
145be32e7f1SMilanka Ringwald     AVRCP_CTYPE_NOTIFY,
146be32e7f1SMilanka Ringwald     AVRCP_CTYPE_GENERAL_INQUIRY,
147be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESERVED5,
148be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESERVED6,
149be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESERVED7,
150be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_NOT_IMPLEMENTED = 8,
151be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_ACCEPTED,
152be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_REJECTED,
153be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_IN_TRANSITION, // target state is in transition. A subsequent STATUS command, may result in the return of a STABLE status
154be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_IMPLEMENTED_STABLE,
155be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_CHANGED_STABLE,
156be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_RESERVED,
157be32e7f1SMilanka Ringwald     AVRCP_CTYPE_RESPONSE_INTERIM            // target is unable to respond with either ACCEPTED or REJECTED within 100 millisecond
158be32e7f1SMilanka Ringwald } avrcp_command_type_t;
159be32e7f1SMilanka Ringwald 
160be32e7f1SMilanka Ringwald // control command response: accepted, rejected, interim
161be32e7f1SMilanka Ringwald // status command response: not implemented, rejected, in transiiton, stable
162be32e7f1SMilanka Ringwald // notify command response: not implemented, rejected, changed
163be32e7f1SMilanka Ringwald typedef enum {
164be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_MONITOR = 0,
165be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_AUDIO = 1,
166be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_PRINTER,
167be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_DISC,
168be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_TAPE_RECORDER_PLAYER,
169be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_TUNER,
170be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_CA,
171be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_CAMERA,
172be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_RESERVED,
173be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_PANEL = 9,
174be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_BULLETIN_BOARD,
175be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_CAMERA_STORAGE,
176be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_VENDOR_UNIQUE = 0x1C,
177be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_RESERVED_FOR_ALL_SUBUNIT_TYPES,
178be32e7f1SMilanka 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].
179be32e7f1SMilanka Ringwald                                               // Further extension is possible when the value of extended_unit_type is FF16, in which case another byte will be added.
180be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_TYPE_UNIT = 0x1F
181be32e7f1SMilanka Ringwald } avrcp_subunit_type_t;
182be32e7f1SMilanka Ringwald 
183be32e7f1SMilanka Ringwald typedef enum {
184be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_ID = 0,
185be32e7f1SMilanka Ringwald     AVRCP_SUBUNIT_ID_IGNORE = 7
186be32e7f1SMilanka Ringwald } avrcp_subunit_id_t;
187be32e7f1SMilanka Ringwald 
188be32e7f1SMilanka Ringwald typedef enum {
189be32e7f1SMilanka Ringwald     AVRCP_CMD_OPCODE_VENDOR_DEPENDENT = 0x00,
1909cc1f3ceSMilanka Ringwald     // AVRCP_CMD_OPCODE_RESERVE = 0x01,
191be32e7f1SMilanka Ringwald     AVRCP_CMD_OPCODE_UNIT_INFO = 0x30,
1924b338011SMilanka Ringwald     AVRCP_CMD_OPCODE_SUBUNIT_INFO = 0x31,
193be32e7f1SMilanka Ringwald     AVRCP_CMD_OPCODE_PASS_THROUGH = 0x7C,
1949cc1f3ceSMilanka Ringwald     // AVRCP_CMD_OPCODE_VERSION = 0xB0,
1959cc1f3ceSMilanka Ringwald     // AVRCP_CMD_OPCODE_POWER = 0xB2,
1969cc1f3ceSMilanka Ringwald     AVRCP_CMD_OPCODE_UNDEFINED = 0xFF
197be32e7f1SMilanka Ringwald } avrcp_command_opcode_t;
198be32e7f1SMilanka Ringwald 
199be32e7f1SMilanka Ringwald typedef enum {
200be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_SKIP = 0x3C,
201be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_VOLUME_UP = 0x41,
202be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_VOLUME_DOWN = 0x42,
203be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_MUTE = 0x43,
204be32e7f1SMilanka Ringwald 
205be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_PLAY = 0x44,
206be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_STOP = 0x45,
207be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_PAUSE = 0x46,
208be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_REWIND = 0x48,
209be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_FAST_FORWARD = 0x49,
210be32e7f1SMilanka Ringwald     AVRCP_OPERATION_ID_FORWARD = 0x4B,
2119cc1f3ceSMilanka Ringwald     AVRCP_OPERATION_ID_BACKWARD = 0x4C,
2129cc1f3ceSMilanka Ringwald     AVRCP_OPERATION_ID_UNDEFINED = 0xFF
213be32e7f1SMilanka Ringwald } avrcp_operation_id_t;
214be32e7f1SMilanka Ringwald 
215be32e7f1SMilanka Ringwald typedef enum{
216c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_STOPPED = 0x00,
217c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_PLAYING,
218c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_PAUSED,
219c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_FWD_SEEK,
220c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_REV_SEEK,
221c045af99SMilanka Ringwald     AVRCP_PLAY_STATUS_ERROR = 0xFF
222c045af99SMilanka Ringwald } avrcp_play_status_t;
223c045af99SMilanka Ringwald 
224c045af99SMilanka Ringwald typedef enum {
225be32e7f1SMilanka Ringwald     AVCTP_CONNECTION_IDLE,
2266086246cSMilanka Ringwald     AVCTP_SIGNALING_W4_SDP_QUERY_COMPLETE,
227be32e7f1SMilanka Ringwald     AVCTP_CONNECTION_W4_L2CAP_CONNECTED,
228be32e7f1SMilanka Ringwald     AVCTP_CONNECTION_OPENED,
229be32e7f1SMilanka Ringwald     AVCTP_W2_SEND_PRESS_COMMAND,
230be32e7f1SMilanka Ringwald     AVCTP_W2_SEND_RELEASE_COMMAND,
231be32e7f1SMilanka Ringwald     AVCTP_W4_STOP,
232be32e7f1SMilanka Ringwald     AVCTP_W2_SEND_COMMAND,
2334b338011SMilanka Ringwald     AVCTP_W2_SEND_RESPONSE,
234be32e7f1SMilanka Ringwald     AVCTP_W2_RECEIVE_PRESS_RESPONSE,
235294335f1SMilanka Ringwald     AVCTP_W2_RECEIVE_RESPONSE
236be32e7f1SMilanka Ringwald } avctp_connection_state_t;
237be32e7f1SMilanka Ringwald 
238be32e7f1SMilanka Ringwald typedef struct {
239*fe8b7800SMilanka Ringwald     uint16_t len;
240*fe8b7800SMilanka Ringwald     uint8_t  * value;
241*fe8b7800SMilanka Ringwald } avrcp_now_playing_info_item_t;
242*fe8b7800SMilanka Ringwald 
243*fe8b7800SMilanka Ringwald typedef struct {
244be32e7f1SMilanka Ringwald     btstack_linked_item_t    item;
245be32e7f1SMilanka Ringwald     bd_addr_t remote_addr;
246be32e7f1SMilanka Ringwald     uint16_t l2cap_signaling_cid;
2476086246cSMilanka Ringwald     uint16_t avrcp_cid;
248be32e7f1SMilanka Ringwald 
249be32e7f1SMilanka Ringwald     avctp_connection_state_t state;
250be32e7f1SMilanka Ringwald     uint8_t wait_to_send;
251be32e7f1SMilanka Ringwald 
252be32e7f1SMilanka Ringwald     // command
253be32e7f1SMilanka Ringwald     uint8_t transaction_label;
2549cc1f3ceSMilanka Ringwald     avrcp_command_opcode_t command_opcode;
255be32e7f1SMilanka Ringwald     avrcp_command_type_t command_type;
256be32e7f1SMilanka Ringwald     avrcp_subunit_type_t subunit_type;
257be32e7f1SMilanka Ringwald     avrcp_subunit_id_t   subunit_id;
258be32e7f1SMilanka Ringwald     uint8_t cmd_operands[20];
259adcdded9SMilanka Ringwald     uint8_t cmd_operands_length;
260be32e7f1SMilanka Ringwald     btstack_timer_source_t press_and_hold_cmd_timer;
261d1845da3SMilanka Ringwald     uint8_t  continuous_fast_forward_cmd;
262be32e7f1SMilanka Ringwald     uint16_t notifications_enabled;
263be32e7f1SMilanka Ringwald     uint16_t notifications_to_register;
264be32e7f1SMilanka Ringwald     uint16_t notifications_to_deregister;
265*fe8b7800SMilanka Ringwald 
266*fe8b7800SMilanka Ringwald     avrcp_now_playing_info_item_t now_playing_info[AVRCP_MEDIA_ATTR_COUNT];
267*fe8b7800SMilanka Ringwald     uint32_t song_length_ms;
268*fe8b7800SMilanka Ringwald     int total_tracks;
269*fe8b7800SMilanka Ringwald     int track_nr;
270*fe8b7800SMilanka Ringwald     // used for fragmentation
271*fe8b7800SMilanka Ringwald     int offset;
272*fe8b7800SMilanka Ringwald     int total_num_bytes;
273*fe8b7800SMilanka Ringwald     uint8_t now_playing_info_response;
274be32e7f1SMilanka Ringwald } avrcp_connection_t;
275be32e7f1SMilanka Ringwald 
276be32e7f1SMilanka Ringwald typedef enum {
277d5ff3b26SMatthias Ringwald     AVRCP_SHUFFLE_MODE_INVALID,
278d5ff3b26SMatthias Ringwald     AVRCP_SHUFFLE_MODE_OFF,
279be32e7f1SMilanka Ringwald     AVRCP_SHUFFLE_MODE_ALL_TRACKS,
280be32e7f1SMilanka Ringwald     AVRCP_SHUFFLE_MODE_GROUP
281be32e7f1SMilanka Ringwald } avrcp_shuffle_mode_t;
282be32e7f1SMilanka Ringwald 
283be32e7f1SMilanka Ringwald typedef enum {
284d5ff3b26SMatthias Ringwald     AVRCP_REPEAT_MODE_INVALID,
285d5ff3b26SMatthias Ringwald     AVRCP_REPEAT_MODE_OFF,
286be32e7f1SMilanka Ringwald     AVRCP_REPEAT_MODE_SINGLE_TRACK,
287be32e7f1SMilanka Ringwald     AVRCP_REPEAT_MODE_ALL_TRACKS,
288be32e7f1SMilanka Ringwald     AVRCP_REPEAT_MODE_GROUP
289be32e7f1SMilanka Ringwald } avrcp_repeat_mode_t;
290be32e7f1SMilanka Ringwald 
2916086246cSMilanka Ringwald typedef enum{
2926086246cSMilanka Ringwald     AVRCP_CONTROLLER = 0,
2936086246cSMilanka Ringwald     AVRCP_TARGET
2946086246cSMilanka Ringwald } avrcp_role_t;
2956086246cSMilanka Ringwald 
296*fe8b7800SMilanka Ringwald typedef enum {
297*fe8b7800SMilanka Ringwald     UTF8 = 106
298*fe8b7800SMilanka Ringwald } rfc2978_charset_mib_enumid_t;
299*fe8b7800SMilanka Ringwald 
3006086246cSMilanka Ringwald typedef struct {
3016086246cSMilanka Ringwald     avrcp_role_t role;
3026086246cSMilanka Ringwald     btstack_linked_list_t connections;
3036086246cSMilanka Ringwald     btstack_packet_handler_t avrcp_callback;
3046086246cSMilanka Ringwald     btstack_packet_handler_t packet_handler;
3056086246cSMilanka Ringwald 
3066983e65eSMilanka Ringwald     // SDP query
3076983e65eSMilanka Ringwald     uint16_t avrcp_cid;
308df642728SMilanka Ringwald     uint16_t avrcp_l2cap_psm;
309df642728SMilanka Ringwald     uint16_t avrcp_version;
310227d16a5SMatthias Ringwald     uint16_t avrcp_browsing_l2cap_psm;
311227d16a5SMatthias Ringwald     uint16_t avrcp_browsing_version;
312df642728SMilanka Ringwald     uint8_t  role_supported;
3136983e65eSMilanka Ringwald } avrcp_context_t;
314be32e7f1SMilanka Ringwald 
315be32e7f1SMilanka Ringwald const char * avrcp_subunit2str(uint16_t index);
316be32e7f1SMilanka Ringwald const char * avrcp_event2str(uint16_t index);
317be32e7f1SMilanka Ringwald const char * avrcp_operation2str(uint8_t index);
318be32e7f1SMilanka Ringwald const char * avrcp_attribute2str(uint8_t index);
319be32e7f1SMilanka Ringwald const char * avrcp_play_status2str(uint8_t index);
320be32e7f1SMilanka Ringwald const char * avrcp_ctype2str(uint8_t index);
321be32e7f1SMilanka Ringwald const char * avrcp_repeat2str(uint8_t index);
322be32e7f1SMilanka Ringwald const char * avrcp_shuffle2str(uint8_t index);
323be32e7f1SMilanka Ringwald 
3246983e65eSMilanka Ringwald void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, avrcp_context_t * context);
3256983e65eSMilanka Ringwald 
3266983e65eSMilanka 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);
3276983e65eSMilanka Ringwald uint8_t avrcp_connect(bd_addr_t bd_addr, avrcp_context_t * context, uint16_t * avrcp_cid);
3286983e65eSMilanka Ringwald void avrcp_emit_connection_established(btstack_packet_handler_t callback, uint16_t avrcp_cid, bd_addr_t addr, uint8_t status);
3296983e65eSMilanka Ringwald void avrcp_emit_connection_closed(btstack_packet_handler_t callback, uint16_t avrcp_cid);
3306983e65eSMilanka Ringwald 
3314b338011SMilanka Ringwald uint8_t avrcp_cmd_opcode(uint8_t *packet, uint16_t size);
3326983e65eSMilanka Ringwald avrcp_connection_t * get_avrcp_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid, avrcp_context_t * context);
33301dc6e35SMilanka Ringwald avrcp_connection_t * get_avrcp_connection_for_avrcp_cid(uint16_t avrcp_cid, avrcp_context_t * context);
3346983e65eSMilanka Ringwald void avrcp_request_can_send_now(avrcp_connection_t * connection, uint16_t l2cap_cid);
3356983e65eSMilanka Ringwald 
336be32e7f1SMilanka Ringwald #if defined __cplusplus
337be32e7f1SMilanka Ringwald }
338be32e7f1SMilanka Ringwald #endif
339be32e7f1SMilanka Ringwald 
340be32e7f1SMilanka Ringwald #endif // __AVRCP_H