enhance advertising
- Separate BLEAdvertisingData & BLEAdvertising - add setType(), setTimeout(), setInterval(), setIntervalMS() - add setStopCallback() support - Add option to only advertising for a specific time (in multiple of timeout) using start(stop_sec) - default timeout = 30 second, fast = 20 ms, slow = 152.5 ms
This commit is contained in:
1 parent
412a2c9e9d
commit
0302d88a7a
12 files changed
+264
-99
No files matched your search
@@ -71,13 +71,13 @@ bool BLECentral::startScanning(uint16_t timeout)
|
||||
{
|
||||
_scan_param.timeout = timeout;
|
||||
VERIFY_STATUS( sd_ble_gap_scan_start(&_scan_param), false );
|
||||
Bluefruit.startConnLed(); // start blinking
|
||||
Bluefruit._startConnLed(); // start blinking
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
bool BLECentral::stopScanning(void)
|
||||
{
|
||||
Bluefruit.stopConnLed(); // stop blinking
|
||||
Bluefruit._stopConnLed(); // stop blinking
|
||||
VERIFY_STATUS( sd_ble_gap_scan_stop(), false );
|
||||
return true;
|
||||
}
|
||||
@@ -245,15 +245,15 @@ void BLECentral::_event_handler(ble_evt_t* evt)
|
||||
|
||||
if (para->role == BLE_GAP_ROLE_CENTRAL)
|
||||
{
|
||||
Bluefruit.stopConnLed();
|
||||
if (Bluefruit._led_conn) ledOn(LED_BLUE);
|
||||
Bluefruit._stopConnLed();
|
||||
Bluefruit._setConnLed(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_DISCONNECTED:
|
||||
// Note callback is invoked by BLEGap
|
||||
if (Bluefruit._led_conn) ledOff(LED_BLUE);
|
||||
Bluefruit._setConnLed(false);
|
||||
_conn_hdl = BLE_CONN_HANDLE_INVALID;
|
||||
startScanning();
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user