avrcp.h (d1cf25b11e8f9d3621cc2b6bcd38f0673528617e) | avrcp.h (665a00cb2a19afbc8656616d55848cad7bec956a) |
---|---|
1/* 2 * Copyright (C) 2016 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 32 unchanged lines hidden (view full) --- 41 * Audio/Video Remote Control Profile 42 * 43 */ 44 45#ifndef AVRCP_H 46#define AVRCP_H 47 48#include <stdint.h> | 1/* 2 * Copyright (C) 2016 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 32 unchanged lines hidden (view full) --- 41 * Audio/Video Remote Control Profile 42 * 43 */ 44 45#ifndef AVRCP_H 46#define AVRCP_H 47 48#include <stdint.h> |
49 |
|
49#include "btstack_run_loop.h" 50#include "btstack_linked_list.h" 51#include "l2cap.h" 52 53#if defined __cplusplus 54extern "C" { 55#endif 56 | 50#include "btstack_run_loop.h" 51#include "btstack_linked_list.h" 52#include "l2cap.h" 53 54#if defined __cplusplus 55extern "C" { 56#endif 57 |
58#define PSM_AVCTP_BROWSING 0x001b 59 60#define AVRCP_BROWSING_ITEM_HEADER_LEN 3 61#define AVRCP_BROWSING_MAX_NUM_ATTR_IDS 8 62 |
|
57#define BT_SIG_COMPANY_ID 0x001958 58#define AVRCP_MEDIA_ATTR_COUNT 7 59#define AVRCP_MAX_ATTRIBUTTE_SIZE 100 60#define AVRCP_ATTRIBUTE_HEADER_LEN 8 61#define AVRCP_MAX_FOLDER_NAME_SIZE 20 62 63#define AVRCP_NO_TRACK_SELECTED_PLAYBACK_POSITION_CHANGED 0xFFFFFFFF | 63#define BT_SIG_COMPANY_ID 0x001958 64#define AVRCP_MEDIA_ATTR_COUNT 7 65#define AVRCP_MAX_ATTRIBUTTE_SIZE 100 66#define AVRCP_ATTRIBUTE_HEADER_LEN 8 67#define AVRCP_MAX_FOLDER_NAME_SIZE 20 68 69#define AVRCP_NO_TRACK_SELECTED_PLAYBACK_POSITION_CHANGED 0xFFFFFFFF |
64// #define AVRCP_NO_TRACK_SELECTED_TRACK_CHANGED 0xFFFFFFFFFFFFFFFF | |
65 | 70 |
66#define AVRCP_BROWSING_ITEM_HEADER_LEN 3 67 | |
68typedef enum { 69 AVRCP_STATUS_INVALID_COMMAND = 0, // sent if TG received a PDU that it did not understand. 70 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. 71 AVRCP_STATUS_SPECIFIED_PARAMETER_NOT_FOUND, // sent if the parameter ID is understood, but content is wrong or corrupted. 72 AVRCP_STATUS_INTERNAL_ERROR, // sent if there are error conditions not covered by a more specific error code. 73 AVRCP_STATUS_SUCCESS, // sent if the operation was successful. 74 AVRCP_STATUS_UID_CHANGED, // sent if the UIDs on the device have changed. 75 AVRCP_STATUS_RESERVED_6, --- 29 unchanged lines hidden (view full) --- 105} avrcp_frame_type_t; 106 107 108typedef enum { 109 AVRCP_CAPABILITY_ID_COMPANY = 0x02, 110 AVRCP_CAPABILITY_ID_EVENT = 0x03 111} avrcp_capability_id_t; 112 | 71typedef enum { 72 AVRCP_STATUS_INVALID_COMMAND = 0, // sent if TG received a PDU that it did not understand. 73 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. 74 AVRCP_STATUS_SPECIFIED_PARAMETER_NOT_FOUND, // sent if the parameter ID is understood, but content is wrong or corrupted. 75 AVRCP_STATUS_INTERNAL_ERROR, // sent if there are error conditions not covered by a more specific error code. 76 AVRCP_STATUS_SUCCESS, // sent if the operation was successful. 77 AVRCP_STATUS_UID_CHANGED, // sent if the UIDs on the device have changed. 78 AVRCP_STATUS_RESERVED_6, --- 29 unchanged lines hidden (view full) --- 108} avrcp_frame_type_t; 109 110 111typedef enum { 112 AVRCP_CAPABILITY_ID_COMPANY = 0x02, 113 AVRCP_CAPABILITY_ID_EVENT = 0x03 114} avrcp_capability_id_t; 115 |
113#define AVRCP_BROWSING_MAX_NUM_ATTR_IDS 8 | |
114typedef enum { 115 AVRCP_MEDIA_ATTR_ALL = 0x0000, 116 AVRCP_MEDIA_ATTR_TITLE, 117 AVRCP_MEDIA_ATTR_ARTIST, 118 AVRCP_MEDIA_ATTR_ALBUM, 119 AVRCP_MEDIA_ATTR_TRACK, 120 AVRCP_MEDIA_ATTR_TOTAL_NUM_ITEMS, 121 AVRCP_MEDIA_ATTR_GENRE, --- 171 unchanged lines hidden (view full) --- 293 AVCTP_W4_STOP, 294 AVCTP_W2_SEND_COMMAND, 295 AVCTP_W2_SEND_RESPONSE, 296 AVCTP_W2_RECEIVE_PRESS_RESPONSE, 297 AVCTP_W2_RECEIVE_RESPONSE, 298 AVCTP_W2_SEND_FRAGMENTED_COMMAND, 299} avctp_connection_state_t; 300 | 116typedef enum { 117 AVRCP_MEDIA_ATTR_ALL = 0x0000, 118 AVRCP_MEDIA_ATTR_TITLE, 119 AVRCP_MEDIA_ATTR_ARTIST, 120 AVRCP_MEDIA_ATTR_ALBUM, 121 AVRCP_MEDIA_ATTR_TRACK, 122 AVRCP_MEDIA_ATTR_TOTAL_NUM_ITEMS, 123 AVRCP_MEDIA_ATTR_GENRE, --- 171 unchanged lines hidden (view full) --- 295 AVCTP_W4_STOP, 296 AVCTP_W2_SEND_COMMAND, 297 AVCTP_W2_SEND_RESPONSE, 298 AVCTP_W2_RECEIVE_PRESS_RESPONSE, 299 AVCTP_W2_RECEIVE_RESPONSE, 300 AVCTP_W2_SEND_FRAGMENTED_COMMAND, 301} avctp_connection_state_t; 302 |
301typedef enum { 302 AVRCP_BROWSING_MEDIA_PLAYER_LIST = 0x00, 303 AVRCP_BROWSING_MEDIA_PLAYER_VIRTUAL_FILESYSTEM, 304 AVRCP_BROWSING_SEARCH, 305 AVRCP_BROWSING_NOW_PLAYING 306} avrcp_browsing_scope_t; 307 | |
308typedef struct { 309 uint16_t len; 310 uint8_t * value; 311} avrcp_now_playing_info_item_t; 312 313typedef struct { 314 uint8_t track_id[8]; 315 uint16_t track_nr; --- 12 unchanged lines hidden (view full) --- 328} avrcp_parser_state_t; 329 330 331typedef enum{ 332 AVRCP_CONTROLLER = 0, 333 AVRCP_TARGET 334} avrcp_role_t; 335 | 303typedef struct { 304 uint16_t len; 305 uint8_t * value; 306} avrcp_now_playing_info_item_t; 307 308typedef struct { 309 uint8_t track_id[8]; 310 uint16_t track_nr; --- 12 unchanged lines hidden (view full) --- 323} avrcp_parser_state_t; 324 325 326typedef enum{ 327 AVRCP_CONTROLLER = 0, 328 AVRCP_TARGET 329} avrcp_role_t; 330 |
331typedef enum { 332 AVRCP_SHUFFLE_MODE_INVALID, 333 AVRCP_SHUFFLE_MODE_OFF, 334 AVRCP_SHUFFLE_MODE_ALL_TRACKS, 335 AVRCP_SHUFFLE_MODE_GROUP 336} avrcp_shuffle_mode_t; 337 338typedef enum { 339 AVRCP_REPEAT_MODE_INVALID, 340 AVRCP_REPEAT_MODE_OFF, 341 AVRCP_REPEAT_MODE_SINGLE_TRACK, 342 AVRCP_REPEAT_MODE_ALL_TRACKS, 343 AVRCP_REPEAT_MODE_GROUP 344} avrcp_repeat_mode_t; 345 346typedef enum { 347 RFC2978_CHARSET_MIB_UTF8 = 106 348} rfc2978_charset_mib_enumid_t; 349 350typedef enum { 351 AVRCP_BROWSING_MEDIA_PLAYER_LIST = 0x00, 352 AVRCP_BROWSING_MEDIA_PLAYER_VIRTUAL_FILESYSTEM, 353 AVRCP_BROWSING_SEARCH, 354 AVRCP_BROWSING_NOW_PLAYING 355} avrcp_browsing_scope_t; 356 357 358 359 |
|
336// BROWSING 337typedef struct { 338 uint16_t l2cap_browsing_cid; 339 340 avctp_connection_state_t state; 341 bool wait_to_send; 342 uint8_t transaction_label; 343 // used for AVCTP fragmentation --- 56 unchanged lines hidden (view full) --- 400 avrcp_subunit_type_t subunit_type; 401 avrcp_subunit_id_t subunit_id; 402 avrcp_packet_type_t packet_type; 403 uint8_t cmd_operands[200]; 404 uint8_t cmd_operands_length; 405 406 bool incoming_declined; 407} avrcp_browsing_connection_t; | 360// BROWSING 361typedef struct { 362 uint16_t l2cap_browsing_cid; 363 364 avctp_connection_state_t state; 365 bool wait_to_send; 366 uint8_t transaction_label; 367 // used for AVCTP fragmentation --- 56 unchanged lines hidden (view full) --- 424 avrcp_subunit_type_t subunit_type; 425 avrcp_subunit_id_t subunit_id; 426 avrcp_packet_type_t packet_type; 427 uint8_t cmd_operands[200]; 428 uint8_t cmd_operands_length; 429 430 bool incoming_declined; 431} avrcp_browsing_connection_t; |
408// BROWSING END | |
409 410typedef struct { 411 btstack_linked_item_t item; 412 413 avrcp_role_t role; 414 bd_addr_t remote_addr; 415 uint16_t avrcp_l2cap_psm; 416 uint16_t l2cap_signaling_cid; --- 92 unchanged lines hidden (view full) --- 509 uint16_t uid_counter; 510 // PTS requires definition of max num fragments 511 uint8_t max_num_fragments; 512 uint8_t num_received_fragments; 513 514 uint8_t accept_response; 515} avrcp_connection_t; 516 | 432 433typedef struct { 434 btstack_linked_item_t item; 435 436 avrcp_role_t role; 437 bd_addr_t remote_addr; 438 uint16_t avrcp_l2cap_psm; 439 uint16_t l2cap_signaling_cid; --- 92 unchanged lines hidden (view full) --- 532 uint16_t uid_counter; 533 // PTS requires definition of max num fragments 534 uint8_t max_num_fragments; 535 uint8_t num_received_fragments; 536 537 uint8_t accept_response; 538} avrcp_connection_t; 539 |
517typedef enum { 518 AVRCP_SHUFFLE_MODE_INVALID, 519 AVRCP_SHUFFLE_MODE_OFF, 520 AVRCP_SHUFFLE_MODE_ALL_TRACKS, 521 AVRCP_SHUFFLE_MODE_GROUP 522} avrcp_shuffle_mode_t; 523 524typedef enum { 525 AVRCP_REPEAT_MODE_INVALID, 526 AVRCP_REPEAT_MODE_OFF, 527 AVRCP_REPEAT_MODE_SINGLE_TRACK, 528 AVRCP_REPEAT_MODE_ALL_TRACKS, 529 AVRCP_REPEAT_MODE_GROUP 530} avrcp_repeat_mode_t; 531 532typedef enum { 533 RFC2978_CHARSET_MIB_UTF8 = 106 534} rfc2978_charset_mib_enumid_t; 535 | |
536typedef struct { 537 avrcp_role_t role; 538 btstack_packet_handler_t avrcp_callback; 539 btstack_packet_handler_t packet_handler; 540 541 bool (*set_addressed_player_callback)(uint16_t player_id); 542 543 btstack_packet_handler_t browsing_avrcp_callback; --- 130 unchanged lines hidden --- | 540typedef struct { 541 avrcp_role_t role; 542 btstack_packet_handler_t avrcp_callback; 543 btstack_packet_handler_t packet_handler; 544 545 bool (*set_addressed_player_callback)(uint16_t player_id); 546 547 btstack_packet_handler_t browsing_avrcp_callback; --- 130 unchanged lines hidden --- |