1 /*
2  * Copyright (C) 2021-2022 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 #ifndef A2DP_AVDTP_H
17 #define A2DP_AVDTP_H
18 
19 #include <cstdint>
20 
21 #include "a2dp_def.h"
22 #include "avdtp.h"
23 #include "btstack.h"
24 #include "message.h"
25 #include "packet.h"
26 
27 namespace OHOS {
28 namespace bluetooth {
29 /**
30  * @brief The class supply the method between A2dp profile with the AVDT protocal
31  *
32 * @since 6.0
33  */
34 class A2dpAvdtp {
35 public:
36     /**
37      * @brief A constructor used to create an <b>A2dpAvdtp</b> instance.
38      *
39      * @param[in] role The role of the local profile
40      * @since 6.0
41      */
42     explicit A2dpAvdtp(const uint8_t role);
43 
44     /**
45      * @brief A destructor used to delete an <b>A2dpAvdtp</b> instance.
46      *
47      * @param[in] role The role of the local profile
48      * @since 6.0
49      */
50     ~A2dpAvdtp() = default;
51 
52     /**
53      * @brief A function to register a2dp information to the avdtp.
54      *
55      * @param[in] rcb The register information of a2dp profile
56      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
57      * @since 6.0
58      */
59     static uint16_t RegisterAvdtp(const AvdtRegisterParam &rcb);
60 
61     /**
62      * @brief A function to register a2dp SEP to the avdtp.
63      *
64      * @param[in] addr The address of peer device
65      * @param[in] cfg The sep information of a2dp profile
66      * @param[out] handle The handle/seid of SEP of local profile
67      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
68      * @since 6.0
69      */
70     static uint16_t CreateStream(const BtAddr &addr, const uint8_t codecIndex, uint16_t &handle);
71 
72     /**
73      * @brief A function to register a2dp SEP to the avdtp. Used usually for acceptor of avdtp
74      *
75      * @param[in] cfg The sep information of a2dp profile
76      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
77      * @since 6.0
78      */
79     uint16_t RegisterLocalSEP(AvdtStreamConfig cfg[], const uint8_t number) const;
80 
81     /**
82      * @brief A function to create signalling channel to  peer device.
83      *
84      * @param[in] addr The address of peer device
85      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
86      * @since 6.0
87      */
88     uint16_t ConnectReq(const BtAddr &addr) const;
89 
90     /**
91      * @brief A function to disconnect the stream.
92      *
93      * @param[in] addr The address of peer device
94      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
95      * @since 6.0
96      */
97     static uint16_t DisconnectReq(const BtAddr &addr);
98 
99     /**
100      * @brief A function to get sep list of peer device.
101      *
102      * @param[in] addr The address of peer device
103      * @param[in] maxNum The max number of seps
104      * @param[out] label The label of signalling
105      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
106      * @since 6.0
107      */
108     static uint16_t DiscoverReq(const BtAddr &addr, const uint8_t maxNum, uint8_t &label);
109 
110     /**
111      * @brief A function to get capability of peer device.
112      *
113      * @param[in] addr The address of peer device
114      * @param[out] label The label of signalling
115      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
116      * @since 6.0
117      */
118     static uint16_t GetCapabilityReq(const BtAddr &addr, const uint8_t seid, uint8_t &label);
119 
120     /**
121      * @brief A function to get all capabilities of peer device.
122      *
123      * @param[in] addr The address of peer device
124      * @param[out] label The label of signalling
125      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
126      * @since 6.0
127      */
128     static uint16_t GetAllCapabilityReq(const BtAddr &addr, const uint8_t seid, uint8_t &label);
129 
130     /**
131      * @brief A function to configure the stream
132      *
133      * @param[in] addr The address of peer device
134      * @param[in] seid The seid of peer device
135      * @param[in] handle The seid of local profile
136      * @param[out] label The label of signalling
137      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
138      * @since 6.0
139      */
140     static uint16_t SetConfigureReq(
141         const BtAddr &addr, const uint16_t handle, const uint8_t seid, const AvdtSepConfig &cfg, uint8_t &label);
142 
143     /**
144      * @brief A function to establish stream.
145      *
146      * @param[in] handle The handle of stream
147      * @param[out] label The label of signalling
148      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
149      * @since 6.0
150      */
151     static uint16_t OpenReq(const uint16_t handle, uint8_t &label);
152 
153     /**
154      * @brief A function to send delay value to source.
155      *
156      * @param[in] handle The handle of stream
157      * @param[in] delayValue The value of delay
158      * @param[out] label The label of signalling
159      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
160      * @since 6.0
161      */
162     static uint16_t DelayReq(const uint16_t handle, uint8_t &label, uint16_t delayValue);
163 
164     /**
165      * @brief A function to close the stream.
166      *
167      * @param[in] handle The handle of stream
168      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
169      * @since 6.0
170      */
171     static uint16_t CloseReq(const uint16_t handle);
172 
173     /**
174      * @brief A function to response to the close req.
175      *
176      * @param[in] handle The handle of stream
177      * @param[in] label The label of signalling received
178      * @param[in] errCode AVDT_SUCCESS: close ok; otherwise refuse the signalling
179      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
180      * @since 6.0
181      */
182     static uint16_t CloseRsp(const uint16_t handle, const uint8_t label, const uint8_t errCode);
183 
184     /**
185      * @brief A function to suspend the stream.
186      *
187      * @param[in] handle The handle of stream
188      * @param[out] label The label of signalling
189      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
190      * @since 6.0
191      */
192     static uint16_t SuspendReq(const uint16_t handle, uint8_t &label);
193 
194     /**
195      * @brief A function to start the stream.
196      *
197      * @param[in] handle The handle of stream
198      * @param[out] label The label of signalling
199      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
200      * @since 6.0
201      */
202     static uint16_t StartReq(const uint16_t handle, uint8_t &label);
203 
204     /**
205      * @brief A function to response to the suspend req.
206      *
207      * @param[in] handle The handle of stream
208      * @param[in] label The label of signalling received
209      * @param[in] errHandle The first handle refused
210      * @param[in] errCode AVDT_SUCCESS: close ok; otherwise refuse the signalling
211      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
212      * @since 6.0
213      */
214     static uint16_t SuspendRsp(
215         const uint16_t handle, const uint8_t label, const uint16_t errHandle, const uint8_t errCode);
216 
217     /**
218      * @brief A function to response to the start req.
219      *
220      * @param[in] handle The handle of stream
221      * @param[in] label The label of signalling received
222      * @param[in] errHandle The first handle refused
223      * @param[in] errCode AVDT_SUCCESS: close ok; otherwise refuse the signalling
224      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
225      * @since 6.0
226      */
227     static uint16_t StartRsp(
228         const uint16_t handle, const uint8_t label, const uint16_t errHandle, const uint8_t errCode);
229 
230     /**
231      * @brief A function to reconfigure the stream.
232      *
233      * @param[in] handle The handle of stream
234      * @param[in] cfg The configure information
235      * @param[out] label The label of signalling
236      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
237      * @since 6.0
238      */
239     static uint16_t ReconfigureReq(const uint16_t handle, const AvdtSepConfig &cfg, uint8_t &label);
240 
241     /**
242      * @brief A function to abort the stream.
243      *
244      * @param[in] handle The handle of stream
245      * @param[out] label The label of signalling
246      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
247      * @since 6.0
248      */
249     static uint16_t AbortReq(const uint16_t handle, uint8_t &label);
250 
251     /**
252      * @brief A function to response to the configure req.
253      *
254      * @param[in] handle The handle of stream
255      * @param[in] label The label of signalling received
256      * @param[in] category Errorcode is zero, configure ok;
257      *            Otherwise returen the first category failed and error cause
258      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
259      * @since 6.0
260      */
261     static uint16_t SetConfigureRsp(const uint16_t handle, const uint8_t label, const AvdtCatetory category);
262 
263     /**
264      * @brief A function to response to the configure req.
265      *
266      * @param[in] handle The handle of stream
267      * @param[in] label The label of signalling received
268      * @param[in] category Errorcode is zero, configure ok;
269      *            Otherwise return the first category failed and error cause
270      * @return A2DP_SUCCESS: Successful; otherwise failed to call avdtp api.
271      * @since 6.0
272      */
273     static uint16_t ReconfigureRsp(const uint16_t handle, const uint8_t label, const AvdtCatetory category);
274 
275     /**
276      *
277      * @brief Function WriteStream
278      * @details Send a media packet from SOURCE to the SINK, pts only.
279      * @param[in] handle       Handle of stream
280      * @param[in] pkt          Stream data
281      * @param[in] timeStamp    Timestamp of this stream data sent
282      * @param[in] payloadType  Payload type
283      * @param[in] marker       Marker: such ad frame boundaries in the data stream
284      * @return AVDT_SUCCESS if successful, otherwise error.
285      *
286      */
287     static uint16_t WriteStream(uint16_t handle, Packet *pkt, uint32_t timeStamp, uint8_t payloadType, uint16_t marker);
288 
289     /**
290      * @brief A function to process the event(indication/confirm) from avdtp.
291      *
292      * @param[in] handle The handle of stream(after configured)
293      * @param[in] bdAddr The address of peer device
294      * @param[in] event The indication or confirm from avdtp
295      * @param[in] data The detail information matched event
296      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
297      * @since 6.0
298      */
299     static void ProcAvdtpEvent(
300         uint16_t handle, const BtAddr *bdAddr, uint8_t event, const AvdtCtrlData *data, uint8_t role);
301 
302     /**
303      * @brief A function to process event from avdtp
304      *
305      * @param[in] handle The handle of stream(after configured)
306      * @param[in] bdAddr The address of peer device
307      * @param[in] event The indication or confirm from avdtp
308      * @param[in] data The detail information matched event
309      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
310      * @since 6.0
311      */
312     A2dpAvdtMsg *ParseAvdtpCallbackContent(const uint16_t handle, const BtAddr bdAddr,
313         const uint8_t event, const AvdtCtrlData &data, const uint8_t role) const;
314 
315 private:
316     /**
317      * @brief A function to switch from avdtp thread to a2dp service.
318      *
319      * @param[in] bdAddr The address of peer device
320      * @param[in] msgData The detail information matched event
321      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
322      * @since 6.0
323      */
324     static void SwitchThreadToA2dpService(uint8_t role, BtAddr bdAddr, utility::Message msgData);
325 
326     /**
327      * @brief A function to parse disconnect indication from avdtp
328      *
329      * @param[in] handle The handle of stream(after configured)
330      * @param[in] bdAddr The address of peer device
331      * @param[in] msg The message sent to a2dp profile state machine
332      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
333      * @since 6.0
334      */
335     static uint8_t ParseAvdtpDisconnectInd(
336         const uint16_t handle, const BtAddr bdAddr, const uint8_t role, A2dpAvdtMsg &msg);
337 
338     /**
339      * @brief A function to parse configure indication from avdtp
340      *
341      * @param[in] handle The handle of stream(after configured)
342      * @param[in] bdAddr The address of peer device
343      * @param[in] data The detail information matched event
344      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
345      * @param[in] msg The message sent to a2dp profile state machine
346      * @since 6.0
347      */
348     static uint8_t ParseAvdtpConfigureInd(const uint16_t handle, const BtAddr bdAddr,
349         const AvdtCtrlData &data, const uint8_t role, A2dpAvdtMsg &msg);
350 
351     /**
352      * @brief A function to parse reconfigure indication from avdtp
353      *
354      * @param[in] handle The handle of stream(after configured)
355      * @param[in] bdAddr The address of peer device
356      * @param[in] data The detail information matched event
357      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
358      * @param[in] msg The message sent to a2dp profile state machine
359      * @since 6.0
360      */
361     static uint8_t ParseAvdtpReconfigureInd(const uint16_t handle, const BtAddr bdAddr,
362         const AvdtCtrlData &data, const uint8_t role, A2dpAvdtMsg &msg);
363 
364     /**
365      * @brief A function to parse open indication from avdtp
366      *
367      * @param[in] handle The handle of stream(after configured)
368      * @param[in] bdAddr The address of peer device
369      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
370      * @param[in] msg The message sent to a2dp profile state machine
371      * @since 6.0
372      */
373     static uint8_t ParseAvdtpOpenInd(
374         const uint16_t handle, const BtAddr bdAddr, const uint8_t role, A2dpAvdtMsg &msg);
375 
376     /**
377      * @brief A function to parse close indication from avdtp
378      *
379      * @param[in] handle The handle of stream(after configured)
380      * @param[in] bdAddr The address of peer device
381      * @param[in] data The detail information matched event
382      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
383      * @param[in] msg The message sent to a2dp profile state machine
384      * @since 6.0
385      */
386     static uint8_t ParseAvdtpCloseInd(const uint16_t handle, const BtAddr bdAddr,
387         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
388 
389     /**
390      * @brief A function to parse close stream channel indication from avdtp
391      *
392      * @param[in] bdAddr The address of peer device
393      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
394      * @param[in] msg The message sent to a2dp profile state machine
395      * @since 6.0
396      */
397     static uint8_t ParseAvdtpCloseChannelInd(
398         const BtAddr bdAddr, const uint16_t handle, const uint8_t role, A2dpAvdtMsg &msg);
399 
400     /**
401      * @brief A function to parse start indication from avdtp
402      *
403      * @param[in] handle The handle of stream(after configured)
404      * @param[in] bdAddr The address of peer device
405      * @param[in] data The detail information matched event
406      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
407      * @param[in] msg The message sent to a2dp profile state machine
408      * @since 6.0
409      */
410     static uint8_t ParseAvdtpStartInd(const uint16_t handle, const BtAddr bdAddr,
411         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
412 
413     /**
414      * @brief A function to parse suspend indication from avdtp
415      *
416      * @param[in] handle The handle of stream(after configured)
417      * @param[in] bdAddr The address of peer device
418      * @param[in] data The detail information matched event
419      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
420      * @param[in] msg The message sent to a2dp profile state machine
421      * @since 6.0
422      */
423     static uint8_t ParseAvdtpSuspendInd(const uint16_t handle, const BtAddr bdAddr,
424         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
425 
426     /**
427      * @brief A function to parse delay report indication from avdtp
428      *
429      * @param[in] bdAddr The address of peer device
430      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
431      * @param[in] msg The message sent to a2dp profile state machine
432      */
433     static uint8_t ParseAvdtpDelayReportInd(const uint16_t handle, const BtAddr bdAddr,
434         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
435     /**
436      * @brief A function to parse connect confirm from avdtp
437      *
438      * @param[in] bdAddr The address of peer device
439      * @param[in] data The detail information matched event
440      * @param[in] msg The message sent to a2dp profile state machine
441      * @since 6.0
442      */
443     static uint8_t ParseAvdtpConnectCFM(const BtAddr bdAddr, const uint8_t role,
444         A2dpAvdtMsg &msg, const AvdtCtrlData &data);
445 
446     /**
447      * @brief A function to parse disconnect confirm from avdtp
448      *
449      * @param[in] bdAddr The address of peer device
450      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
451      * @param[in] msg The message sent to a2dp profile state machine
452      * @since 6.0
453      */
454     static uint8_t ParseAvdtpDisconnectCFM(const BtAddr bdAddr, const uint8_t role, A2dpAvdtMsg &msg);
455 
456     /**
457      * @brief A function to parse discover confirm from avdtp
458      *
459      * @param[in] bdAddr The address of peer device
460      * @param[in] data The detail information matched event
461      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
462      * @param[in] msg The message sent to a2dp profile state machine
463      * @since 6.0
464      */
465     static uint8_t ParseAvdtpDiscoverCFM(
466         const BtAddr bdAddr, const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
467 
468     /**
469      * @brief A function to parse get capability confirm from avdtp
470      *
471      * @param[in] handle The handle of stream(after configured)
472      * @param[in] bdAddr The address of peer device
473      * @param[in] data The detail information matched event
474      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
475      * @param[in] msg The message sent to a2dp profile state machine
476      * @since 6.0
477      */
478     static uint8_t ParseAvdtpGetCapabilityCFM(const uint16_t handle, const BtAddr bdAddr,
479         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
480 
481     /**
482      * @brief A function to parse get all capability confirm from avdtp
483      *
484      * @param[in] handle The handle of stream(after configured)
485      * @param[in] bdAddr The address of peer device
486      * @param[in] data The detail information matched event
487      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
488      * @param[in] msg The message sent to a2dp profile state machine
489      * @since 6.0
490      */
491     static uint8_t ParseAvdtpGetALLCapCFM(const uint16_t handle, const BtAddr bdAddr,
492         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
493 
494     /**
495      * @brief A function to parse configure confirm from avdtp
496      *
497      * @param[in] handle The handle of stream(after configured)
498      * @param[in] bdAddr The address of peer device
499      * @param[in] data The detail information matched event
500      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
501      * @param[in] msg The message sent to a2dp profile state machine
502      * @since 6.0
503      */
504     static uint8_t ParseAvdtpConfigureCFM(const uint16_t handle, const BtAddr bdAddr,
505         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
506 
507     /**
508      * @brief A function to parse get configure confirm from avdtp
509      *
510      * @param[in] handle The handle of stream(after configured)
511      * @param[in] bdAddr The address of peer device
512      * @param[in] data The detail information matched event
513      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
514      * @param[in] msg The message sent to a2dp profile state machine
515      * @since 6.0
516      */
517     static uint8_t ParseAvdtpGetConfigureCFM(const uint16_t handle, const BtAddr bdAddr,
518         const uint8_t role, const A2dpAvdtMsg &msg, const AvdtCtrlData &data);
519 
520     /**
521      * @brief A function to parse open confirm from avdtp
522      *
523      * @param[in] handle The handle of stream(after configured)
524      * @param[in] bdAddr The address of peer device
525      * @param[in] data The detail information matched event
526      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
527      * @param[in] msg The message sent to a2dp profile state machine
528      * @since 6.0
529      */
530     static uint8_t ParseAvdtpOpenCFM(const uint16_t handle, const BtAddr bdAddr,
531         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
532 
533     /**
534      * @brief A function to parse start confirm from avdtp
535      *
536      * @param[in] handle The handle of stream(after configured)
537      * @param[in] bdAddr The address of peer device
538      * @param[in] data The detail information matched event
539      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
540      * @param[in] msg The message sent to a2dp profile state machine
541      * @since 6.0
542      */
543     static uint8_t ParseAvdtpStartCFM(
544         uint16_t handle, BtAddr bdAddr, uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
545 
546     /**
547      * @brief A function to parse reconfigure confirm from avdtp
548      *
549      * @param[in] handle The handle of stream(after configured)
550      * @param[in] bdAddr The address of peer device
551      * @param[in] data The detail information matched event
552      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
553      * @param[in] msg The message sent to a2dp profile state machine
554      * @since 6.0
555      */
556     static uint8_t ParseAvdtpReconfigureCFM(const uint16_t handle, const BtAddr bdAddr,
557         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
558 
559     /**
560      * @brief A function to parse suspend confirm from avdtp
561      *
562      * @param[in] handle The handle of stream(after configured)
563      * @param[in] bdAddr The address of peer device
564      * @param[in] data The detail information matched event
565      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
566      * @param[in] msg The message sent to a2dp profile state machine
567      * @since 6.0
568      */
569     static uint8_t ParseAvdtpSuspendCFM(const uint16_t handle, const BtAddr bdAddr,
570         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
571 
572     /**
573      * @brief A function to parse stream close confirm from avdtp
574      *
575      * @param[in] handle The handle of stream(after configured)
576      * @param[in] bdAddr The address of peer device
577      * @param[in] data The detail information matched event
578      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
579      * @param[in] msg The message sent to a2dp profile state machine
580      * @since 6.0
581      */
582     static uint8_t ParseAvdtpStreamCloseCFM(const uint16_t handle, const BtAddr bdAddr,
583         const uint8_t role, A2dpAvdtMsg &msg, const AvdtCtrlData &data);
584 
585     /**
586      * @brief A function to parse abort confirm from avdtp
587      *
588      * @param[in] handle The handle of stream(after configured)
589      * @param[in] bdAddr The address of peer device
590      * @param[in] data The detail information matched event
591      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
592      * @param[in] msg The message sent to a2dp profile state machine
593      * @since 6.0
594      */
595     static uint8_t ParseAvdtpAbortCFM(const uint16_t handle, const BtAddr bdAddr,
596         const uint8_t role, const A2dpAvdtMsg &msg, const AvdtCtrlData &data);
597 
598     /**
599      * @brief A function to parse write confirm from avdtp
600      *
601      * @param[in] handle The handle of stream(after configured)
602      * @param[in] bdAddr The address of peer device
603      * @param[in] data The detail information matched event
604      * @param[in] role The role of local profile(Acceptor: is confirmed after configure)
605      * @param[in] msg The message sent to a2dp profile state machine
606      * @since 6.0
607      */
608     static uint8_t ParseAvdtpWriteCFM(const uint16_t handle, const BtAddr bdAddr,
609         const uint8_t role, const A2dpAvdtMsg &msg, const AvdtCtrlData &data);
610     A2dpAvdtp() = delete;
611     uint8_t peerRole_ = 0;
612 };
613 }  // namespace bluetooth
614 }  // namespace OHOS
615 #endif  // A2DP_AVDTP_H