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

Commit 4735ede8 authored by Myles Watson's avatar Myles Watson
Browse files

HCI: AdvertisingType and AdvertisingEventType

Tag: #gd-refactor
Bug: 152346341
Test: gd/cert/run --host
Change-Id: Ida25d842a7ccbd01f4dc4dd06bf96ad5ecf53f8b
parent 7a961038
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ bool AdvertisingConfigFromProto(const AdvertisingConfig& config_proto, hci::Adve
  }
  config->interval_max = static_cast<uint16_t>(config_proto.interval_max());

  config->event_type = static_cast<hci::AdvertisingEventType>(config_proto.event_type());
  config->event_type = static_cast<hci::AdvertisingType>(config_proto.event_type());

  config->address_type = static_cast<::bluetooth::hci::AddressType>(config_proto.address_type());

+11 −3
Original line number Diff line number Diff line
@@ -2446,7 +2446,7 @@ enum PeerAddressType : 8 {
  RANDOM_DEVICE_OR_IDENTITY_ADDRESS = 0x01,
}

enum AdvertisingEventType : 8 {
enum AdvertisingType : 8 {
  ADV_IND = 0x00,
  ADV_DIRECT_IND = 0x01,
  ADV_SCAN_IND = 0x02,
@@ -2464,7 +2464,7 @@ enum AddressType : 8 {
packet LeSetAdvertisingParameters : LeAdvertisingCommand (op_code = LE_SET_ADVERTISING_PARAMETERS) {
  interval_min : 16,
  interval_max : 16,
  type : AdvertisingEventType,
  type : AdvertisingType,
  own_address_type : AddressType,
  peer_address_type : PeerAddressType,
  peer_address : Address,
@@ -3726,7 +3726,7 @@ packet LeMultiAdvtComplete : CommandComplete (command_op_code = LE_MULTI_ADVT) {
packet LeMultiAdvtParam : LeMultiAdvt (sub_cmd = SET_PARAM) {
  interval_min : 16,
  interval_max : 16,
  type : AdvertisingEventType,
  type : AdvertisingType,
  own_address_type : AddressType,
  peer_address_type : PeerAddressType,
  peer_address : Address,
@@ -4227,6 +4227,14 @@ packet LeConnectionComplete : LeMetaEvent (subevent_code = CONNECTION_COMPLETE)
  master_clock_accuracy : ClockAccuracy,
}

enum AdvertisingEventType : 8 {
  ADV_IND = 0x00,
  ADV_DIRECT_IND = 0x01,
  ADV_SCAN_IND = 0x02,
  ADV_NONCONN_IND = 0x03,
  SCAN_RESPONSE = 0x04,
}

struct LeAdvertisingReport {
  event_type : AdvertisingEventType,
  address_type : AddressType,
+7 −7
Original line number Diff line number Diff line
@@ -45,21 +45,21 @@ struct Advertiser {

ExtendedAdvertisingConfig::ExtendedAdvertisingConfig(const AdvertisingConfig& config) : AdvertisingConfig(config) {
  switch (config.event_type) {
    case AdvertisingEventType::ADV_IND:
    case AdvertisingType::ADV_IND:
      connectable = true;
      scannable = true;
      break;
    case AdvertisingEventType::ADV_DIRECT_IND:
    case AdvertisingType::ADV_DIRECT_IND:
      connectable = true;
      directed = true;
      high_duty_directed_connectable = true;
      break;
    case AdvertisingEventType::ADV_SCAN_IND:
    case AdvertisingType::ADV_SCAN_IND:
      scannable = true;
      break;
    case AdvertisingEventType::ADV_NONCONN_IND:
    case AdvertisingType::ADV_NONCONN_IND:
      break;
    case AdvertisingEventType::ADV_DIRECT_IND_LOW:
    case AdvertisingType::ADV_DIRECT_IND_LOW:
      connectable = true;
      directed = true;
      break;
@@ -509,8 +509,8 @@ AdvertiserId LeAdvertisingManager::CreateAdvertiser(
      LOG_WARN("Peer address can not be empty");
      return kInvalidId;
    }
    if (config.event_type == hci::AdvertisingEventType::ADV_DIRECT_IND ||
        config.event_type == hci::AdvertisingEventType::ADV_DIRECT_IND_LOW) {
    if (config.event_type == hci::AdvertisingType::ADV_DIRECT_IND ||
        config.event_type == hci::AdvertisingType::ADV_DIRECT_IND_LOW) {
      LOG_WARN("Peer address can not be empty for directed advertising");
      return kInvalidId;
    }
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ class AdvertisingConfig {
  std::vector<GapData> scan_response;
  uint16_t interval_min;
  uint16_t interval_max;
  AdvertisingEventType event_type;
  AdvertisingType event_type;
  AddressType address_type;
  PeerAddressType peer_address_type;
  Address peer_address;
+3 −3
Original line number Diff line number Diff line
@@ -354,7 +354,7 @@ TEST_F(LeExtendedAdvertisingManagerTest, startup_teardown) {}

TEST_F(LeAdvertisingManagerTest, create_advertiser_test) {
  AdvertisingConfig advertising_config{};
  advertising_config.event_type = AdvertisingEventType::ADV_IND;
  advertising_config.event_type = AdvertisingType::ADV_IND;
  advertising_config.address_type = AddressType::PUBLIC_DEVICE_ADDRESS;
  std::vector<GapData> gap_data{};
  GapData data_item{};
@@ -397,7 +397,7 @@ TEST_F(LeAdvertisingManagerTest, create_advertiser_test) {

TEST_F(LeAndroidHciAdvertisingManagerTest, create_advertiser_test) {
  AdvertisingConfig advertising_config{};
  advertising_config.event_type = AdvertisingEventType::ADV_IND;
  advertising_config.event_type = AdvertisingType::ADV_IND;
  advertising_config.address_type = AddressType::PUBLIC_DEVICE_ADDRESS;
  std::vector<GapData> gap_data{};
  GapData data_item{};
@@ -438,7 +438,7 @@ TEST_F(LeAndroidHciAdvertisingManagerTest, create_advertiser_test) {

TEST_F(LeExtendedAdvertisingManagerTest, create_advertiser_test) {
  ExtendedAdvertisingConfig advertising_config{};
  advertising_config.event_type = AdvertisingEventType::ADV_IND;
  advertising_config.event_type = AdvertisingType::ADV_IND;
  advertising_config.address_type = AddressType::PUBLIC_DEVICE_ADDRESS;
  std::vector<GapData> gap_data{};
  GapData data_item{};
Loading