mirror of https://github.com/ARMmbed/mbed-os.git
BLE: revert GapScanningParams
parent
61536c3f64
commit
2c7cf2bbd9
|
@ -17,9 +17,6 @@
|
|||
#ifndef MBED_GAP_SCANNING_PARAMS_H__
|
||||
#define MBED_GAP_SCANNING_PARAMS_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "ble/blecommon.h"
|
||||
|
||||
/**
|
||||
* @addtogroup ble
|
||||
* @{
|
||||
|
@ -111,16 +108,10 @@ public:
|
|||
* @note If interval is equal to window
|
||||
*/
|
||||
GapScanningParams(
|
||||
uint16_t interval = 0,
|
||||
uint16_t window = 0,
|
||||
uint16_t interval = SCAN_INTERVAL_MAX,
|
||||
uint16_t window = SCAN_WINDOW_MAX,
|
||||
uint16_t timeout = 0,
|
||||
bool activeScanning = false,
|
||||
ble::scanning_policy_mode_t policy = ble::SCAN_POLICY_IGNORE_WHITELIST,
|
||||
uint16_t codedInterval = 0,
|
||||
uint16_t codedWindow = 0,
|
||||
uint16_t codedTimeout = 0,
|
||||
bool codedActiveScanning = false,
|
||||
ble::scanning_policy_mode_t codedPolicy = ble::SCAN_POLICY_IGNORE_WHITELIST
|
||||
bool activeScanning = false
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -212,15 +203,7 @@ public:
|
|||
*/
|
||||
bool getActiveScanning(void) const
|
||||
{
|
||||
return _active_scanning;
|
||||
}
|
||||
|
||||
ble::scanning_policy_mode_t getScanningPolicy() {
|
||||
return _policy;
|
||||
}
|
||||
|
||||
void setScanningPolicy(ble::scanning_policy_mode_t policy) {
|
||||
_policy = policy;
|
||||
return _activeScanning;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -239,34 +222,15 @@ private:
|
|||
*/
|
||||
uint16_t _timeout;
|
||||
|
||||
/**
|
||||
* Scan interval in units of 625us (between 2.5ms and 10.24s).
|
||||
*/
|
||||
uint16_t _interval_coded;
|
||||
|
||||
/**
|
||||
* Scan window in units of 625us (between 2.5ms and 10.24s).
|
||||
*/
|
||||
uint16_t _window_coded;
|
||||
|
||||
/**
|
||||
* Scan timeout between 0x0001 and 0xFFFF in seconds; 0x0000 disables timeout.
|
||||
*/
|
||||
uint16_t _timeout_coded;
|
||||
|
||||
ble::scanning_policy_mode_t _policy;
|
||||
ble::scanning_policy_mode_t _policy_coded;
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the peer device's advertising data and (if possible) scanResponse.
|
||||
*/
|
||||
uint8_t _active_scanning:1;
|
||||
uint8_t _active_scanning_coded:1;
|
||||
|
||||
uint8_t _phy_1m:1;
|
||||
uint8_t _phy_coded:1;
|
||||
bool _activeScanning;
|
||||
|
||||
private:
|
||||
/* Disallow copy constructor. */
|
||||
GapScanningParams(const GapScanningParams &);
|
||||
GapScanningParams& operator =(const GapScanningParams &in);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,31 +17,11 @@
|
|||
#include "ble/Gap.h"
|
||||
#include "ble/GapScanningParams.h"
|
||||
|
||||
GapScanningParams::GapScanningParams(
|
||||
uint16_t interval,
|
||||
uint16_t window,
|
||||
uint16_t timeout,
|
||||
bool activeScanning,
|
||||
ble::scanning_policy_mode_t policy,
|
||||
uint16_t codedInterval,
|
||||
uint16_t codedWindow,
|
||||
uint16_t codedTimeout,
|
||||
bool codedActiveScanning,
|
||||
ble::scanning_policy_mode_t codedPolicy
|
||||
) :
|
||||
GapScanningParams::GapScanningParams(uint16_t interval, uint16_t window, uint16_t timeout, bool activeScanning) :
|
||||
_interval(MSEC_TO_SCAN_DURATION_UNITS(interval)),
|
||||
_window(MSEC_TO_SCAN_DURATION_UNITS(window)),
|
||||
_timeout(timeout),
|
||||
_active_scanning(activeScanning),
|
||||
_policy(policy),
|
||||
_interval_coded(MSEC_TO_SCAN_DURATION_UNITS(codedWindow)),
|
||||
_window_coded(MSEC_TO_SCAN_DURATION_UNITS(codedWindow)),
|
||||
_timeout_coded(codedTimeout),
|
||||
_active_scanning_coded(codedActiveScanning),
|
||||
_policy_coded(codedPolicy),
|
||||
_phy_1m(window != 0),
|
||||
_phy_coded(codedWindow != 0) {
|
||||
//TODO: refactor
|
||||
_activeScanning(activeScanning) {
|
||||
/* stay within limits */
|
||||
if (_interval < SCAN_INTERVAL_MIN) {
|
||||
_interval = SCAN_INTERVAL_MIN;
|
||||
|
@ -55,19 +35,6 @@ GapScanningParams::GapScanningParams(
|
|||
if (_window > SCAN_WINDOW_MAX) {
|
||||
_window = SCAN_WINDOW_MAX;
|
||||
}
|
||||
|
||||
if (_interval_coded < SCAN_INTERVAL_MIN) {
|
||||
_interval_coded = SCAN_INTERVAL_MIN;
|
||||
}
|
||||
if (_interval_coded > SCAN_INTERVAL_MAX) {
|
||||
_interval_coded = SCAN_INTERVAL_MAX;
|
||||
}
|
||||
if (_window_coded < SCAN_WINDOW_MIN) {
|
||||
_window_coded = SCAN_WINDOW_MIN;
|
||||
}
|
||||
if (_window_coded > SCAN_WINDOW_MAX) {
|
||||
_window_coded = SCAN_WINDOW_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
ble_error_t
|
||||
|
@ -104,5 +71,5 @@ GapScanningParams::setTimeout(uint16_t newTimeout)
|
|||
void
|
||||
GapScanningParams::setActiveScanning(bool activeScanning)
|
||||
{
|
||||
_active_scanning = activeScanning;
|
||||
_activeScanning = activeScanning;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue