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:
hathach committed 2017-07-12 13:40:15 +07:00
1 parent 412a2c9e9d
commit 0302d88a7a
12 files changed
+264 -99

No files matched your search

+6
View File
@@ -49,6 +49,11 @@ bool BLEGap::connected(uint16_t conn_handle)
return _peers[conn_handle].connected;
}
uint8_t BLEGap::getRole(uint16_t conn_handle)
{
return _peers[conn_handle].role;
}
void BLEGap::setConnectCallback(connect_callback_t fp, uint8_t role)
{
if (role == BLE_GAP_ROLE_PERIPH)
@@ -135,6 +140,7 @@ void BLEGap::_eventHandler(ble_evt_t* evt)
{
ble_gap_evt_disconnected_t const* para = &evt->evt.gap_evt.params.disconnected;
// mark as disconnected, but keep the role for sub sequence event handler
peer->connected = false;
vSemaphoreDelete( peer->txpacket_sem );