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

Commit cc3527b0 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5926043 from b98418ec to rvc-release

Change-Id: I86daa44815c7005e7baf311797878e72f5ef765b
parents 9d4e2781 b98418ec
Loading
Loading
Loading
Loading
+30 −7
Original line number Diff line number Diff line
@@ -9,7 +9,8 @@ enum Enable : 8 {
}

// https://www.bluetooth.com/specifications/assigned-numbers/generic-access-profile
enum GapDataTypes : 8 {
enum GapDataType : 8 {
  INVALID = 0x00,
  FLAGS = 0x01,
  INCOMPLETE_LIST_16_BIT_UUIDS = 0x02,
  COMPLETE_LIST_16_BIT_UUIDS = 0x03,
@@ -23,6 +24,12 @@ enum GapDataTypes : 8 {
  CLASS_OF_DEVICE = 0x0D,
}

struct GapData {
  _size_(data) : 8, // Including one byte for data_type
  data_type : GapDataType,
  data : 8[+1*8],
}

// HCI ACL Packets

enum PacketBoundaryFlag : 2 {
@@ -1771,12 +1778,14 @@ packet ReadExtendedInquiryResponse : CommandPacket (op_code = READ_EXTENDED_INQU
packet ReadExtendedInquiryResponseComplete : CommandComplete (command_op_code = READ_EXTENDED_INQUIRY_RESPONSE) {
  status : ErrorCode,
  fec_required : FecRequired,
  _payload_,
  extended_inquiry_response : GapData[],
}

packet WriteExtendedInquiryResponse : CommandPacket (op_code = WRITE_EXTENDED_INQUIRY_RESPONSE) {
  fec_required : FecRequired,
  _payload_,
  extended_inquiry_response : GapData[],
  //_payload_, // Zero padding to be 240 octets
  // Should it be GapData[240] ?
}

packet WriteExtendedInquiryResponseComplete : CommandComplete (command_op_code = WRITE_EXTENDED_INQUIRY_RESPONSE) {
@@ -2229,7 +2238,9 @@ packet LeReadAdvertisingChannelTxPowerComplete : CommandComplete (command_op_cod
}

packet LeSetAdvertisingData : LeAdvertisingCommand (op_code = LE_SET_ADVERTISING_DATA) {
  _payload_,
  _size_(advertising_data) : 8,
  advertising_data : GapData[],
  _payload_, // Zero padding to 31 bytes of advertising_data
}

packet LeSetAdvertisingDataComplete : CommandComplete (command_op_code = LE_SET_ADVERTISING_DATA) {
@@ -2237,7 +2248,9 @@ packet LeSetAdvertisingDataComplete : CommandComplete (command_op_code = LE_SET_
}

packet LeSetScanResponseData : LeAdvertisingCommand (op_code = LE_SET_SCAN_RESPONSE_DATA) {
  _payload_,
  _size_(advertising_data) : 8,
  advertising_data : GapData[],
  _payload_, // Zero padding to 31 bytes of advertising_data
}

packet LeSetScanResponseDataComplete : CommandComplete (command_op_code = LE_SET_SCAN_RESPONSE_DATA) {
@@ -2996,7 +3009,7 @@ packet ExtendedInquiryResult : EventPacket (event_code = EXTENDED_INQUIRY_RESULT
  clock_offset : 15,
  _reserved_ : 1,
  rssi : 8,
  _payload_,
  extended_inquiry_response : GapData[],
}

packet EncryptionKeyRefreshComplete : EventPacket (event_code = ENCRYPTION_KEY_REFRESH_COMPLETE){
@@ -3097,8 +3110,18 @@ packet LeConnectionComplete : LeMetaEvent (subevent_code = CONNECTION_COMPLETE)
  master_clock_accuracy : MasterClockAccuracy,
}

struct LeAdvertisingReport {
  event_type : AdvertisingEventType,
  address_type : AddressType,
  address : Address,
  _size_(advertising_data) : 8,
  advertising_data : GapData[],
  rssi : 8,
}

packet LeAdvertisingReport : LeMetaEvent (subevent_code = ADVERTISING_REPORT) {
  _payload_,
  _count_(le_advertising_reports) : 8,
  le_advertising_reports : LeAdvertisingReport[],
}

packet LeConnectionUpdateComplete : LeMetaEvent (subevent_code = CONNECTION_UPDATE_COMPLETE) {
+55 −0
Original line number Diff line number Diff line
@@ -127,5 +127,60 @@ DEFINE_AND_INSTANTIATE_LeReadBufferSizeReflectionTest(le_read_buffer_size);
std::vector<uint8_t> le_read_buffer_size_complete = {0x0e, 0x07, 0x01, 0x02, 0x20, 0x00, 0xfb, 0x00, 0x10};
DEFINE_AND_INSTANTIATE_LeReadBufferSizeCompleteReflectionTest(le_read_buffer_size_complete);

std::vector<uint8_t> pixel_3_xl_write_extended_inquiry_response{
    0x52, 0x0c, 0xf1, 0x01, 0x0b, 0x09, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x20, 0x33, 0x20, 0x58, 0x4c, 0x19, 0x03, 0x05,
    0x11, 0x0a, 0x11, 0x0c, 0x11, 0x0e, 0x11, 0x12, 0x11, 0x15, 0x11, 0x16, 0x11, 0x1f, 0x11, 0x2d, 0x11, 0x2f, 0x11,
    0x00, 0x12, 0x32, 0x11, 0x01, 0x05, 0x81, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

std::vector<uint8_t> pixel_3_xl_write_extended_inquiry_response_no_uuids{
    0x52, 0x0c, 0xf1, 0x01, 0x0b, 0x09, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x20, 0x33, 0x20, 0x58, 0x4c, 0x01, 0x03, 0x01,
    0x05, 0x81, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

std::vector<uint8_t> pixel_3_xl_write_extended_inquiry_response_no_uuids_just_eir{
    pixel_3_xl_write_extended_inquiry_response_no_uuids.begin() + 4,  // skip command, size, and fec_required
    pixel_3_xl_write_extended_inquiry_response_no_uuids.end()};

TEST(HciPacketsTest, testWriteExtendedInquiryResponse) {
  std::shared_ptr<std::vector<uint8_t>> packet_bytes =
      std::make_shared<std::vector<uint8_t>>(pixel_3_xl_write_extended_inquiry_response);

  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
  auto view = WriteExtendedInquiryResponseView::Create(CommandPacketView::Create(packet_bytes_view));
  ASSERT_TRUE(view.IsValid());
  auto gap_data = view.GetExtendedInquiryResponse();
  ASSERT_EQ(gap_data[0].data_type_, GapDataType::COMPLETE_LOCAL_NAME);
  ASSERT_EQ(gap_data[0].data_.size(), 10);
  ASSERT_EQ(gap_data[1].data_type_, GapDataType::COMPLETE_LIST_16_BIT_UUIDS);
  ASSERT_EQ(gap_data[1].data_.size(), 24);
  ASSERT_EQ(gap_data[2].data_type_, GapDataType::COMPLETE_LIST_32_BIT_UUIDS);
  ASSERT_EQ(gap_data[2].data_.size(), 0);
  ASSERT_EQ(gap_data[3].data_type_, GapDataType::COMPLETE_LIST_128_BIT_UUIDS);
  ASSERT_EQ(gap_data[3].data_.size(), 128);
}

//  TODO: Revisit reflection tests for EIR
// DEFINE_AND_INSTANTIATE_WriteExtendedInquiryResponseReflectionTest(pixel_3_xl_write_extended_inquiry_response,
// pixel_3_xl_write_extended_inquiry_response_no_uuids);
}  // namespace hci
}  // namespace bluetooth
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ cc_binary_host {
        "fields/fixed_scalar_field.cc",
        "fields/group_field.cc",
        "fields/packet_field.cc",
        "fields/padding_field.cc",
        "fields/payload_field.cc",
        "fields/reserved_field.cc",
        "fields/scalar_field.cc",
+12 −0
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@
class Declarations {
 public:
  void AddTypeDef(std::string name, TypeDef* def) {
    auto it = type_defs_.find(name);
    if (it != type_defs_.end()) {
      ERROR() << "Redefinition of Type " << name;
    }
    type_defs_.insert(std::pair(name, def));
    type_defs_queue_.push_back(std::pair(name, def));
  }
@@ -44,6 +48,10 @@ class Declarations {
  }

  void AddPacketDef(std::string name, PacketDef def) {
    auto it = packet_defs_.find(name);
    if (it != packet_defs_.end()) {
      ERROR() << "Redefinition of Packet " << name;
    }
    packet_defs_.insert(std::pair(name, def));
    packet_defs_queue_.push_back(std::pair(name, def));
  }
@@ -58,6 +66,10 @@ class Declarations {
  }

  void AddGroupDef(std::string name, FieldList* group_def) {
    auto it = group_defs_.find(name);
    if (it != group_defs_.end()) {
      ERROR() << "Redefinition of group " << name;
    }
    group_defs_.insert(std::pair(name, group_def));
  }

+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include "fields/fixed_enum_field.h"
#include "fields/fixed_scalar_field.h"
#include "fields/group_field.h"
#include "fields/padding_field.h"
#include "fields/payload_field.h"
#include "fields/reserved_field.h"
#include "fields/scalar_field.h"
Loading