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 #ifndef OHOS_HDI_BLUETOOTH_HCI_MCT_PROTOCOL_H 17 #define OHOS_HDI_BLUETOOTH_HCI_MCT_PROTOCOL_H 18 19 #include "hci_protocol.h" 20 21 #include "ohos_bt_vendor_lib.h" 22 23 namespace OHOS { 24 namespace HDI { 25 namespace Bluetooth { 26 namespace Hci { 27 class MctProtocol : public HciProtocol { 28 public: 29 MctProtocol(const int fds[HCI_MAX_CHANNEL], HciDataCallback onAclReceive, HciDataCallback onScoReceive, 30 HciDataCallback onEventReceive); 31 ssize_t SendPacket(HciPacketType packetType, const std::vector<uint8_t> &packetData) override; 32 void ReadEventData(int fd); 33 void ReadAclData(int fd); 34 ~MctProtocol() override; 35 36 private: 37 int hciFds_[HCI_MAX_CHANNEL] = {0}; 38 HciDataCallback onAclReceive_; 39 HciDataCallback onScoReceive_; 40 HciDataCallback onEventReceive_; 41 42 std::vector<uint8_t> aclPacket_; 43 uint32_t aclReadLength_ = 0; 44 std::vector<uint8_t> eventPacket_; 45 uint32_t eventReadLength_ = 0; 46 }; 47 } // namespace Hci 48 } // namespace Bluetooth 49 } // namespace HDI 50 } // namespace OHOS 51 #endif /* OHOS_HDI_BLUETOOTH_HCI_MCT_PROTOCOL_H */