Home | History | Annotate | Download | only in default
      1 //
      2 // Copyright 2017 The Android Open Source Project
      3 //
      4 // Licensed under the Apache License, Version 2.0 (the "License");
      5 // you may not use this file except in compliance with the License.
      6 // You may obtain a copy of the License at
      7 //
      8 // http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 // Unless required by applicable law or agreed to in writing, software
     11 // distributed under the License is distributed on an "AS IS" BASIS,
     12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 // See the License for the specific language governing permissions and
     14 // limitations under the License.
     15 //
     16 
     17 #pragma once
     18 
     19 #include <hidl/HidlSupport.h>
     20 
     21 #include "async_fd_watcher.h"
     22 #include "bt_vendor_lib.h"
     23 #include "hci_internals.h"
     24 #include "hci_protocol.h"
     25 
     26 namespace android {
     27 namespace hardware {
     28 namespace bluetooth {
     29 namespace hci {
     30 
     31 class MctProtocol : public HciProtocol {
     32  public:
     33   MctProtocol(int* fds, PacketReadCallback event_cb, PacketReadCallback acl_cb);
     34 
     35   size_t Send(uint8_t type, const uint8_t* data, size_t length);
     36 
     37   void OnEventPacketReady();
     38   void OnAclDataPacketReady();
     39 
     40   void OnEventDataReady(int fd);
     41   void OnAclDataReady(int fd);
     42 
     43  private:
     44   int uart_fds_[CH_MAX];
     45 
     46   PacketReadCallback event_cb_;
     47   PacketReadCallback acl_cb_;
     48 
     49   hci::HciPacketizer event_packetizer_;
     50   hci::HciPacketizer acl_packetizer_;
     51 };
     52 
     53 }  // namespace hci
     54 }  // namespace bluetooth
     55 }  // namespace hardware
     56 }  // namespace android
     57