LCOV - code coverage report
Current view: top level - zephyr/bluetooth/classic - avrcp.h Coverage Total Hit
Test: new.info Lines: 63.4 % 71 45
Test Date: 2025-09-05 16:43:28

            Line data    Source code
       1            1 : /** @file
       2              :  *  @brief Audio Video Remote Control Profile header.
       3              :  */
       4              : 
       5              : /*
       6              :  * Copyright (c) 2015-2016 Intel Corporation
       7              :  * Copyright (C) 2024 Xiaomi Corporation
       8              :  *
       9              :  * SPDX-License-Identifier: Apache-2.0
      10              :  */
      11              : 
      12              : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_
      13              : #define ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_
      14              : 
      15              : #ifdef __cplusplus
      16              : extern "C" {
      17              : #endif
      18              : 
      19            0 : #define BT_AVRCP_COMPANY_ID_SIZE          (3)
      20            0 : #define BT_AVRCP_COMPANY_ID_BLUETOOTH_SIG (0x001958)
      21              : 
      22              : /** @brief AVRCP Capability ID */
      23            0 : typedef enum __packed {
      24              :         BT_AVRCP_CAP_COMPANY_ID = 0x2,
      25              :         BT_AVRCP_CAP_EVENTS_SUPPORTED = 0x3,
      26              : } bt_avrcp_cap_t;
      27              : 
      28              : /** @brief AVRCP Notification Events */
      29            0 : typedef enum __packed {
      30              :         BT_AVRCP_EVT_PLAYBACK_STATUS_CHANGED = 0x01,
      31              :         BT_AVRCP_EVT_TRACK_CHANGED = 0x02,
      32              :         BT_AVRCP_EVT_TRACK_REACHED_END = 0x03,
      33              :         BT_AVRCP_EVT_TRACK_REACHED_START = 0x04,
      34              :         BT_AVRCP_EVT_PLAYBACK_POS_CHANGED = 0x05,
      35              :         BT_AVRCP_EVT_BATT_STATUS_CHANGED = 0x06,
      36              :         BT_AVRCP_EVT_SYSTEM_STATUS_CHANGED = 0x07,
      37              :         BT_AVRCP_EVT_PLAYER_APP_SETTING_CHANGED = 0x08,
      38              :         BT_AVRCP_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09,
      39              :         BT_AVRCP_EVT_AVAILABLE_PLAYERS_CHANGED = 0x0a,
      40              :         BT_AVRCP_EVT_ADDRESSED_PLAYER_CHANGED = 0x0b,
      41              :         BT_AVRCP_EVT_UIDS_CHANGED = 0x0c,
      42              :         BT_AVRCP_EVT_VOLUME_CHANGED = 0x0d,
      43              : } bt_avrcp_evt_t;
      44              : 
      45              : /** @brief AV/C command types */
      46            0 : typedef enum __packed {
      47              :         BT_AVRCP_CTYPE_CONTROL = 0x0,
      48              :         BT_AVRCP_CTYPE_STATUS = 0x1,
      49              :         BT_AVRCP_CTYPE_SPECIFIC_INQUIRY = 0x2,
      50              :         BT_AVRCP_CTYPE_NOTIFY = 0x3,
      51              :         BT_AVRCP_CTYPE_GENERAL_INQUIRY = 0x4,
      52              : } bt_avrcp_ctype_t;
      53              : 
      54              : /** @brief AV/C response codes */
      55            0 : typedef enum __packed {
      56              :         BT_AVRCP_RSP_NOT_IMPLEMENTED = 0x8,
      57              :         BT_AVRCP_RSP_ACCEPTED = 0x9,
      58              :         BT_AVRCP_RSP_REJECTED = 0xa,
      59              :         BT_AVRCP_RSP_IN_TRANSITION = 0xb,
      60              :         BT_AVRCP_RSP_IMPLEMENTED = 0xc, /**< For SPECIFIC_INQUIRY and GENERAL_INQUIRY commands */
      61              :         BT_AVRCP_RSP_STABLE = 0xc,      /**< For STATUS commands */
      62              :         BT_AVRCP_RSP_CHANGED = 0xd,
      63              :         BT_AVRCP_RSP_INTERIM = 0xf,
      64              : } bt_avrcp_rsp_t;
      65              : 
      66              : /** @brief AV/C subunit type, also used for unit type */
      67            0 : typedef enum __packed {
      68              :         BT_AVRCP_SUBUNIT_TYPE_PANEL = 0x09,
      69              :         BT_AVRCP_SUBUNIT_TYPE_UNIT = 0x1f,
      70              : } bt_avrcp_subunit_type_t;
      71              : 
      72              : /** @brief AV/C operation ids used in AVRCP passthrough commands */
      73            0 : typedef enum __packed {
      74              :         BT_AVRCP_OPID_SELECT = 0x00,
      75              :         BT_AVRCP_OPID_UP = 0x01,
      76              :         BT_AVRCP_OPID_DOWN = 0x02,
      77              :         BT_AVRCP_OPID_LEFT = 0x03,
      78              :         BT_AVRCP_OPID_RIGHT = 0x04,
      79              :         BT_AVRCP_OPID_RIGHT_UP = 0x05,
      80              :         BT_AVRCP_OPID_RIGHT_DOWN = 0x06,
      81              :         BT_AVRCP_OPID_LEFT_UP = 0x07,
      82              :         BT_AVRCP_OPID_LEFT_DOWN = 0x08,
      83              :         BT_AVRCP_OPID_ROOT_MENU = 0x09,
      84              :         BT_AVRCP_OPID_SETUP_MENU = 0x0a,
      85              :         BT_AVRCP_OPID_CONTENTS_MENU = 0x0b,
      86              :         BT_AVRCP_OPID_FAVORITE_MENU = 0x0c,
      87              :         BT_AVRCP_OPID_EXIT = 0x0d,
      88              : 
      89              :         BT_AVRCP_OPID_0 = 0x20,
      90              :         BT_AVRCP_OPID_1 = 0x21,
      91              :         BT_AVRCP_OPID_2 = 0x22,
      92              :         BT_AVRCP_OPID_3 = 0x23,
      93              :         BT_AVRCP_OPID_4 = 0x24,
      94              :         BT_AVRCP_OPID_5 = 0x25,
      95              :         BT_AVRCP_OPID_6 = 0x26,
      96              :         BT_AVRCP_OPID_7 = 0x27,
      97              :         BT_AVRCP_OPID_8 = 0x28,
      98              :         BT_AVRCP_OPID_9 = 0x29,
      99              :         BT_AVRCP_OPID_DOT = 0x2a,
     100              :         BT_AVRCP_OPID_ENTER = 0x2b,
     101              :         BT_AVRCP_OPID_CLEAR = 0x2c,
     102              : 
     103              :         BT_AVRCP_OPID_CHANNEL_UP = 0x30,
     104              :         BT_AVRCP_OPID_CHANNEL_DOWN = 0x31,
     105              :         BT_AVRCP_OPID_PREVIOUS_CHANNEL = 0x32,
     106              :         BT_AVRCP_OPID_SOUND_SELECT = 0x33,
     107              :         BT_AVRCP_OPID_INPUT_SELECT = 0x34,
     108              :         BT_AVRCP_OPID_DISPLAY_INFORMATION = 0x35,
     109              :         BT_AVRCP_OPID_HELP = 0x36,
     110              :         BT_AVRCP_OPID_PAGE_UP = 0x37,
     111              :         BT_AVRCP_OPID_PAGE_DOWN = 0x38,
     112              : 
     113              :         BT_AVRCP_OPID_POWER = 0x40,
     114              :         BT_AVRCP_OPID_VOLUME_UP = 0x41,
     115              :         BT_AVRCP_OPID_VOLUME_DOWN = 0x42,
     116              :         BT_AVRCP_OPID_MUTE = 0x43,
     117              :         BT_AVRCP_OPID_PLAY = 0x44,
     118              :         BT_AVRCP_OPID_STOP = 0x45,
     119              :         BT_AVRCP_OPID_PAUSE = 0x46,
     120              :         BT_AVRCP_OPID_RECORD = 0x47,
     121              :         BT_AVRCP_OPID_REWIND = 0x48,
     122              :         BT_AVRCP_OPID_FAST_FORWARD = 0x49,
     123              :         BT_AVRCP_OPID_EJECT = 0x4a,
     124              :         BT_AVRCP_OPID_FORWARD = 0x4b,
     125              :         BT_AVRCP_OPID_BACKWARD = 0x4c,
     126              : 
     127              :         BT_AVRCP_OPID_ANGLE = 0x50,
     128              :         BT_AVRCP_OPID_SUBPICTURE = 0x51,
     129              : 
     130              :         BT_AVRCP_OPID_F1 = 0x71,
     131              :         BT_AVRCP_OPID_F2 = 0x72,
     132              :         BT_AVRCP_OPID_F3 = 0x73,
     133              :         BT_AVRCP_OPID_F4 = 0x74,
     134              :         BT_AVRCP_OPID_F5 = 0x75,
     135              :         BT_AVRCP_OPID_VENDOR_UNIQUE = 0x7e,
     136              : } bt_avrcp_opid_t;
     137              : 
     138              : /** @brief AVRCP button state flag */
     139            0 : typedef enum __packed {
     140              :         BT_AVRCP_BUTTON_PRESSED = 0,
     141              :         BT_AVRCP_BUTTON_RELEASED = 1,
     142              : } bt_avrcp_button_state_t;
     143              : 
     144              : /**
     145              :  * @brief AVRCP status and error codes.
     146              :  *
     147              :  * These status codes are used in AVRCP responses to indicate the result of a command.
     148              :  */
     149            1 : typedef enum __packed {
     150              :         /** Invalid command.
     151              :          * Valid for Commands: All
     152              :          */
     153              :         BT_AVRCP_STATUS_INVALID_COMMAND = 0x00,
     154              : 
     155              :         /** Invalid parameter.
     156              :          * Valid for Commands: All
     157              :          */
     158              :         BT_AVRCP_STATUS_INVALID_PARAMETER = 0x01,
     159              : 
     160              :         /** Parameter content error.
     161              :          * Valid for Commands: All
     162              :          */
     163              :         BT_AVRCP_STATUS_PARAMETER_CONTENT_ERROR = 0x02,
     164              : 
     165              :         /** Internal error.
     166              :          * Valid for Commands: All
     167              :          */
     168              :         BT_AVRCP_STATUS_INTERNAL_ERROR = 0x03,
     169              : 
     170              :         /** Operation completed without error.
     171              :          * Valid for Commands: All except where the response CType is AV/C REJECTED
     172              :          */
     173              :         BT_AVRCP_STATUS_OPERATION_COMPLETED = 0x04,
     174              : 
     175              :         /** The UIDs on the device have changed.
     176              :          * Valid for Commands: All
     177              :          */
     178              :         BT_AVRCP_STATUS_UID_CHANGED = 0x05,
     179              : 
     180              :         /** The Direction parameter is invalid.
     181              :          * Valid for Commands: ChangePath
     182              :          */
     183              :         BT_AVRCP_STATUS_INVALID_DIRECTION = 0x07,
     184              : 
     185              :         /** The UID provided does not refer to a folder item.
     186              :          * Valid for Commands: ChangePath
     187              :          */
     188              :         BT_AVRCP_STATUS_NOT_A_DIRECTORY = 0x08,
     189              : 
     190              :         /** The UID provided does not refer to any currently valid item.
     191              :          * Valid for Commands: ChangePath, PlayItem, AddToNowPlaying, GetItemAttributes
     192              :          */
     193              :         BT_AVRCP_STATUS_DOES_NOT_EXIST = 0x09,
     194              : 
     195              :         /** Invalid scope.
     196              :          * Valid for Commands: GetFolderItems, PlayItem, AddToNowPlayer, GetItemAttributes,
     197              :          * GetTotalNumberOfItems
     198              :          */
     199              :         BT_AVRCP_STATUS_INVALID_SCOPE = 0x0a,
     200              : 
     201              :         /** Range out of bounds.
     202              :          * Valid for Commands: GetFolderItems
     203              :          */
     204              :         BT_AVRCP_STATUS_RANGE_OUT_OF_BOUNDS = 0x0b,
     205              : 
     206              :         /** Folder item is not playable.
     207              :          * Valid for Commands: Play Item, AddToNowPlaying
     208              :          */
     209              :         BT_AVRCP_STATUS_FOLDER_ITEM_IS_NOT_PLAYABLE = 0x0c,
     210              : 
     211              :         /** Media in use.
     212              :          * Valid for Commands: PlayItem, AddToNowPlaying
     213              :          */
     214              :         BT_AVRCP_STATUS_MEDIA_IN_USE = 0x0d,
     215              : 
     216              :         /** Now Playing List full.
     217              :          * Valid for Commands: AddToNowPlaying
     218              :          */
     219              :         BT_AVRCP_STATUS_NOW_PLAYING_LIST_FULL = 0x0e,
     220              : 
     221              :         /** Search not supported.
     222              :          * Valid for Commands: Search
     223              :          */
     224              :         BT_AVRCP_STATUS_SEARCH_NOT_SUPPORTED = 0x0f,
     225              : 
     226              :         /** Search in progress.
     227              :          * Valid for Commands: Search
     228              :          */
     229              :         BT_AVRCP_STATUS_SEARCH_IN_PROGRESS = 0x10,
     230              : 
     231              :         /** The specified Player Id does not refer to a valid player.
     232              :          * Valid for Commands: SetAddressedPlayer, SetBrowsedPlayer
     233              :          */
     234              :         BT_AVRCP_STATUS_INVALID_PLAYER_ID = 0x11,
     235              : 
     236              :         /** Player not browsable.
     237              :          * Valid for Commands: SetBrowsedPlayer
     238              :          */
     239              :         BT_AVRCP_STATUS_PLAYER_NOT_BROWSABLE = 0x12,
     240              : 
     241              :         /** Player not addressed.
     242              :          * Valid for Commands: Search, SetBrowsedPlayer
     243              :          */
     244              :         BT_AVRCP_STATUS_PLAYER_NOT_ADDRESSED = 0x13,
     245              : 
     246              :         /** No valid search results.
     247              :          * Valid for Commands: GetFolderItems
     248              :          */
     249              :         BT_AVRCP_STATUS_NO_VALID_SEARCH_RESULTS = 0x14,
     250              : 
     251              :         /** No available players.
     252              :          * Valid for Commands: ALL
     253              :          */
     254              :         BT_AVRCP_STATUS_NO_AVAILABLE_PLAYERS = 0x15,
     255              : 
     256              :         /** Addressed player changed.
     257              :          * Valid for Commands: All Register Notification commands
     258              :          */
     259              :         BT_AVRCP_STATUS_ADDRESSED_PLAYER_CHANGED = 0x16,
     260              : } bt_avrcp_status_t;
     261              : 
     262              : /** @brief AVRCP CT structure */
     263              : struct bt_avrcp_ct;
     264              : /** @brief AVRCP TG structure */
     265              : struct bt_avrcp_tg;
     266              : 
     267            0 : struct bt_avrcp_unit_info_rsp {
     268            0 :         bt_avrcp_subunit_type_t unit_type;
     269            0 :         uint32_t company_id;
     270              : };
     271              : 
     272            0 : struct bt_avrcp_subunit_info_rsp {
     273            0 :         bt_avrcp_subunit_type_t subunit_type;
     274            0 :         uint8_t max_subunit_id;
     275            1 :         const uint8_t *extended_subunit_type; /**< contains max_subunit_id items */
     276            1 :         const uint8_t *extended_subunit_id;   /**< contains max_subunit_id items */
     277              : };
     278              : 
     279            0 : #define BT_AVRCP_PASSTHROUGH_GET_STATE(payload)                                                    \
     280              :         ((bt_avrcp_button_state_t)(FIELD_GET(BIT(7), ((payload)->byte0))))
     281            0 : #define BT_AVRCP_PASSTHROUGH_GET_OPID(payload)                                                     \
     282              :         ((bt_avrcp_opid_t)(FIELD_GET(GENMASK(6, 0), ((payload)->byte0))))
     283              : 
     284            0 : struct bt_avrcp_passthrough_rsp {
     285            1 :         uint8_t byte0; /**< [7]: state_flag, [6:0]: opid */
     286            0 :         uint8_t data_len;
     287            0 :         uint8_t data[];
     288              : } __packed;
     289              : 
     290            0 : struct bt_avrcp_get_cap_rsp {
     291            1 :         uint8_t cap_id;  /**< bt_avrcp_cap_t */
     292            1 :         uint8_t cap_cnt; /**< number of items contained in *cap */
     293            1 :         uint8_t cap[];   /**< 1 or 3 octets each depends on cap_id */
     294              : } __packed;
     295              : 
     296              : /** @brief AVRCP Character Set IDs */
     297            0 : typedef enum __packed {
     298              :         BT_AVRCP_CHARSET_UTF8 = 0x006a,
     299              : } bt_avrcp_charset_t;
     300              : 
     301              : /** @brief get folder name (response) */
     302            1 : struct bt_avrcp_folder_name {
     303            0 :         uint16_t folder_name_len;
     304            0 :         uint8_t folder_name[];
     305              : } __packed;
     306              : 
     307              : /** @brief Set browsed player response structure */
     308            1 : struct bt_avrcp_set_browsed_player_rsp {
     309            1 :         uint8_t status;                              /**< Status see bt_avrcp_status_t.*/
     310            1 :         uint16_t uid_counter;                        /**< UID counter */
     311            1 :         uint32_t num_items;                          /**< Number of items in the folder */
     312            1 :         uint16_t charset_id;                         /**< Character set ID */
     313            1 :         uint8_t folder_depth;                        /**< Folder depth */
     314            1 :         struct bt_avrcp_folder_name folder_names[0]; /**< Folder names data */
     315              : } __packed;
     316              : 
     317            0 : struct bt_avrcp_ct_cb {
     318              :         /** @brief An AVRCP CT connection has been established.
     319              :          *
     320              :          *  This callback notifies the application of an avrcp connection,
     321              :          *  i.e., an AVCTP L2CAP connection.
     322              :          *
     323              :          *  @param conn Connection object.
     324              :          *  @param ct AVRCP CT connection object.
     325              :          */
     326            1 :         void (*connected)(struct bt_conn *conn, struct bt_avrcp_ct *ct);
     327              : 
     328              :         /** @brief An AVRCP CT connection has been disconnected.
     329              :          *
     330              :          *  This callback notifies the application that an avrcp connection
     331              :          *  has been disconnected.
     332              :          *
     333              :          *  @param ct AVRCP CT connection object.
     334              :          */
     335            1 :         void (*disconnected)(struct bt_avrcp_ct *ct);
     336              : 
     337              :         /** @brief An AVRCP CT browsing connection has been established.
     338              :          *
     339              :          *  This callback notifies the application of an avrcp browsing connection,
     340              :          *  i.e., an AVCTP browsing L2CAP connection.
     341              :          *
     342              :          *  @param conn Connection object.
     343              :          *  @param ct AVRCP CT connection object.
     344              :          */
     345            1 :         void (*browsing_connected)(struct bt_conn *conn, struct bt_avrcp_ct *ct);
     346              : 
     347              :         /** @brief An AVRCP CT browsing connection has been disconnected.
     348              :          *
     349              :          *  This callback notifies the application that an avrcp browsing connection
     350              :          *  has been disconnected.
     351              :          *
     352              :          *  @param ct AVRCP CT connection object.
     353              :          */
     354            1 :         void (*browsing_disconnected)(struct bt_avrcp_ct *ct);
     355              : 
     356              :         /** @brief Callback function for bt_avrcp_get_cap().
     357              :          *
     358              :          *  Called when the get capabilities process is completed.
     359              :          *
     360              :          *  @param ct AVRCP CT connection object.
     361              :          *  @param tid The transaction label of the response.
     362              :          *  @param rsp The response for Get Capabilities command.
     363              :          */
     364            1 :         void (*get_cap_rsp)(struct bt_avrcp_ct *ct, uint8_t tid,
     365              :                             const struct bt_avrcp_get_cap_rsp *rsp);
     366              : 
     367              :         /** @brief Callback function for bt_avrcp_get_unit_info().
     368              :          *
     369              :          *  Called when the get unit info process is completed.
     370              :          *
     371              :          *  @param ct AVRCP CT connection object.
     372              :          *  @param tid The transaction label of the response.
     373              :          *  @param rsp The response for UNIT INFO command.
     374              :          */
     375            1 :         void (*unit_info_rsp)(struct bt_avrcp_ct *ct, uint8_t tid,
     376              :                               struct bt_avrcp_unit_info_rsp *rsp);
     377              : 
     378              :         /** @brief Callback function for bt_avrcp_get_subunit_info().
     379              :          *
     380              :          *  Called when the get subunit info process is completed.
     381              :          *
     382              :          *  @param ct AVRCP CT connection object.
     383              :          *  @param tid The transaction label of the response.
     384              :          *  @param rsp The response for SUBUNIT INFO command.
     385              :          */
     386            1 :         void (*subunit_info_rsp)(struct bt_avrcp_ct *ct, uint8_t tid,
     387              :                                  struct bt_avrcp_subunit_info_rsp *rsp);
     388              : 
     389              :         /** @brief Callback function for bt_avrcp_passthrough().
     390              :          *
     391              :          *  Called when a passthrough response is received.
     392              :          *
     393              :          *  @param ct AVRCP CT connection object.
     394              :          *  @param tid The transaction label of the response.
     395              :          *  @param result The result of the operation.
     396              :          *  @param rsp The response for PASS THROUGH command.
     397              :          */
     398            1 :         void (*passthrough_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, bt_avrcp_rsp_t result,
     399              :                                 const struct bt_avrcp_passthrough_rsp *rsp);
     400              : 
     401              :         /** @brief Callback function for bt_avrcp_ct_set_browsed_player().
     402              :          *
     403              :          *  Called when the set browsed player process is completed.
     404              :          *
     405              :          *  @param ct AVRCP CT connection object.
     406              :          *  @param tid The transaction label of the response.
     407              :          *  @param buf The response buffer containing the set browsed player response data.
     408              :          *             The application can parse this payload according to the format defined in
     409              :          *             @ref bt_avrcp_set_browsed_player_rsp. Note that the data is encoded in
     410              :          *             big-endian format.
     411              :          */
     412            1 :         void (*browsed_player_rsp)(struct bt_avrcp_ct *ct, uint8_t tid, struct net_buf *buf);
     413              : };
     414              : 
     415              : /** @brief Connect AVRCP.
     416              :  *
     417              :  *  This function is to be called after the conn parameter is obtained by
     418              :  *  performing a GAP procedure. The API is to be used to establish AVRCP
     419              :  *  connection between devices.
     420              :  *
     421              :  *  @param conn Pointer to bt_conn structure.
     422              :  *
     423              :  *  @return 0 in case of success or error code in case of error.
     424              :  *
     425              :  */
     426            1 : int bt_avrcp_connect(struct bt_conn *conn);
     427              : 
     428              : /** @brief Disconnect AVRCP.
     429              :  *
     430              :  *  This function close AVCTP L2CAP connection.
     431              :  *
     432              :  *  @param conn Pointer to bt_conn structure.
     433              :  *
     434              :  *  @return 0 in case of success or error code in case of error.
     435              :  */
     436            1 : int bt_avrcp_disconnect(struct bt_conn *conn);
     437              : 
     438              : /**
     439              :  * @brief Allocate a net_buf for AVRCP PDU transmission, reserving headroom
     440              :  *        for AVRCP, AVRCTP, L2CAP, and ACL headers.
     441              :  *
     442              :  * This function allocates a buffer from the specified pool and reserves
     443              :  * sufficient headroom for protocol headers required by AVRCP over Bluetooth.
     444              :  *
     445              :  * @param pool The buffer pool to allocate from.
     446              :  *
     447              :  * @return A newly allocated net_buf with reserved headroom.
     448              :  */
     449            1 : struct net_buf *bt_avrcp_create_pdu(struct net_buf_pool *pool);
     450              : 
     451              : /** @brief Connect AVRCP browsing channel.
     452              :  *
     453              :  *  This function is to be called after the AVRCP control channel is established.
     454              :  *  The API is to be used to establish AVRCP browsing connection between devices.
     455              :  *
     456              :  *  @param conn Pointer to bt_conn structure.
     457              :  *
     458              :  *  @return 0 in case of success or error code in case of error.
     459              :  */
     460            1 : int bt_avrcp_browsing_connect(struct bt_conn *conn);
     461              : 
     462              : /** @brief Disconnect AVRCP browsing channel.
     463              :  *
     464              :  *  This function close AVCTP browsing channel L2CAP connection.
     465              :  *
     466              :  *  @param conn Pointer to bt_conn structure.
     467              :  *
     468              :  *  @return 0 in case of success or error code in case of error.
     469              :  */
     470            1 : int bt_avrcp_browsing_disconnect(struct bt_conn *conn);
     471              : 
     472              : /** @brief Register callback.
     473              :  *
     474              :  *  Register AVRCP callbacks to monitor the state and interact with the remote device.
     475              :  *
     476              :  *  @param cb The AVRCP CT callback function.
     477              :  *
     478              :  *  @return 0 in case of success or error code in case of error.
     479              :  */
     480            1 : int bt_avrcp_ct_register_cb(const struct bt_avrcp_ct_cb *cb);
     481              : 
     482              : /** @brief Get AVRCP Capabilities.
     483              :  *
     484              :  *  This function gets the capabilities supported by remote device.
     485              :  *
     486              :  *  @param ct The AVRCP CT instance.
     487              :  *  @param tid The transaction label of the response, valid from 0 to 15.
     488              :  *  @param cap_id Specific capability requested, see @ref bt_avrcp_cap_t.
     489              :  *
     490              :  *  @return 0 in case of success or error code in case of error.
     491              :  */
     492            1 : int bt_avrcp_ct_get_cap(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t cap_id);
     493              : 
     494              : /** @brief Get AVRCP Unit Info.
     495              :  *
     496              :  *  This function obtains information that pertains to the AV/C unit as a whole.
     497              :  *
     498              :  *  @param ct The AVRCP CT instance.
     499              :  *  @param tid The transaction label of the response, valid from 0 to 15.
     500              :  *
     501              :  *  @return 0 in case of success or error code in case of error.
     502              :  */
     503            1 : int bt_avrcp_ct_get_unit_info(struct bt_avrcp_ct *ct, uint8_t tid);
     504              : 
     505              : /** @brief Get AVRCP Subunit Info.
     506              :  *
     507              :  *  This function obtains information about the subunit(s) of an AV/C unit. A device with AVRCP
     508              :  *  may support other subunits than the panel subunit if other profiles co-exist in the device.
     509              :  *
     510              :  *  @param ct The AVRCP CT instance.
     511              :  *  @param tid The transaction label of the response, valid from 0 to 15.
     512              :  *
     513              :  *  @return 0 in case of success or error code in case of error.
     514              :  */
     515            1 : int bt_avrcp_ct_get_subunit_info(struct bt_avrcp_ct *ct, uint8_t tid);
     516              : 
     517              : /** @brief Send AVRCP Pass Through command.
     518              :  *
     519              :  *  This function send a pass through command to the remote device. Passsthhrough command is used
     520              :  *  to transfer user operation information from a CT to Panel subunit of TG.
     521              :  *
     522              :  *  @param ct The AVRCP CT instance.
     523              :  *  @param tid The transaction label of the response, valid from 0 to 15.
     524              :  *  @param opid The user operation id, see @ref bt_avrcp_opid_t.
     525              :  *  @param state The button state, see @ref bt_avrcp_button_state_t.
     526              :  *  @param payload The payload of the pass through command. Should not be NULL if len is not zero.
     527              :  *  @param len The length of the payload.
     528              :  *
     529              :  *  @return 0 in case of success or error code in case of error.
     530              :  */
     531            1 : int bt_avrcp_ct_passthrough(struct bt_avrcp_ct *ct, uint8_t tid, uint8_t opid, uint8_t state,
     532              :                             const uint8_t *payload, uint8_t len);
     533              : 
     534              : /** @brief Set browsed player.
     535              :  *
     536              :  *  This function sets the browsed player on the remote device.
     537              :  *
     538              :  *  @param ct The AVRCP CT instance.
     539              :  *  @param tid The transaction label of the response, valid from 0 to 15.
     540              :  *  @param player_id The player ID to be set as browsed player.
     541              :  *
     542              :  *  @return 0 in case of success or error code in case of error.
     543              :  */
     544            1 : int bt_avrcp_ct_set_browsed_player(struct bt_avrcp_ct *ct, uint8_t tid, uint16_t player_id);
     545              : 
     546            0 : struct bt_avrcp_tg_cb {
     547              :         /** @brief An AVRCP TG connection has been established.
     548              :          *
     549              :          *  This callback notifies the application of an avrcp connection,
     550              :          *  i.e., an AVCTP L2CAP connection.
     551              :          *
     552              :          *  @param conn Connection object.
     553              :          *  @param tg AVRCP TG connection object.
     554              :          */
     555            1 :         void (*connected)(struct bt_conn *conn, struct bt_avrcp_tg *tg);
     556              : 
     557              :         /** @brief An AVRCP TG connection has been disconnected.
     558              :          *
     559              :          *  This callback notifies the application that an avrcp connection
     560              :          *  has been disconnected.
     561              :          *
     562              :          *  @param tg AVRCP TG connection object.
     563              :          */
     564            1 :         void (*disconnected)(struct bt_avrcp_tg *tg);
     565              : 
     566              :         /** @brief Unit info request callback.
     567              :          *
     568              :          *  This callback is called whenever an AVRCP unit info is requested.
     569              :          *
     570              :          *  @param tid The transaction label of the request.
     571              :          *  @param tg AVRCP TG connection object.
     572              :          */
     573            1 :         void (*unit_info_req)(struct bt_avrcp_tg *tg, uint8_t tid);
     574              : 
     575              :         /** @brief An AVRCP TG browsing connection has been established.
     576              :          *
     577              :          *  This callback notifies the application of an avrcp browsing connection,
     578              :          *  i.e., an AVCTP browsing L2CAP connection.
     579              :          *
     580              :          *  @param conn Connection object.
     581              :          *  @param tg AVRCP TG connection object.
     582              :          */
     583            1 :         void (*browsing_connected)(struct bt_conn *conn, struct bt_avrcp_tg *tg);
     584              : 
     585              :         /** @brief An AVRCP TG browsing connection has been disconnected.
     586              :          *
     587              :          *  This callback notifies the application that an avrcp browsing connection
     588              :          *  has been disconnected.
     589              :          *
     590              :          *  @param tg AVRCP TG connection object.
     591              :          */
     592            1 :         void (*browsing_disconnected)(struct bt_avrcp_tg *tg);
     593              : 
     594              :         /** @brief Set browsed player request callback.
     595              :          *
     596              :          *  This callback is called whenever an AVRCP set browsed player request is received.
     597              :          *
     598              :          *  @param tg AVRCP TG connection object.
     599              :          *  @param tid The transaction label of the request.
     600              :          *  @param player_id The player ID to be set as browsed player.
     601              :          */
     602            1 :         void (*set_browsed_player_req)(struct bt_avrcp_tg *tg, uint8_t tid, uint16_t player_id);
     603              : };
     604              : 
     605              : /** @brief Register callback.
     606              :  *
     607              :  *  Register AVRCP callbacks to monitor the state and interact with the remote device.
     608              :  *
     609              :  *  @param cb The AVRCP TG callback function.
     610              :  *
     611              :  *  @return 0 in case of success or error code in case of error.
     612              :  */
     613            1 : int bt_avrcp_tg_register_cb(const struct bt_avrcp_tg_cb *cb);
     614              : 
     615              : /** @brief Send the unit info response.
     616              :  *
     617              :  *  This function is called by the application to send the unit info response.
     618              :  *
     619              :  *  @param tg The AVRCP TG instance.
     620              :  *  @param tid The transaction label of the response, valid from 0 to 15.
     621              :  *  @param rsp The response for UNIT INFO command.
     622              :  *
     623              :  *  @return 0 in case of success or error code in case of error.
     624              :  */
     625            1 : int bt_avrcp_tg_send_unit_info_rsp(struct bt_avrcp_tg *tg, uint8_t tid,
     626              :                                    struct bt_avrcp_unit_info_rsp *rsp);
     627              : 
     628              : /** @brief Send the set browsed player response.
     629              :  *
     630              :  *  This function is called by the application to send the set browsed player response.
     631              :  *
     632              :  *  @param tg The AVRCP TG instance.
     633              :  *  @param tid The transaction label of the response, valid from 0 to 15.
     634              :  *  @param buf The response buffer containing the set browsed player response data.
     635              :  *
     636              :  *  @return 0 in case of success or error code in case of error.
     637              :  */
     638            1 : int bt_avrcp_tg_send_set_browsed_player_rsp(struct bt_avrcp_tg *tg, uint8_t tid,
     639              :                                             struct net_buf *buf);
     640              : #ifdef __cplusplus
     641              : }
     642              : #endif
     643              : 
     644              : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_ */
        

Generated by: LCOV version 2.0-1