Merge "Bluetooth 5 AdvertisingSet implementation (4/4)" am: 1317fe40e0
am: b2475c5afa
am: ff005ba330
Change-Id: I423311e19bead2f0fd8c9d54600be0917049f372
This commit is contained in:
commit
db18196a52
1 changed files with 28 additions and 10 deletions
|
@ -34,41 +34,59 @@ struct AdvertiseParameters {
|
|||
uint8_t scan_request_notification_enable;
|
||||
};
|
||||
|
||||
struct PeriodicAdvertisingParameters {
|
||||
uint8_t enable;
|
||||
uint16_t min_interval;
|
||||
uint16_t max_interval;
|
||||
uint16_t periodic_advertising_properties;
|
||||
};
|
||||
|
||||
class BleAdvertiserInterface {
|
||||
public:
|
||||
virtual ~BleAdvertiserInterface() = default;
|
||||
|
||||
/** Callback invoked when multi-adv operation has completed */
|
||||
using Callback = base::Callback<void(uint8_t /* status */)>;
|
||||
using StatusCallback = base::Callback<void(uint8_t /* status */)>;
|
||||
using IdStatusCallback =
|
||||
base::Callback<void(uint8_t /* advertiser_id */, uint8_t /* status */)>;
|
||||
|
||||
/** Registers an advertiser with the stack */
|
||||
virtual void RegisterAdvertiser(
|
||||
base::Callback<void(uint8_t /* advertiser_id */,
|
||||
uint8_t /* status */)>) = 0;
|
||||
virtual void RegisterAdvertiser(IdStatusCallback) = 0;
|
||||
|
||||
/* Set the parameters as per spec, user manual specified values */
|
||||
virtual void SetParameters(
|
||||
uint8_t advertiser_id, uint16_t advertising_event_properties,
|
||||
uint32_t min_interval, uint32_t max_interval, int chnl_map, int tx_power,
|
||||
uint8_t primary_advertising_phy, uint8_t secondary_advertising_phy,
|
||||
uint8_t scan_request_notification_enable, Callback cb) = 0;
|
||||
uint8_t scan_request_notification_enable, StatusCallback cb) = 0;
|
||||
|
||||
/* Setup the data */
|
||||
virtual void SetData(int advertiser_id, bool set_scan_rsp,
|
||||
std::vector<uint8_t> data, Callback cb) = 0;
|
||||
std::vector<uint8_t> data, StatusCallback cb) = 0;
|
||||
|
||||
/* Enable the advertising instance */
|
||||
virtual void Enable(uint8_t advertiser_id, bool enable, Callback cb,
|
||||
int timeout_s, Callback timeout_cb) = 0;
|
||||
virtual void Enable(uint8_t advertiser_id, bool enable, StatusCallback cb,
|
||||
int timeout_s, StatusCallback timeout_cb) = 0;
|
||||
|
||||
/* Unregisters an advertiser */
|
||||
virtual void Unregister(uint8_t advertiser_id) = 0;
|
||||
|
||||
virtual void StartAdvertising(uint8_t advertiser_id, Callback cb,
|
||||
virtual void StartAdvertising(uint8_t advertiser_id, StatusCallback cb,
|
||||
AdvertiseParameters params,
|
||||
std::vector<uint8_t> advertise_data,
|
||||
std::vector<uint8_t> scan_response_data,
|
||||
int timeout_s, Callback timeout_cb) = 0;
|
||||
int timeout_s, StatusCallback timeout_cb) = 0;
|
||||
|
||||
/** Start the advertising set. This include registering, setting all
|
||||
* parameters and data, and enabling it. |register_cb| is called when the set
|
||||
* is advertising. |timeout_cb| is called when the timeout_s have passed */
|
||||
virtual void StartAdvertisingSet(
|
||||
IdStatusCallback register_cb, AdvertiseParameters params,
|
||||
std::vector<uint8_t> advertise_data,
|
||||
std::vector<uint8_t> scan_response_data,
|
||||
PeriodicAdvertisingParameters periodic_params,
|
||||
std::vector<uint8_t> periodic_data, int timeout_s,
|
||||
IdStatusCallback timeout_cb) = 0;
|
||||
};
|
||||
|
||||
#endif /* ANDROID_INCLUDE_BLE_ADVERTISER_H */
|
||||
|
|
Loading…
Reference in a new issue