Bluetooth: host: Add scan API for extended scanner
Add scanner API for extended scanner. This includes the options to scan on the LE Coded PHY for long range, configuring scan timeout with scan timeout callback and additional information received from the extended advertising report. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
f2d7b77e96
commit
69a82170c4
1 changed files with 56 additions and 3 deletions
|
@ -717,6 +717,15 @@ enum {
|
|||
/** Filter using whitelist. */
|
||||
BT_LE_SCAN_OPT_FILTER_WHITELIST = BIT(1),
|
||||
|
||||
/** Enable scan on coded PHY (Long Range).*/
|
||||
BT_LE_SCAN_OPT_CODED = BIT(2),
|
||||
|
||||
/** Disable scan on 1M phy.
|
||||
*
|
||||
* @note Requires @ref BT_LE_SCAN_OPT_CODED.
|
||||
*/
|
||||
BT_LE_SCAN_OPT_NO_1M = BIT(3),
|
||||
|
||||
BT_LE_SCAN_FILTER_DUPLICATE __deprecated =
|
||||
BT_LE_SCAN_OPT_FILTER_DUPLICATE,
|
||||
BT_LE_SCAN_FILTER_WHITELIST __deprecated =
|
||||
|
@ -749,18 +758,56 @@ struct bt_le_scan_param {
|
|||
|
||||
/** Scan window (N * 0.625 ms) */
|
||||
u16_t window;
|
||||
|
||||
/** Scan timeout (N * 10 ms)
|
||||
*
|
||||
* Application will be notified by the scan timeout callback.
|
||||
* Set zero to disable timeout.
|
||||
*/
|
||||
u16_t timeout;
|
||||
|
||||
/** Scan interval LE Coded PHY (N * 0.625 MS)
|
||||
*
|
||||
* Set zero to use same as LE 1M PHY scan interval.
|
||||
*/
|
||||
u16_t interval_coded;
|
||||
|
||||
/** Scan window LE Coded PHY (N * 0.625 MS)
|
||||
*
|
||||
* Set zero to use same as LE 1M PHY scan window.
|
||||
*/
|
||||
u16_t window_coded;
|
||||
};
|
||||
|
||||
/** LE advertisement packet information */
|
||||
struct bt_le_scan_recv_info {
|
||||
/** Advertiser LE address and type */
|
||||
/** Advertiser LE address and type.
|
||||
*
|
||||
* If advertiser is anonymous then this address will be
|
||||
* @ref BT_ADDR_LE_ANY.
|
||||
*/
|
||||
const bt_addr_le_t *addr;
|
||||
|
||||
/** Strength of advertiser signal */
|
||||
/* Advertising Set Identifier. */
|
||||
u8_t sid;
|
||||
|
||||
/** Strength of advertiser signal. */
|
||||
s8_t rssi;
|
||||
|
||||
/** Advertising packet type */
|
||||
/** Transmit power of the advertiser. */
|
||||
s8_t tx_power;
|
||||
|
||||
/** Advertising packet type. */
|
||||
u8_t adv_type;
|
||||
|
||||
/** Advertising packet properties. */
|
||||
u16_t adv_props;
|
||||
|
||||
/* Primary advertising channel PHY. */
|
||||
u8_t primary_phy;
|
||||
|
||||
/* Secondary advertising channel PHY. */
|
||||
u8_t secondary_phy;
|
||||
};
|
||||
|
||||
/** Listener context for (LE) scanning. */
|
||||
|
@ -774,6 +821,9 @@ struct bt_le_scan_cb {
|
|||
void (*recv)(const struct bt_le_scan_recv_info *info,
|
||||
struct net_buf_simple *buf);
|
||||
|
||||
/** @brief The scanner has stopped scanning after scan timeout. */
|
||||
void (*timeout)(void);
|
||||
|
||||
sys_snode_t node;
|
||||
};
|
||||
|
||||
|
@ -791,6 +841,9 @@ struct bt_le_scan_cb {
|
|||
.options = (_options), \
|
||||
.interval = (_interval), \
|
||||
.window = (_window), \
|
||||
.timeout = 0, \
|
||||
.interval_coded = 0, \
|
||||
.window_coded = 0, \
|
||||
} })
|
||||
|
||||
/** Helper macro to enable active scanning to discover new devices. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue