Central.disconnect() is repalced by Bluefruit.disconnect()

This commit is contained in:
hathach committed 2019-01-24 14:10:15 +07:00
1 parent 6a503f397b
commit e200c8249d
9 files changed
+17 -21

No files matched your search

+2
View File
@@ -9,6 +9,8 @@
- setDisconnectCallback(), setDisconnectCallback()
- Bluefruit
- remove getPeerAddr(uint8_t[6]) variant
- remove connInterval() is replaced by BLEConnection's getConnInterval()
- Central.disconnect() is repalced by Bluefruit.disconnect()
- 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
@@ -148,8 +148,8 @@ void connect_callback(uint16_t conn_handle)
{
Serial.println("Found NONE");
// disconect since we couldn't find bleuart service
Bluefruit.Central.disconnect(conn_handle);
// disconnect since we couldn't find bleuart service
Bluefruit.disconnect(conn_handle);
}
}
@@ -177,8 +177,8 @@ void connect_callback(uint16_t conn_handle)
{
Serial.println("Found ... NOTHING!");
// disconect since we couldn't find bleuart service
Bluefruit.Central.disconnect(conn_handle);
// disconnect since we couldn't find bleuart service
Bluefruit.disconnect(conn_handle);
}
connection_num++;
@@ -110,8 +110,8 @@ void connect_callback(uint16_t conn_handle)
{
Serial.println("Found NONE");
// disconect since we couldn't find HRM service
Bluefruit.Central.disconnect(conn_handle);
// disconnect since we couldn't find HRM service
Bluefruit.disconnect(conn_handle);
return;
}
@@ -125,7 +125,7 @@ void connect_callback(uint16_t conn_handle)
// Measurement chr is mandatory, if it is not found (valid), then disconnect
Serial.println("not found !!!");
Serial.println("Measurement characteristic is mandatory but not found");
Bluefruit.Central.disconnect(conn_handle);
Bluefruit.disconnect(conn_handle);
return;
}
Serial.println("Found it");
@@ -126,8 +126,8 @@ void connect_callback(uint16_t conn_handle)
{
Serial.println("Found NONE");
// disconect since we couldn't find bleuart service
Bluefruit.Central.disconnect(conn_handle);
// disconnect since we couldn't find bleuart service
Bluefruit.disconnect(conn_handle);
}
}
@@ -176,8 +176,8 @@ void connect_callback(uint16_t conn_handle)
{
Serial.println("No Service Found");
// disconect since we couldn't find service
Bluefruit.Central.disconnect(conn_handle);
// disconnect since we couldn't find service
Bluefruit.disconnect(conn_handle);
return;
}
@@ -189,7 +189,7 @@ void connect_callback(uint16_t conn_handle)
{
// Measurement chr is mandatory, if it is not found (valid), then disconnect
Serial.println("No Characteristic Found. Characteristic is mandatory but not found. ");
Bluefruit.Central.disconnect(conn_handle);
Bluefruit.disconnect(conn_handle);
return;
}
Serial.println("Characteristic Found");
@@ -201,7 +201,7 @@ void connect_callback(uint16_t conn_handle)
if ( !opticalCharacteristicDataCollectionEnabler.discover() )
{
Serial.println("No Characteristic Found. Characteristic is mandatory but not found.");
Bluefruit.Central.disconnect(conn_handle);
Bluefruit.disconnect(conn_handle);
return;
}
Serial.println("Characteristic Found");
@@ -174,8 +174,8 @@ void cent_connect_callback(uint16_t conn_handle)
clientUart.enableTXD();
}else
{
// disconect since we couldn't find bleuart service
Bluefruit.Central.disconnect(conn_handle);
// disconnect since we couldn't find bleuart service
Bluefruit.disconnect(conn_handle);
}
}
@@ -82,11 +82,6 @@ bool BLECentral::connect(const ble_gap_evt_adv_report_t* adv_report)
return connect(&adv_report->peer_addr);
}
bool BLECentral::disconnect(uint16_t conn_hdl)
{
return ERROR_NONE == sd_ble_gap_disconnect(conn_hdl, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
}
/**
* Check if connected to a specific peripheral
* @param conn_handle
@@ -66,7 +66,6 @@ class BLECentral
bool connect(const ble_gap_evt_adv_report_t* adv_report);
bool connect(const ble_gap_addr_t *peer_addr);
bool disconnect(uint16_t conn_hdl);
bool connected(uint16_t conn_hdl); // Connected as central to this connection
uint8_t connected(void); // Number of connected Peripherals