mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #14710 from noonfom/non-low-power-devices
BLE: support non-low power devicespull/14720/head
commit
0738aabb87
|
|
@ -745,7 +745,7 @@ void BLEInstanceBase::callDispatcher()
|
|||
|
||||
wsfOsDispatcher();
|
||||
|
||||
static mbed::LowPowerTimeout nextTimeout;
|
||||
static Timeout nextTimeout;
|
||||
mbed::CriticalSectionLock critical_section;
|
||||
|
||||
if (wsfOsReadyToSleep()) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,13 @@
|
|||
#include "source/PalPrivateAddressControllerImpl.h"
|
||||
#include "source/generic/PrivateAddressController.h"
|
||||
|
||||
#include "drivers/Timeout.h"
|
||||
#ifdef DEVICE_LPTICKER
|
||||
#include "drivers/LowPowerTimeout.h"
|
||||
#include "drivers/LowPowerTimer.h"
|
||||
#else
|
||||
#include "drivers/Timer.h"
|
||||
#endif
|
||||
|
||||
namespace ble {
|
||||
|
||||
|
|
@ -57,6 +63,14 @@ namespace impl {
|
|||
* @see BLEInstanceBase
|
||||
*/
|
||||
class BLEInstanceBase final : public ble::BLEInstanceBase {
|
||||
#ifdef DEVICE_LPTICKER
|
||||
using Timeout = mbed::LowPowerTimeout;
|
||||
using Timer = mbed::LowPowerTimer;
|
||||
#else
|
||||
using Timeout = mbed::Timeout;
|
||||
using Timer = mbed::Timer;
|
||||
#endif
|
||||
|
||||
friend PalSigningMonitor;
|
||||
|
||||
/**
|
||||
|
|
@ -200,7 +214,7 @@ private:
|
|||
} initialization_status;
|
||||
|
||||
mutable ble::impl::PalEventQueue _event_queue;
|
||||
mbed::LowPowerTimer _timer;
|
||||
Timer _timer;
|
||||
uint64_t _last_update_us;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "drivers/LowPowerTimeout.h"
|
||||
#include "drivers/LowPowerTicker.h"
|
||||
#include "platform/mbed_error.h"
|
||||
|
||||
#include "ble/common/BLERoles.h"
|
||||
|
|
@ -43,6 +41,14 @@
|
|||
|
||||
#include "ble/Gap.h"
|
||||
|
||||
#ifdef DEVICE_LPTICKER
|
||||
#include "drivers/LowPowerTimeout.h"
|
||||
#include "drivers/LowPowerTicker.h"
|
||||
#else
|
||||
#include "drivers/Timeout.h"
|
||||
#include "drivers/Ticker.h"
|
||||
#endif
|
||||
|
||||
namespace ble {
|
||||
|
||||
class PalGenericAccessService;
|
||||
|
|
@ -75,6 +81,14 @@ class Gap :
|
|||
public:
|
||||
using PreferredConnectionParams_t = ::ble::Gap::PreferredConnectionParams_t ;
|
||||
|
||||
#ifdef DEVICE_LPTICKER
|
||||
using Timeout = mbed::LowPowerTimeout;
|
||||
using Ticker = mbed::LowPowerTicker;
|
||||
#else
|
||||
using Timeout = mbed::Timeout;
|
||||
using Ticker = mbed::Ticker;
|
||||
#endif
|
||||
|
||||
#if BLE_FEATURE_PRIVACY
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
/**
|
||||
|
|
@ -927,9 +941,9 @@ private:
|
|||
ConnectionParameters *_connect_to_host_resolved_address_parameters = nullptr;
|
||||
#endif // BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
|
||||
|
||||
mbed::LowPowerTimeout _advertising_timeout;
|
||||
mbed::LowPowerTimeout _scan_timeout;
|
||||
mbed::LowPowerTicker _address_rotation_ticker;
|
||||
Timeout _advertising_timeout;
|
||||
Timeout _scan_timeout;
|
||||
Ticker _address_rotation_ticker;
|
||||
|
||||
bool _initiating = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,12 +22,17 @@
|
|||
|
||||
#include <cstdio>
|
||||
|
||||
#include "drivers/LowPowerTicker.h"
|
||||
#include "ble/common/BLETypes.h"
|
||||
#include "ble/common/blecommon.h"
|
||||
#include "source/pal/PalEventQueue.h"
|
||||
#include "source/pal/PalPrivateAddressController.h"
|
||||
|
||||
#ifdef DEVICE_LPTICKER
|
||||
#include "drivers/LowPowerTicker.h"
|
||||
#else
|
||||
#include "drivers/Ticker.h"
|
||||
#endif
|
||||
|
||||
namespace ble {
|
||||
|
||||
/**
|
||||
|
|
@ -38,6 +43,12 @@ namespace ble {
|
|||
*/
|
||||
class PrivateAddressController : private PalPrivateAddressController::EventHandler {
|
||||
public:
|
||||
#ifdef DEVICE_LPTICKER
|
||||
using Ticker = mbed::LowPowerTicker;
|
||||
#else
|
||||
using Ticker = mbed::Ticker;
|
||||
#endif
|
||||
|
||||
struct EventHandler {
|
||||
/**
|
||||
* Called when a new resolvable private address has been generated.
|
||||
|
|
@ -313,7 +324,7 @@ private:
|
|||
bool _generation_started;
|
||||
irk_t _local_irk = {};
|
||||
EventHandler *_event_handler = nullptr;
|
||||
mbed::LowPowerTicker _address_rotation_ticker;
|
||||
Ticker _address_rotation_ticker;
|
||||
address_t _resolvable_address = {};
|
||||
address_t _non_resolvable_address = {};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue