LCOV - code coverage report
Current view: top level - zephyr/bluetooth/classic - avrcp.h Hit Total Coverage
Test: new.info Lines: 12 19 63.2 %
Date: 2024-12-22 00:14:23

          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             : /** @brief AVRCP structure */
      20             : struct bt_avrcp;
      21             : 
      22           0 : struct bt_avrcp_unit_info_rsp {
      23           0 :         uint8_t unit_type;
      24           0 :         uint32_t company_id;
      25             : };
      26             : 
      27           0 : struct bt_avrcp_subunit_info_rsp {
      28           0 :         uint8_t subunit_type;
      29           0 :         uint8_t max_subunit_id;
      30           1 :         const uint8_t *extended_subunit_type; /**< contains max_subunit_id items */
      31           1 :         const uint8_t *extended_subunit_id; /**< contains max_subunit_id items */
      32             : };
      33             : 
      34           0 : struct bt_avrcp_cb {
      35             :         /** @brief An AVRCP connection has been established.
      36             :          *
      37             :          *  This callback notifies the application of an avrcp connection,
      38             :          *  i.e., an AVCTP L2CAP connection.
      39             :          *
      40             :          *  @param avrcp AVRCP connection object.
      41             :          */
      42           1 :         void (*connected)(struct bt_avrcp *avrcp);
      43             :         /** @brief An AVRCP connection has been disconnected.
      44             :          *
      45             :          *  This callback notifies the application that an avrcp connection
      46             :          *  has been disconnected.
      47             :          *
      48             :          *  @param avrcp AVRCP connection object.
      49             :          */
      50           1 :         void (*disconnected)(struct bt_avrcp *avrcp);
      51             :         /** @brief Callback function for bt_avrcp_get_unit_info().
      52             :          *
      53             :          *  Called when the get unit info process is completed.
      54             :          *
      55             :          *  @param avrcp AVRCP connection object.
      56             :          *  @param rsp The response for UNIT INFO command.
      57             :          */
      58           1 :         void (*unit_info_rsp)(struct bt_avrcp *avrcp, struct bt_avrcp_unit_info_rsp *rsp);
      59             :         /** @brief Callback function for bt_avrcp_get_subunit_info().
      60             :          *
      61             :          *  Called when the get subunit info process is completed.
      62             :          *
      63             :          *  @param avrcp AVRCP connection object.
      64             :          *  @param rsp The response for SUBUNIT INFO command.
      65             :          */
      66           1 :         void (*subunit_info_rsp)(struct bt_avrcp *avrcp, struct bt_avrcp_subunit_info_rsp *rsp);
      67             : };
      68             : 
      69             : /** @brief Connect AVRCP.
      70             :  *
      71             :  *  This function is to be called after the conn parameter is obtained by
      72             :  *  performing a GAP procedure. The API is to be used to establish AVRCP
      73             :  *  connection between devices.
      74             :  *
      75             :  *  @param conn Pointer to bt_conn structure.
      76             :  *
      77             :  *  @return pointer to struct bt_avrcp in case of success or NULL in case
      78             :  *  of error.
      79             :  */
      80           1 : struct bt_avrcp *bt_avrcp_connect(struct bt_conn *conn);
      81             : 
      82             : /** @brief Disconnect AVRCP.
      83             :  *
      84             :  *  This function close AVCTP L2CAP connection.
      85             :  *
      86             :  *  @param avrcp The AVRCP instance.
      87             :  *
      88             :  *  @return 0 in case of success or error code in case of error.
      89             :  */
      90           1 : int bt_avrcp_disconnect(struct bt_avrcp *avrcp);
      91             : 
      92             : /** @brief Register callback.
      93             :  *
      94             :  *  Register AVRCP callbacks to monitor the state and interact with the remote device.
      95             :  *
      96             :  *  @param cb The callback function.
      97             :  *
      98             :  *  @return 0 in case of success or error code in case of error.
      99             :  */
     100           1 : int bt_avrcp_register_cb(const struct bt_avrcp_cb *cb);
     101             : 
     102             : /** @brief Get AVRCP Unit Info.
     103             :  *
     104             :  *  This function obtains information that pertains to the AV/C unit as a whole.
     105             :  *
     106             :  *  @param avrcp The AVRCP instance.
     107             :  *
     108             :  *  @return 0 in case of success or error code in case of error.
     109             :  */
     110           1 : int bt_avrcp_get_unit_info(struct bt_avrcp *avrcp);
     111             : 
     112             : /** @brief Get AVRCP Subunit Info.
     113             :  *
     114             :  *  This function obtains information about the subunit(s) of an AV/C unit. A device with AVRCP
     115             :  *  may support other subunits than the panel subunit if other profiles co-exist in the device.
     116             :  *
     117             :  *  @param avrcp The AVRCP instance.
     118             :  *
     119             :  *  @return 0 in case of success or error code in case of error.
     120             :  */
     121           1 : int bt_avrcp_get_subunit_info(struct bt_avrcp *avrcp);
     122             : 
     123             : #ifdef __cplusplus
     124             : }
     125             : #endif
     126             : 
     127             : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_ */

Generated by: LCOV version 1.14