mirror of https://github.com/ARMmbed/mbed-os.git
whitelist feature
parent
bc69e15638
commit
33e8826361
|
@ -394,6 +394,7 @@ public:
|
|||
return _peerAddressType;
|
||||
};
|
||||
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
/** Set the filter policy of whitelist use during advertising;
|
||||
*
|
||||
* @param mode Policy to use.
|
||||
|
@ -414,6 +415,17 @@ public:
|
|||
{
|
||||
return _policy;
|
||||
}
|
||||
#else
|
||||
AdvertisingParameters &setFilter(advertising_filter_policy_t mode)
|
||||
{
|
||||
#error "Whitelist feature disabled"
|
||||
}
|
||||
|
||||
advertising_filter_policy_t getFilter() const
|
||||
{
|
||||
return advertising_filter_policy_t::NO_FILTER;
|
||||
}
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
|
||||
/* Extended advertising parameters */
|
||||
|
||||
|
|
|
@ -208,20 +208,6 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the whitelist should be used to find the peer.
|
||||
*
|
||||
* @param filterPolicy The initiator filter to apply.
|
||||
*
|
||||
* @return A reference to this.
|
||||
*/
|
||||
ConnectionParameters &setFilter(initiator_filter_policy_t filterPolicy)
|
||||
{
|
||||
_filterPolicy = filterPolicy;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable PHYs.
|
||||
*
|
||||
|
@ -277,16 +263,6 @@ public:
|
|||
return _ownAddressType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the initiator policy.
|
||||
*
|
||||
* @return The initiator policy.
|
||||
*/
|
||||
initiator_filter_policy_t getFilter() const
|
||||
{
|
||||
return _filterPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of PHY enabled.
|
||||
* @return The number of PHY enabled.
|
||||
|
@ -300,6 +276,42 @@ public:
|
|||
);
|
||||
}
|
||||
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
/**
|
||||
* Set if the whitelist should be used to find the peer.
|
||||
*
|
||||
* @param filterPolicy The initiator filter to apply.
|
||||
*
|
||||
* @return A reference to this.
|
||||
*/
|
||||
ConnectionParameters &setFilter(initiator_filter_policy_t filterPolicy)
|
||||
{
|
||||
_filterPolicy = filterPolicy;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the initiator policy.
|
||||
*
|
||||
* @return The initiator policy.
|
||||
*/
|
||||
initiator_filter_policy_t getFilter() const
|
||||
{
|
||||
return _filterPolicy;
|
||||
}
|
||||
#else
|
||||
ConnectionParameters &setFilter(initiator_filter_policy_t filterPolicy)
|
||||
{
|
||||
#error "Whitelist feature disabled"
|
||||
}
|
||||
|
||||
initiator_filter_policy_t getFilter() const
|
||||
{
|
||||
return initiator_filter_policy_t::NO_FILTER;
|
||||
}
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
phy_set_t getPhySet() const
|
||||
|
|
|
@ -157,6 +157,7 @@ public:
|
|||
return own_address_type;
|
||||
}
|
||||
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
/**
|
||||
* Set the filter to apply during scanning.
|
||||
* @param filter_policy The filter to apply during scanning.
|
||||
|
@ -175,7 +176,17 @@ public:
|
|||
{
|
||||
return scanning_filter_policy;
|
||||
}
|
||||
#else
|
||||
ScanParameters &setFilter(scanning_filter_policy_t filter_policy))
|
||||
{
|
||||
#error "Whitelist feature disabled"
|
||||
}
|
||||
|
||||
scanning_filter_policy_t getFilter() const
|
||||
{
|
||||
return scanning_filter_policy_t::NO_FILTER;
|
||||
}
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
/**
|
||||
* Enable or disable PHYs that should be used during scanning.
|
||||
* @param enable_1m True to enable the 1M phy and false to disable it.
|
||||
|
|
|
@ -795,7 +795,9 @@ private:
|
|||
pal::initiator_policy_t _initiator_policy_mode;
|
||||
pal::scanning_filter_policy_t _scanning_filter_policy;
|
||||
pal::advertising_filter_policy_t _advertising_filter_policy;
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
mutable Whitelist_t _whitelist;
|
||||
#endif
|
||||
|
||||
bool _privacy_enabled;
|
||||
PeripheralPrivacyConfiguration_t _peripheral_privacy_configuration;
|
||||
|
|
|
@ -88,10 +88,12 @@ ble_error_t Gap<EventHandler>::set_advertising_parameters_(
|
|||
advertising_channel_map.value()
|
||||
);
|
||||
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
DmDevSetFilterPolicy(
|
||||
DM_FILT_POLICY_MODE_ADV,
|
||||
advertising_filter_policy.value()
|
||||
);
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
|
||||
DmAdvConfig(
|
||||
DM_ADV_HANDLE_DEFAULT,
|
||||
|
@ -162,10 +164,12 @@ ble_error_t Gap<EventHandler>::set_scan_parameters_(
|
|||
use_active_scanning = active_scanning;
|
||||
DmScanSetInterval(HCI_INIT_PHY_LE_1M_BIT, &scan_interval, &scan_window);
|
||||
DmScanSetAddrType(own_address_type.value());
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
DmDevSetFilterPolicy(
|
||||
DM_FILT_POLICY_MODE_SCAN,
|
||||
filter_policy.value()
|
||||
);
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
@ -208,7 +212,9 @@ ble_error_t Gap<EventHandler>::create_connection_(
|
|||
)
|
||||
{
|
||||
DmConnSetScanInterval(scan_interval, scan_window);
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
DmDevSetFilterPolicy(DM_FILT_POLICY_MODE_INIT, initiator_policy.value());
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
DmConnSetAddrType(own_address_type.value());
|
||||
|
||||
hciConnSpec_t conn_spec = {
|
||||
|
@ -1018,10 +1024,12 @@ ble_error_t Gap<EventHandler>::set_extended_scan_parameters_(
|
|||
const_cast<uint16_t *>(scan_window)
|
||||
);
|
||||
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
DmDevSetFilterPolicy(
|
||||
DM_FILT_POLICY_MODE_SCAN,
|
||||
filter_policy.value()
|
||||
);
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
@ -1163,8 +1171,9 @@ ble_error_t Gap<EventHandler>::extended_create_connection_(
|
|||
const_cast<uint16_t *>(scan_intervals),
|
||||
const_cast<uint16_t *>(scan_windows)
|
||||
);
|
||||
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
DmDevSetFilterPolicy(DM_FILT_POLICY_MODE_INIT, initiator_policy.value());
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
DmConnSetAddrType(own_address_type.value());
|
||||
|
||||
// At most 3 phys are in used
|
||||
|
|
Loading…
Reference in New Issue