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

Commit 2035b901 authored by Myles Watson's avatar Myles Watson
Browse files

HCI: Add SetEventMaskPage2 Opcode

SetEventMaskPage2 is used for enabling/disabling
events for AMP.  Although we don't support these,
we can support (ignore) the command to disable them.

Bug: 186458975
Test: cert/run
Tag: #gd-refactor
Change-Id: Ibe957895fb830baf93b796a6b375928884912e18
parent 6719d9d9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -655,6 +655,7 @@ struct Controller::impl {
      OP_CODE_MAPPING(WRITE_SIMPLE_PAIRING_DEBUG_MODE)
      OP_CODE_MAPPING(REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY)
      OP_CODE_MAPPING(SEND_KEYPRESS_NOTIFICATION)
      OP_CODE_MAPPING(SET_EVENT_MASK_PAGE_2)
      OP_CODE_MAPPING(IO_CAPABILITY_REQUEST_NEGATIVE_REPLY)
      OP_CODE_MAPPING(REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY)
      OP_CODE_MAPPING(READ_ENCRYPTION_KEY_SIZE)
+4 −0
Original line number Diff line number Diff line
@@ -226,6 +226,9 @@ enum OpCode : 16 {
  ENHANCED_FLUSH = 0x0C5F,
  SEND_KEYPRESS_NOTIFICATION = 0x0C60,

  // Allow stacks to disable AMP events
  SET_EVENT_MASK_PAGE_2 = 0x0C63,

  READ_LE_HOST_SUPPORT = 0x0C6C,
  WRITE_LE_HOST_SUPPORT = 0x0C6D,

@@ -515,6 +518,7 @@ enum OpCodeIndex : 16 {
  SEND_KEYPRESS_NOTIFICATION = 202,
  IO_CAPABILITY_REQUEST_NEGATIVE_REPLY = 203,
  READ_ENCRYPTION_KEY_SIZE = 204,
  SET_EVENT_MASK_PAGE_2 = 222,
  READ_DATA_BLOCK_SIZE = 232,
  READ_LE_HOST_SUPPORT = 245,
  WRITE_LE_HOST_SUPPORT = 246,
+9 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ DualModeController::DualModeController(const std::string& properties_filename, u
  SET_SUPPORTED(READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL,
                ReadInquiryResponseTransmitPowerLevel);
  SET_SUPPORTED(SEND_KEYPRESS_NOTIFICATION, SendKeypressNotification);
  SET_HANDLER(SET_EVENT_MASK_PAGE_2, SetEventMaskPage2);
  SET_SUPPORTED(READ_LOCAL_OOB_DATA, ReadLocalOobData);
  SET_SUPPORTED(READ_LOCAL_OOB_EXTENDED_DATA, ReadLocalOobExtendedData);
  SET_SUPPORTED(WRITE_SIMPLE_PAIRING_MODE, WriteSimplePairingMode);
@@ -854,6 +855,14 @@ void DualModeController::SendKeypressNotification(CommandView command) {
      kNumCommandPackets, status, peer));
}

void DualModeController::SetEventMaskPage2(CommandView command) {
  auto payload =
      std::make_unique<bluetooth::packet::RawBuilder>(std::vector<uint8_t>(
          {static_cast<uint8_t>(bluetooth::hci::ErrorCode::SUCCESS)}));
  send_event_(bluetooth::hci::CommandCompleteBuilder::Create(
      kNumCommandPackets, command.GetOpCode(), std::move(payload)));
}

void DualModeController::ReadLocalOobData(CommandView command) {
  auto command_view = gd_hci::ReadLocalOobDataView::Create(
      gd_hci::SecurityCommandView::Create(command));
+3 −0
Original line number Diff line number Diff line
@@ -337,6 +337,9 @@ class DualModeController : public Device {
  // 7.3.63
  void SendKeypressNotification(CommandView args);

  // 7.3.69
  void SetEventMaskPage2(CommandView args);

  // 7.3.79
  void WriteLeHostSupport(CommandView args);