Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8879a01 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes Ifaad8d92,I693758f4,Ice403b52,I9cf3f9dd,Ia0123bbc

* changes:
  Fragmenter: Remove unused include hci_layer.h
  ISO: Avoid BTE
  SCO: Use std::vector for rx data
  SCO: Remove BT_HDR for sending
  Move SCO handling out of the shim
parents 11907c77 514e3cf0
Loading
Loading
Loading
Loading
+114 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

#include <gmock/gmock.h>

#include <cstdint>

#include "common/contextual_callback.h"
#include "hci/address.h"
#include "hci/hci_layer.h"
#include "hci/hci_packets.h"
#include "module.h"
#include "os/handler.h"

// Unit test interfaces
namespace bluetooth {
namespace hci {
namespace testing {

class MockHciLayer : public HciLayer {
 public:
  MOCK_METHOD(
      void,
      EnqueueCommand,
      (std::unique_ptr<CommandBuilder>, common::ContextualOnceCallback<void(CommandCompleteView)>),
      (override));
  MOCK_METHOD(
      void,
      EnqueueCommand,
      (std::unique_ptr<CommandBuilder>, common::ContextualOnceCallback<void(CommandStatusView)>),
      (override));
  MOCK_METHOD((common::BidiQueueEnd<AclBuilder, AclView>*), GetAclQueueEnd, (), (override));
  MOCK_METHOD((common::BidiQueueEnd<ScoBuilder, ScoView>*), GetScoQueueEnd, (), (override));
  MOCK_METHOD((common::BidiQueueEnd<IsoBuilder, IsoView>*), GetIsoQueueEnd, (), (override));
  MOCK_METHOD(
      (void),
      RegisterEventHandler,
      (EventCode, common::ContextualCallback<void(EventView)>),
      (override));
  MOCK_METHOD((void), UnregisterEventHandler, (EventCode), (override));
  MOCK_METHOD(
      (void),
      RegisterLeEventHandler,
      (SubeventCode, common::ContextualCallback<void(LeMetaEventView)>),
      (override));
  MOCK_METHOD((void), UnregisterLeEventHandler, (SubeventCode), (override));
  MOCK_METHOD(
      (SecurityInterface*),
      GetSecurityInterface,
      (common::ContextualCallback<void(EventView)> event_handler),
      (override));

  MOCK_METHOD(
      (LeSecurityInterface*),
      GetLeSecurityInterface,
      (common::ContextualCallback<void(LeMetaEventView)> event_handler),
      (override));

  MOCK_METHOD(
      (AclConnectionInterface*),
      GetAclConnectionInterface,
      (common::ContextualCallback<void(EventView)> event_handler,
       common::ContextualCallback<void(uint16_t, hci::ErrorCode)> on_disconnect,
       common::ContextualCallback<void(hci::ErrorCode, uint16_t, uint8_t, uint16_t, uint16_t)>
           on_read_remote_version_complete),
      (override));
  MOCK_METHOD((void), PutAclConnectionInterface, (), (override));

  MOCK_METHOD(
      (LeAclConnectionInterface*),
      GetLeAclConnectionInterface,
      (common::ContextualCallback<void(LeMetaEventView)> event_handler,
       common::ContextualCallback<void(uint16_t, hci::ErrorCode)> on_disconnect,
       common::ContextualCallback<void(hci::ErrorCode, uint16_t, uint8_t, uint16_t, uint16_t)>
           on_read_remote_version_complete),
      (override));
  MOCK_METHOD((void), PutLeAclConnectionInterface, (), (override));

  MOCK_METHOD(
      (LeAdvertisingInterface*),
      GetLeAdvertisingInterface,
      (common::ContextualCallback<void(LeMetaEventView)> event_handler),
      (override));

  MOCK_METHOD(
      (LeScanningInterface*),
      GetLeScanningInterface,
      (common::ContextualCallback<void(LeMetaEventView)> event_handler),
      (override));

  MOCK_METHOD(
      (LeIsoInterface*),
      GetLeIsoInterface,
      (common::ContextualCallback<void(LeMetaEventView)> event_handler),
      (override));
};

}  // namespace testing
}  // namespace hci
}  // namespace bluetooth
+0 −2
Original line number Diff line number Diff line
@@ -33,13 +33,11 @@
#define MSG_SUB_EVT_MASK 0x00FF /* eq. BT_SUB_EVT_MASK */

/* Message event ID passed from Host/Controller lib to stack */
#define MSG_HC_TO_STACK_HCI_SCO 0x1200      /* eq. BT_EVT_TO_BTU_HCI_SCO */
#define MSG_HC_TO_STACK_HCI_ERR 0x1300      /* eq. BT_EVT_TO_BTU_HCIT_ERR */
#define MSG_HC_TO_STACK_HCI_ISO 0x1700      /* eq. BT_EVT_TO_BTU_HCI_ISO */
#define MSG_HC_TO_STACK_HCI_EVT 0x1000      /* eq. BT_EVT_TO_BTU_HCI_EVT */

/* Message event ID passed from stack to vendor lib */
#define MSG_STACK_TO_HC_HCI_SCO 0x2200 /* eq. BT_EVT_TO_LM_HCI_SCO */
#define MSG_STACK_TO_HC_HCI_ISO 0x2d00 /* eq. BT_EVT_TO_LM_HCI_ISO */
#define MSG_STACK_TO_HC_HCI_CMD 0x2000 /* eq. BT_EVT_TO_LM_HCI_CMD */

+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@
#pragma once

#include "device/include/controller.h"
#include "hci_layer.h"
#include "osi/include/allocator.h"
#include "stack/include/bt_hdr.h"

+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "check.h"
#include "device/include/controller.h"
#include "hci/include/buffer_allocator.h"
#include "hci/include/hci_layer.h"
#include "osi/include/log.h"
#include "stack/include/bt_hdr.h"

+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@

#include "AllocationTestHarness.h"
#include "device/include/controller.h"
#include "hci/include/hci_layer.h"
#include "osi/include/allocator.h"
#include "osi/include/osi.h"
#include "stack/include/bt_hdr.h"
Loading