add AdvertisementType_t
This commit is contained in:
parent
78d7b675f2
commit
06529208f5
3 changed files with 48 additions and 1 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "blecommon.h"
|
||||
#include "Gap.h"
|
||||
#include "GattServer.h"
|
||||
#include "GapScanningParams.h"
|
||||
#include "BLEDeviceInstanceBase.h"
|
||||
|
||||
/**
|
||||
|
@ -231,6 +232,36 @@ public:
|
|||
*/
|
||||
ble_error_t stopAdvertising(void);
|
||||
|
||||
/**
|
||||
* Setup parameters for GAP scanning--i.e. observer mode.
|
||||
* @param interval Scan interval (in milliseconds) [valid values lie between 2.5ms and 10.24s].
|
||||
* @param window Scan Window (in milliseconds) [valid values lie between 2.5ms and 10.24s].
|
||||
* @param timeout Scan timeout (in seconds) between 0x0001 and 0xFFFF, 0x0000 disables timeout.
|
||||
*/
|
||||
ble_error_t setScanningParams(uint16_t interval = GapScanningParams::SCAN_INTERVAL_MAX,
|
||||
uint16_t window = GapScanningParams::SCAN_WINDOW_MAX,
|
||||
uint16_t timeout = 0);
|
||||
ble_error_t setScanningInterval(uint16_t interval);
|
||||
ble_error_t setScanningWindow(uint16_t window);
|
||||
ble_error_t setScanningTimeout(uint16_t timeout);
|
||||
|
||||
/**
|
||||
* Start scanning (Observer Procedure) based on the scan-params currently
|
||||
* in effect.
|
||||
*
|
||||
* @param callback The application callback to be invoked upon receiving
|
||||
* every advertisement report. Can be passed in as NULL, in which case
|
||||
* scanning may not be enabled at all.
|
||||
*/
|
||||
ble_error_t startScanning(Gap::AdvertisementReportCallback_t callback);
|
||||
|
||||
/**
|
||||
* Stop scanning. The current scanning parameters remain in effect.
|
||||
*
|
||||
* @retval BLE_ERROR_NONE if successfully stopped scanning procedure.
|
||||
*/
|
||||
ble_error_t stopScanning(void);
|
||||
|
||||
/**
|
||||
* This call initiates the disconnection procedure, and its completion will
|
||||
* be communicated to the application with an invocation of the
|
||||
|
@ -544,6 +575,8 @@ private:
|
|||
* eventually result in a call to the target's setAdvertisingData() before
|
||||
* the server begins advertising. This flag marks the status of the pending update.*/
|
||||
bool needToSetAdvPayload;
|
||||
|
||||
GapScanningParams scanningParams;
|
||||
};
|
||||
|
||||
/* BLEDevice methods. Most of these simply forward the calls to the underlying
|
||||
|
|
14
public/Gap.h
14
public/Gap.h
|
@ -38,6 +38,13 @@ public:
|
|||
typedef uint8_t Address_t[ADDR_LEN]; /* 48-bit address, LSB format. */
|
||||
typedef Address_t address_t; /* @Note: deprecated. */
|
||||
|
||||
enum AdvertisementType_t {
|
||||
ADV_IND = 0x00, /**< Connectable undirected. */
|
||||
ADV_DIRECT_IND = 0x01, /**< Connectable directed. */
|
||||
ADV_SCAN_IND = 0x02, /**< Scannable undirected. */
|
||||
ADV_NONCONN_IND = 0x03, /**< Non connectable undirected. */
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration for disconnection reasons. The values for these reasons are
|
||||
* derived from Nordic's implementation; but the reasons are meant to be
|
||||
|
@ -143,6 +150,13 @@ public:
|
|||
typedef void (*LinkSecuredCallback_t)(Handle_t handle, SecurityMode_t securityMode);
|
||||
typedef void (*PasskeyDisplayCallback_t)(Handle_t handle, const Passkey_t passkey);
|
||||
|
||||
typedef void (*AdvertisementReportCallback_t)(const address_t peerAddr,
|
||||
int8_t rssi,
|
||||
bool isScanResponse,
|
||||
AdvertisementType_t type,
|
||||
uint8_t *advertisingDataLenPtr,
|
||||
const uint8_t **advertisingDataPtr);
|
||||
|
||||
friend class BLEDevice;
|
||||
|
||||
private:
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
}
|
||||
|
||||
void setInterval(uint16_t newInterval) {_interval = newInterval;}
|
||||
void setWindow(uint16_t newInterval) {_window = newWindow; }
|
||||
void setWindow(uint16_t newWindow) {_window = newWindow; }
|
||||
void setTimeout(uint16_t newTimeout) {_timeout = newTimeout; }
|
||||
|
||||
uint16_t getInterval(void) const {return _interval;}
|
||||
|
|
Loading…
Reference in a new issue