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 #ifndef AVCTP_API_H 16 #define AVCTP_API_H 17 #include "avctp_int.h" 18 #include "event.h" 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 typedef struct { 24 uint16_t mtu; 25 uint16_t mtuBr; 26 uint16_t role; 27 Event *event; 28 } AvctRegisterTskParam; 29 30 typedef struct { 31 Event *event; 32 } AvctDeregisterTskParam; 33 34 typedef struct { 35 uint8_t connId; 36 AvctConnectParam connParam; 37 BtAddr peerAddr; 38 Event *event; 39 uint16_t ret; 40 } AvctConnectReqTskParam; 41 42 typedef struct { 43 uint8_t connId; 44 Event *event; 45 uint16_t ret; 46 } AvctDisconnectReqTskParam; 47 48 typedef struct { 49 uint8_t connId; 50 uint8_t label; 51 uint8_t cr; 52 Packet *msg; 53 Event *event; 54 uint16_t ret; 55 } AvctSendMsgReqTskParam; 56 57 typedef struct { 58 uint8_t connId; 59 uint16_t role; 60 Event *event; 61 uint16_t ret; 62 } AvctBrConnectReqTskParam; 63 64 typedef struct { 65 uint8_t connId; 66 Event *event; 67 uint16_t ret; 68 } AvctBrDisconnectReqTskParam; 69 70 typedef struct { 71 uint8_t connId; 72 uint8_t label; 73 uint8_t cr; 74 Packet *msg; 75 Event *event; 76 uint16_t ret; 77 } AvctBrSendMsgReqTskParam; 78 79 /***************************************************************************** 80 * Function 81 ****************************************************************************/ 82 uint16_t AvctConnectInitiate(AvctCbConn *cbConn, const AvctConnectParam *connParam, const BtAddr *peerAddr); 83 uint16_t AvctDisconnect(uint8_t connId, uint8_t type); 84 void AvctRegisterTsk(void *context); 85 void AvctRegister(uint16_t mtu, uint16_t mtuBr, uint16_t role); 86 void AvctDeregisterTsk(void *context); 87 void AvctDeregister(void); 88 void AvctConnectReqTsk(void *context); 89 uint16_t AvctConnectReq(uint8_t *connId, const AvctConnectParam *connParam, const BtAddr *peerAddr); 90 void AvctDisconnectReqTsk(void *context); 91 uint16_t AvctDisconnectReq(uint8_t connId); 92 void AvctSendMsgReqTsk(void *context); 93 uint16_t AvctSendMsgReq(uint8_t connId, uint8_t label, uint8_t cr, const Packet *msg); 94 void AvctGetPeerMtuTsk(void *context); 95 uint16_t AvctGetPeerMtu(uint8_t connId); 96 void AvctBrConnectReqTsk(void *context); 97 uint16_t AvctBrConnectReq(uint8_t connId, uint8_t role); 98 void AvctBrDisconnectReqTsk(void *context); 99 uint16_t AvctBrDisconnectReq(uint8_t connId); 100 void AvctBrSendMsgReqTsk(void *context); 101 uint16_t AvctBrSendMsgReq(uint8_t connId, uint8_t label, uint8_t cr, const Packet *msg); 102 void AvctBrGetPeerMtuTsk(void *context); 103 uint16_t AvctBrGetPeerMtu(uint8_t connId); 104 #ifdef __cplusplus 105 } 106 #endif 107 108 #endif /* AVCTP_API_H */