Gap.getPeerName() is replaced by Bluefruit.getPeerName()
This commit is contained in:
13 files changed
+19
-20
No files matched your search
@@ -12,6 +12,8 @@
|
||||
- remove connInterval() is replaced by BLEConnection's getConnInterval()
|
||||
- Central.disconnect() is repalced by Bluefruit.disconnect()
|
||||
- add conn_handle to Bluefruit.requestPairing(), remove Gap.requestPairing()
|
||||
- Gap.setAddr()/getAddr() are replaced by Bluefruit's setAddr()/getAddr()
|
||||
- Gap.getPeerName() is replaced by Bluefruit.getPeerName()
|
||||
- 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
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
prph_info_t* peer = &prphs[id];
|
||||
peer->conn_handle = conn_handle;
|
||||
|
||||
Bluefruit.Gap.getPeerName(conn_handle, peer->name, sizeof(peer->name)-1);
|
||||
Bluefruit.getPeerName(conn_handle, peer->name, sizeof(peer->name)-1);
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(peer->name);
|
||||
|
||||
@@ -116,7 +116,7 @@ void loop()
|
||||
void prph_connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char peer_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(conn_handle, peer_name, sizeof(peer_name));
|
||||
Bluefruit.getPeerName(conn_handle, peer_name, sizeof(peer_name));
|
||||
|
||||
Serial.print("[Prph] Connected to ");
|
||||
Serial.println(peer_name);
|
||||
@@ -163,7 +163,7 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
|
||||
void cent_connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char peer_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(conn_handle, peer_name, sizeof(peer_name));
|
||||
Bluefruit.getPeerName(conn_handle, peer_name, sizeof(peer_name));
|
||||
|
||||
Serial.print("[Cent] Connected to ");
|
||||
Serial.println(peer_name);;
|
||||
|
||||
@@ -120,7 +120,7 @@ void loop()
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char central_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
Bluefruit.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(central_name);
|
||||
|
||||
@@ -162,7 +162,7 @@ void setupHRM(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char central_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
Bluefruit.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(central_name);
|
||||
|
||||
@@ -152,7 +152,7 @@ void setupHTM(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char central_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
Bluefruit.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(central_name);
|
||||
|
||||
@@ -134,7 +134,7 @@ void startAdv(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char central_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
Bluefruit.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(central_name);
|
||||
|
||||
@@ -110,7 +110,7 @@ void startAdv(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char central_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
Bluefruit.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(central_name);
|
||||
|
||||
@@ -119,11 +119,6 @@ BLEConnection* BLEGap::Connection(uint16_t conn_hdl)
|
||||
return (conn_hdl < BLE_MAX_CONNECTION) ?_connection[conn_hdl] : NULL;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void BLEGap::setRssiCallback(rssi_callback_t fp)
|
||||
{
|
||||
_rssi_cb = fp;
|
||||
|
||||
@@ -70,14 +70,8 @@ class BLEGap
|
||||
|
||||
BLEConnection* Connection(uint16_t conn_hdl);
|
||||
uint16_t getMaxMtu(uint8_t role);
|
||||
uint16_t getPeerName (uint16_t conn_hdl, char* buf, uint16_t bufsize);
|
||||
|
||||
void setRssiCallback(rssi_callback_t fp);
|
||||
|
||||
// bool startRssi(uint16_t conn_hdl, uint8_t );
|
||||
// bool stopRssi(uint16_t conn_hdl);
|
||||
// int8_t getRssi(uint16_t conn_hdl);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* INTERNAL USAGE ONLY
|
||||
* Although declare as public, it is meant to be invoked by internal code.
|
||||
|
||||
@@ -583,6 +583,11 @@ bool AdafruitBluefruit::disconnect(uint16_t conn_hdl)
|
||||
return true; // not connected still return true
|
||||
}
|
||||
|
||||
uint16_t AdafruitBluefruit::getPeerName(uint16_t conn_hdl, char* buf, uint16_t bufsize)
|
||||
{
|
||||
return Gatt.readCharByUuid(conn_hdl, BLEUuid(BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME), buf, bufsize);
|
||||
}
|
||||
|
||||
void AdafruitBluefruit::setEventCallback ( void (*fp) (ble_evt_t*) )
|
||||
{
|
||||
_event_cb = fp;
|
||||
|
||||
@@ -166,6 +166,9 @@ class AdafruitBluefruit
|
||||
ble_gap_addr_t getPeerAddr (uint16_t conn_hdl);
|
||||
bool requestPairing (uint16_t conn_hdl);
|
||||
|
||||
uint16_t getPeerName (uint16_t conn_hdl, char* buf, uint16_t bufsize);
|
||||
|
||||
|
||||
void printInfo(void);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
@@ -108,7 +108,7 @@ static void bond_save_keys_dfr (uint8_t role, uint16_t conn_hdl, bond_keys_t* bk
|
||||
|
||||
//------------- save device name -------------//
|
||||
char devname[CFG_MAX_DEVNAME_LEN] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(conn_hdl, devname, CFG_MAX_DEVNAME_LEN);
|
||||
Bluefruit.getPeerName(conn_hdl, devname, CFG_MAX_DEVNAME_LEN);
|
||||
|
||||
// If couldn't get devname then use peer mac address
|
||||
if ( !devname[0] )
|
||||
|
||||
Reference in new issue
Block a user