Merge "Bluetooth 5 AdvertisingSet implementation (4/4)"
am: 1317fe40e0
Change-Id: I6642bb6214f9d23e9a2a9b6c6bb3a690e9d69112
This commit is contained in:
commit
b2475c5afa
1 changed files with 28 additions and 10 deletions
|
@ -34,41 +34,59 @@ struct AdvertiseParameters {
|
||||||
uint8_t scan_request_notification_enable;
|
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 {
|
class BleAdvertiserInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~BleAdvertiserInterface() = default;
|
virtual ~BleAdvertiserInterface() = default;
|
||||||
|
|
||||||
/** Callback invoked when multi-adv operation has completed */
|
/** 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 */
|
/** Registers an advertiser with the stack */
|
||||||
virtual void RegisterAdvertiser(
|
virtual void RegisterAdvertiser(IdStatusCallback) = 0;
|
||||||
base::Callback<void(uint8_t /* advertiser_id */,
|
|
||||||
uint8_t /* status */)>) = 0;
|
|
||||||
|
|
||||||
/* Set the parameters as per spec, user manual specified values */
|
/* Set the parameters as per spec, user manual specified values */
|
||||||
virtual void SetParameters(
|
virtual void SetParameters(
|
||||||
uint8_t advertiser_id, uint16_t advertising_event_properties,
|
uint8_t advertiser_id, uint16_t advertising_event_properties,
|
||||||
uint32_t min_interval, uint32_t max_interval, int chnl_map, int tx_power,
|
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 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 */
|
/* Setup the data */
|
||||||
virtual void SetData(int advertiser_id, bool set_scan_rsp,
|
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 */
|
/* Enable the advertising instance */
|
||||||
virtual void Enable(uint8_t advertiser_id, bool enable, Callback cb,
|
virtual void Enable(uint8_t advertiser_id, bool enable, StatusCallback cb,
|
||||||
int timeout_s, Callback timeout_cb) = 0;
|
int timeout_s, StatusCallback timeout_cb) = 0;
|
||||||
|
|
||||||
/* Unregisters an advertiser */
|
/* Unregisters an advertiser */
|
||||||
virtual void Unregister(uint8_t advertiser_id) = 0;
|
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,
|
AdvertiseParameters params,
|
||||||
std::vector<uint8_t> advertise_data,
|
std::vector<uint8_t> advertise_data,
|
||||||
std::vector<uint8_t> scan_response_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 */
|
#endif /* ANDROID_INCLUDE_BLE_ADVERTISER_H */
|
||||||
|
|
Loading…
Reference in a new issue