add conn_handle to Bluefruit.requestPairing()
remove Gap.requestPairing()
This commit is contained in:
10 files changed
+16
-22
No files matched your search
@@ -11,6 +11,7 @@
|
||||
- remove getPeerAddr(uint8_t[6]) variant
|
||||
- remove connInterval() is replaced by BLEConnection's getConnInterval()
|
||||
- Central.disconnect() is repalced by Bluefruit.disconnect()
|
||||
- add conn_handle to Bluefruit.requestPairing(), remove Gap.requestPairing()
|
||||
- Enhance Gap, add BLEConnection class to mange peer connection
|
||||
- Remove Gap.connected(), Gap.getRole() in prefer to BLEConnection API
|
||||
- Added setRssiCallback(), monitorRssi(), getRssi(), stopRssi() for tracking rssi of a connection
|
||||
|
||||
@@ -97,7 +97,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
Serial.println("Found it");
|
||||
|
||||
// HID device mostly require pairing/bonding
|
||||
if ( !Bluefruit.Gap.requestPairing(conn_handle) )
|
||||
if ( !Bluefruit.requestPairing(conn_handle) )
|
||||
{
|
||||
Serial.print("Failed to paired");
|
||||
return;
|
||||
|
||||
@@ -143,7 +143,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
|
||||
// ANCS requires pairing to work, it makes sense to request security here as well
|
||||
Serial.print("Attempting to PAIR with the iOS device, please press PAIR on your phone ... ");
|
||||
if ( Bluefruit.requestPairing() )
|
||||
if ( Bluefruit.requestPairing(conn_handle) )
|
||||
{
|
||||
Serial.println("Done");
|
||||
Serial.println("Enabling notifications");
|
||||
|
||||
@@ -276,7 +276,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
|
||||
oled.display();
|
||||
|
||||
if ( Bluefruit.requestPairing() )
|
||||
if ( Bluefruit.requestPairing(conn_handle) )
|
||||
{
|
||||
oled.println("OK");
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
|
||||
// iOS requires pairing to work, it makes sense to request security here as well
|
||||
Serial.print("Attempting to PAIR with the iOS device, please press PAIR on your phone ... ");
|
||||
if ( Bluefruit.requestPairing() )
|
||||
if ( Bluefruit.requestPairing(conn_handle) )
|
||||
{
|
||||
Serial.println("Done");
|
||||
Serial.println("Enabling Time Adjust Notify");
|
||||
|
||||
@@ -136,7 +136,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
|
||||
oled.display();
|
||||
|
||||
if ( Bluefruit.requestPairing() )
|
||||
if ( Bluefruit.requestPairing(conn_handle) )
|
||||
{
|
||||
oled.println("OK");
|
||||
|
||||
|
||||
@@ -152,14 +152,6 @@ bool BLEGap::setAddr(uint8_t mac[6], uint8_t type)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BLEGap::requestPairing(uint16_t conn_hdl)
|
||||
{
|
||||
BLEConnection* conn = _connection[conn_hdl];
|
||||
VERIFY(conn);
|
||||
|
||||
return conn->requestPairing();
|
||||
}
|
||||
|
||||
uint16_t BLEGap::getPeerName(uint16_t conn_hdl, char* buf, uint16_t bufsize)
|
||||
{
|
||||
return Bluefruit.Gatt.readCharByUuid(conn_hdl, BLEUuid(BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME), buf, bufsize);
|
||||
|
||||
@@ -72,8 +72,6 @@ class BLEGap
|
||||
|
||||
BLEConnection* Connection(uint16_t conn_hdl);
|
||||
uint16_t getMaxMtu(uint8_t role);
|
||||
|
||||
bool requestPairing (uint16_t conn_hdl);
|
||||
uint16_t getPeerName (uint16_t conn_hdl, char* buf, uint16_t bufsize);
|
||||
|
||||
void setRssiCallback(rssi_callback_t fp);
|
||||
|
||||
@@ -794,9 +794,12 @@ void AdafruitBluefruit::_setConnLed (bool on_off)
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Bonds
|
||||
*------------------------------------------------------------------*/
|
||||
bool AdafruitBluefruit::requestPairing(void)
|
||||
bool AdafruitBluefruit::requestPairing(uint16_t conn_hdl)
|
||||
{
|
||||
return Gap.requestPairing(_conn_hdl);
|
||||
BLEConnection* conn = Gap.Connection(conn_hdl);
|
||||
VERIFY(conn);
|
||||
|
||||
return conn->requestPairing();
|
||||
}
|
||||
|
||||
void AdafruitBluefruit::clearBonds(void)
|
||||
|
||||
@@ -151,16 +151,16 @@ class AdafruitBluefruit
|
||||
*------------------------------------------------------------------*/
|
||||
uint8_t connected (void); // Number of connected
|
||||
|
||||
bool connected (uint16_t conn_hdl);
|
||||
bool disconnect (uint16_t conn_hdl);
|
||||
ble_gap_addr_t getPeerAddr (uint16_t conn_hdl);
|
||||
|
||||
uint16_t connHandle (void);
|
||||
bool connPaired (void);
|
||||
|
||||
bool requestPairing (void);
|
||||
void clearBonds (void);
|
||||
|
||||
// Alias to BLEConnection API()
|
||||
bool connected (uint16_t conn_hdl);
|
||||
bool disconnect (uint16_t conn_hdl);
|
||||
ble_gap_addr_t getPeerAddr (uint16_t conn_hdl);
|
||||
bool requestPairing (uint16_t conn_hdl);
|
||||
|
||||
void printInfo(void);
|
||||
|
||||
|
||||
Reference in new issue
Block a user