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