1 /*
2  * Copyright (C) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup Bluetooth
18  * @{
19  *
20  * @brief A2dp codec information and status define.
21  *
22  * @since 6
23  */
24 
25 #ifndef BLUETOOTH_A2DP_CODEC_H
26 #define BLUETOOTH_A2DP_CODEC_H
27 
28 #include <vector>
29 #include "bluetooth_def.h"
30 #include "bluetooth_types.h"
31 
32 namespace OHOS {
33 namespace Bluetooth {
34 /**
35  * @brief A2dp codec configuration information of a2dp source
36  *
37  * @since 6.0
38  */
39 struct A2dpCodecInfo {
40     // Codec priority
41     uint32_t codecPriority;
42 
43     // Codec type
44     uint8_t codecType;
45 
46     // Codec sample
47     uint32_t sampleRate;
48 
49     // Codec bits per sample
50     uint8_t bitsPerSample;
51 
52     // Codec channel mode
53     uint8_t channelMode;
54 
55     // Codec specific value1
56     uint64_t codecSpecific1;
57 
58     // Codec specific value2
59     uint64_t codecSpecific2;
60 
61     // Codec specific value3
62     uint64_t codecSpecific3;
63 
64     // Codec specific value4
65     uint64_t codecSpecific4;
66 };
67 
68 /**
69  * @brief The codec configuration and capability information of a2dp source
70  *
71  * @since 6.0
72  */
73 struct A2dpCodecStatus {
74     // current codec information
75     A2dpCodecInfo codecInfo;
76 
77     // local codec information
78     std::vector<A2dpCodecInfo> codecInfoLocalCap;
79 
80     // Local device and peer confirmed codec information
81     std::vector<A2dpCodecInfo> codecInfoConfirmedCap;
82 };
83 
84 /**
85  * @brief A2dp offload codec configuration information of a2dp source
86  *
87  * @since 6.0
88  */
89 struct A2dpOffloadCodecInfo {
90     uint16_t mediaPacketHeader = 0;
91     uint8_t mPt = 0;
92     uint32_t ssrc = 0;
93     uint8_t boundaryFlag = 0;
94     uint8_t broadcastFlag = 0;
95     uint32_t codecType = 0;
96     uint16_t maxLatency = 0;
97     uint16_t scmsTEnable = 0;
98     uint32_t sampleRate = 0;
99     uint32_t encodedAudioBitrate = 0;
100     uint8_t bitsPerSample = 0;
101     uint8_t chMode = 0;
102     uint16_t aclHdl = 0;
103     uint16_t l2cRcid = 0;
104     uint16_t mtu = 0;
105     uint8_t codecSpecific0 = 0;
106     uint8_t codecSpecific1 = 0;
107     uint8_t codecSpecific2 = 0;
108     uint8_t codecSpecific3 = 0;
109     uint8_t codecSpecific4 = 0;
110     uint8_t codecSpecific5 = 0;
111     uint8_t codecSpecific6 = 0;
112     uint8_t codecSpecific7 = 0;
113 };
114 
115 class BluetoothA2dpOffloadCodecStatus;
116 
117 struct A2dpOffloadCodecStatus {
118     A2dpOffloadCodecInfo offloadInfo;
A2dpOffloadCodecStatusA2dpOffloadCodecStatus119     A2dpOffloadCodecStatus() {};
120     A2dpOffloadCodecStatus(const BluetoothA2dpOffloadCodecStatus &status);
121 };
122 }  // namespace Bluetooth
123 }  // namespace OHOS
124 #endif  // BLUETOOTH_A2DP_CODEC_H