LCOV - code coverage report
Current view: top level - zephyr/bluetooth/classic - avdtp.h Coverage Total Hit
Test: new.info Lines: 95.2 % 21 20
Test Date: 2025-09-05 16:43:28

            Line data    Source code
       1            1 : /** @file
       2              :  * @brief Audio/Video Distribution Transport Protocol header.
       3              :  */
       4              : 
       5              : /*
       6              :  * Copyright (c) 2015-2016 Intel Corporation
       7              :  * Copyright 2024 NXP
       8              :  *
       9              :  * SPDX-License-Identifier: Apache-2.0
      10              :  */
      11              : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_AVDTP_H_
      12              : #define ZEPHYR_INCLUDE_BLUETOOTH_AVDTP_H_
      13              : 
      14              : #ifdef __cplusplus
      15              : extern "C" {
      16              : #endif
      17              : 
      18            1 : #define AVDTP_VERSION_1_3 0x0103 /**< AVDTP version 1.3 value */
      19              : 
      20            1 : #define AVDTP_VERSION AVDTP_VERSION_1_3 /**< AVDTP version used by Zephyr */
      21              : 
      22              : /**
      23              :  * @brief AVDTP error code
      24              :  */
      25            1 : enum bt_avdtp_err_code {
      26              :         /** The response is success, it is not from avdtp spec. */
      27              :         BT_AVDTP_SUCCESS = 0x00,
      28              :         /** The request is time out without response, it is not from avdtp spec. */
      29              :         BT_AVDTP_TIME_OUT = 0xFF,
      30              :         /** The request packet header format error */
      31              :         BT_AVDTP_BAD_HEADER_FORMAT = 0x01,
      32              :         /** The request packet length is not match the assumed length */
      33              :         BT_AVDTP_BAD_LENGTH = 0x11,
      34              :         /** The requested command indicates an invalid ACP SEID (not addressable) */
      35              :         BT_AVDTP_BAD_ACP_SEID = 0x12,
      36              :         /** The SEP is in use */
      37              :         BT_AVDTP_SEP_IN_USE = 0x13,
      38              :         /** The SEP is not in use */
      39              :         BT_AVDTP_SEP_NOT_IN_USE = 0x14,
      40              :         /** The value of Service Category in the request packet is not defined in AVDTP */
      41              :         BT_AVDTP_BAD_SERV_CATEGORY = 0x17,
      42              :         /** The requested command has an incorrect payload format */
      43              :         BT_AVDTP_BAD_PAYLOAD_FORMAT = 0x18,
      44              :         /** The requested command is not supported by the device */
      45              :         BT_AVDTP_NOT_SUPPORTED_COMMAND = 0x19,
      46              :         /** The reconfigure command is an attempt to reconfigure a transport service codec_cap
      47              :          * of the SEP. Reconfigure is only permitted for application service codec_cap
      48              :          */
      49              :         BT_AVDTP_INVALID_CAPABILITIES = 0x1A,
      50              :         /** The requested Recovery Type is not defined in AVDTP */
      51              :         BT_AVDTP_BAD_RECOVERY_TYPE = 0x22,
      52              :         /** The format of Media Transport Capability is not correct */
      53              :         BT_AVDTP_BAD_MEDIA_TRANSPORT_FORMAT = 0x23,
      54              :         /** The format of Recovery Service Capability is not correct */
      55              :         BT_AVDTP_BAD_RECOVERY_FORMAT = 0x25,
      56              :         /** The format of Header Compression Service Capability is not correct */
      57              :         BT_AVDTP_BAD_ROHC_FORMAT = 0x26,
      58              :         /** The format of Content Protection Service Capability is not correct */
      59              :         BT_AVDTP_BAD_CP_FORMAT = 0x27,
      60              :         /** The format of Multiplexing Service Capability is not correct */
      61              :         BT_AVDTP_BAD_MULTIPLEXING_FORMAT = 0x28,
      62              :         /** Configuration not supported */
      63              :         BT_AVDTP_UNSUPPORTED_CONFIGURAION = 0x29,
      64              :         /** Indicates that the ACP state machine is in an invalid state in order to process the
      65              :          * signal. This also includes the situation when an INT receives a request for the
      66              :          * same command that it is currently expecting a response
      67              :          */
      68              :         BT_AVDTP_BAD_STATE = 0x31,
      69              : };
      70              : 
      71              : /** @brief Stream End Point Type */
      72            1 : enum bt_avdtp_sep_type {
      73              :         /** Source Role */
      74              :         BT_AVDTP_SOURCE = 0,
      75              :         /** Sink Role */
      76              :         BT_AVDTP_SINK = 1
      77              : };
      78              : 
      79              : /** @brief Stream End Point Media Type */
      80            1 : enum bt_avdtp_media_type {
      81              :         /** Audio Media Type */
      82              :         BT_AVDTP_AUDIO = 0x00,
      83              :         /** Video Media Type */
      84              :         BT_AVDTP_VIDEO = 0x01,
      85              :         /** Multimedia Media Type */
      86              :         BT_AVDTP_MULTIMEDIA = 0x02
      87              : };
      88              : 
      89              : /** @brief AVDTP stream endpoint information.
      90              :  *  Don't need to care endianness because it is not used for data parsing.
      91              :  */
      92            1 : struct bt_avdtp_sep_info {
      93              :         /** End Point usage status */
      94            1 :         uint8_t inuse: 1;
      95              :         /** Stream End Point ID that is the identifier of the stream endpoint */
      96            1 :         uint8_t id: 6;
      97              :         /** Reserved */
      98            1 :         uint8_t reserved: 1;
      99              :         /** Stream End-point Type that indicates if the stream end-point is SNK or SRC */
     100            1 :         enum bt_avdtp_sep_type tsep;
     101              :         /** Media-type of the End Point
     102              :          * Only @ref BT_AVDTP_AUDIO is supported now.
     103              :          */
     104            1 :         enum bt_avdtp_media_type media_type;
     105              : };
     106              : 
     107              : /** @brief service category Type */
     108            1 : enum bt_avdtp_service_category {
     109              :         /** Media Transport */
     110              :         BT_AVDTP_SERVICE_MEDIA_TRANSPORT = 0x01,
     111              :         /** Reporting */
     112              :         BT_AVDTP_SERVICE_REPORTING = 0x02,
     113              :         /** Recovery */
     114              :         BT_AVDTP_SERVICE_MEDIA_RECOVERY = 0x03,
     115              :         /** Content Protection */
     116              :         BT_AVDTP_SERVICE_CONTENT_PROTECTION = 0x04,
     117              :         /** Header Compression */
     118              :         BT_AVDTP_SERVICE_HEADER_COMPRESSION = 0x05,
     119              :         /** Multiplexing */
     120              :         BT_AVDTP_SERVICE_MULTIPLEXING = 0x06,
     121              :         /** Media Codec */
     122              :         BT_AVDTP_SERVICE_MEDIA_CODEC = 0x07,
     123              :         /** Delay Reporting */
     124              :         BT_AVDTP_SERVICE_DELAY_REPORTING = 0x08,
     125              : };
     126              : 
     127              : /** @brief service category Recovery Capabilities type*/
     128            1 : enum bt_avdtp_recovery_type {
     129              :         /** Forbidden */
     130              :         BT_AVDTP_RECOVERY_TYPE_FORBIDDEN = 0x00,
     131              :         /** RFC2733 */
     132              :         BT_ADVTP_RECOVERY_TYPE_RFC2733 = 0x01,
     133              : };
     134              : 
     135              : /** @brief AVDTP Stream End Point */
     136            1 : struct bt_avdtp_sep {
     137              :         /** Stream End Point information */
     138            1 :         struct bt_avdtp_sep_info sep_info;
     139              :         /** Media Transport Channel*/
     140            1 :         struct bt_l2cap_br_chan chan;
     141              :         /** the endpoint media data */
     142            1 :         void (*media_data_cb)(struct bt_avdtp_sep *sep, struct net_buf *buf);
     143              :         /* semaphore for lock/unlock */
     144            0 :         struct k_sem sem_lock;
     145              :         /** avdtp session */
     146            1 :         struct bt_avdtp *session;
     147              :         /** SEP state */
     148            1 :         uint8_t state;
     149              :         /* Internally used list node */
     150              :         sys_snode_t _node;
     151              : };
     152              : 
     153              : #ifdef __cplusplus
     154              : }
     155              : #endif
     156              : 
     157              : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_AVDTP_H_ */
        

Generated by: LCOV version 2.0-1