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

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

Merge "gd: implement APIs of AdvertisingSet for LE 5.0"

parents 43548575 10666fb3
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -3145,7 +3145,7 @@ packet LeSetPeriodicAdvertisingData : LeAdvertisingCommand (op_code = LE_SET_PER
  operation : Operation,
  operation : Operation,
  _reserved_ : 5,
  _reserved_ : 5,
  _size_(scan_response_data) : 8,
  _size_(scan_response_data) : 8,
  scan_response_data : 8[],
  scan_response_data : GapData[],
}
}


packet LeSetPeriodicAdvertisingDataComplete : CommandComplete (command_op_code = LE_SET_PERIODIC_ADVERTISING_DATA) {
packet LeSetPeriodicAdvertisingDataComplete : CommandComplete (command_op_code = LE_SET_PERIODIC_ADVERTISING_DATA) {
+272 −41

File changed.

Preview size limit exceeded, changes collapsed.

+24 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@


#include <memory>
#include <memory>


#include "common/callback.h"
#include "hci/address_with_type.h"
#include "hci/address_with_type.h"
#include "hci/hci_packets.h"
#include "hci/hci_packets.h"
#include "module.h"
#include "module.h"
@@ -60,6 +61,15 @@ class ExtendedAdvertisingConfig : public AdvertisingConfig {
  ExtendedAdvertisingConfig(const AdvertisingConfig& config);
  ExtendedAdvertisingConfig(const AdvertisingConfig& config);
};
};


class PeriodicAdvertisingParameters {
 public:
  uint16_t min_interval;
  uint16_t max_interval;
  uint16_t properties;

  enum AdvertisingProperty { INCLUDE_TX_POWER = 0x06 };
};

using AdvertiserId = uint8_t;
using AdvertiserId = uint8_t;


class AdvertisingCallback {
class AdvertisingCallback {
@@ -89,6 +99,7 @@ class LeAdvertisingManager : public bluetooth::Module {
 public:
 public:
  static constexpr AdvertiserId kInvalidId = 0xFF;
  static constexpr AdvertiserId kInvalidId = 0xFF;
  static constexpr uint8_t kInvalidHandle = 0xFF;
  static constexpr uint8_t kInvalidHandle = 0xFF;
  static constexpr uint8_t kAdvertisingSetIdMask = 0x0F;
  LeAdvertisingManager();
  LeAdvertisingManager();


  size_t GetNumberOfAdvertisingInstances() const;
  size_t GetNumberOfAdvertisingInstances() const;
@@ -105,7 +116,19 @@ class LeAdvertisingManager : public bluetooth::Module {
      const common::Callback<void(ErrorCode, uint8_t, uint8_t)>& set_terminated_callback,
      const common::Callback<void(ErrorCode, uint8_t, uint8_t)>& set_terminated_callback,
      os::Handler* handler);
      os::Handler* handler);


  void RemoveAdvertiser(AdvertiserId id);
  void SetParameters(AdvertiserId advertiser_id, ExtendedAdvertisingConfig config);

  void SetData(AdvertiserId advertiser_id, bool set_scan_rsp, std::vector<GapData> data);

  void EnableAdvertiser(AdvertiserId advertiser_id, bool enable, uint16_t duration, uint8_t maxExtAdvEvents);

  void SetPeriodicParameters(AdvertiserId advertiser_id, PeriodicAdvertisingParameters periodic_advertising_parameters);

  void SetPeriodicData(AdvertiserId advertiser_id, std::vector<GapData> data);

  void EnablePeriodicAdvertising(AdvertiserId advertiser_id, bool enable);

  void RemoveAdvertiser(AdvertiserId advertiser_id);


  void RegisterAdvertisingCallback(AdvertisingCallback* advertising_callback);
  void RegisterAdvertisingCallback(AdvertisingCallback* advertising_callback);


+204 −6

File changed.

Preview size limit exceeded, changes collapsed.

+3 −1
Original line number Original line Diff line number Diff line
@@ -262,7 +262,8 @@ static bool subevent_already_registered_in_le_hci_layer(
    case bluetooth::hci::SubeventCode::ENHANCED_CONNECTION_COMPLETE:
    case bluetooth::hci::SubeventCode::ENHANCED_CONNECTION_COMPLETE:
    case bluetooth::hci::SubeventCode::PHY_UPDATE_COMPLETE:
    case bluetooth::hci::SubeventCode::PHY_UPDATE_COMPLETE:
    case bluetooth::hci::SubeventCode::REMOTE_CONNECTION_PARAMETER_REQUEST:
    case bluetooth::hci::SubeventCode::REMOTE_CONNECTION_PARAMETER_REQUEST:
      return bluetooth::shim::is_gd_acl_enabled();
      return bluetooth::shim::is_gd_acl_enabled() ||
             bluetooth::shim::is_gd_advertising_enabled();


    case bluetooth::hci::SubeventCode::READ_REMOTE_FEATURES_COMPLETE:
    case bluetooth::hci::SubeventCode::READ_REMOTE_FEATURES_COMPLETE:
    case bluetooth::hci::SubeventCode::READ_LOCAL_P256_PUBLIC_KEY_COMPLETE:
    case bluetooth::hci::SubeventCode::READ_LOCAL_P256_PUBLIC_KEY_COMPLETE:
@@ -293,6 +294,7 @@ static bool subevent_already_registered_in_le_hci_layer(
    case bluetooth::hci::SubeventCode::BIG_INFO_ADVERTISING_REPORT:
    case bluetooth::hci::SubeventCode::BIG_INFO_ADVERTISING_REPORT:
    case bluetooth::hci::SubeventCode::ADVERTISING_REPORT:
    case bluetooth::hci::SubeventCode::ADVERTISING_REPORT:
    case bluetooth::hci::SubeventCode::LONG_TERM_KEY_REQUEST:
    case bluetooth::hci::SubeventCode::LONG_TERM_KEY_REQUEST:
      return bluetooth::shim::is_gd_advertising_enabled();
    default:
    default:
      return false;
      return false;
  }
  }
Loading