minor clean up

This commit is contained in:
hathach committed 2017-07-11 18:12:57 +07:00
1 parent 80683cfafe
commit 9c7870580c
3 files changed
+14 -14

No files matched your search

+2 -2
View File
@@ -208,12 +208,12 @@ bool BLECentral::connected(void)
void BLECentral::setConnectCallback( BLEGap::connect_callback_t fp)
{
Bluefruit.Gap.setConnectCallback(fp, true);
Bluefruit.Gap.setConnectCallback(fp, BLE_GAP_ROLE_CENTRAL);
}
void BLECentral::setDisconnectCallback( BLEGap::disconnect_callback_t fp)
{
Bluefruit.Gap.setDisconnectCallback(fp, true);
Bluefruit.Gap.setDisconnectCallback(fp, BLE_GAP_ROLE_CENTRAL);
}
+10 -10
View File
@@ -49,25 +49,25 @@ bool BLEGap::connected(uint16_t conn_handle)
return _peers[conn_handle].connected;
}
void BLEGap::setConnectCallback(connect_callback_t fp, bool isCentral)
void BLEGap::setConnectCallback(connect_callback_t fp, uint8_t role)
{
if (isCentral)
{
_central_cb.connect_cb = fp;
}else
if (role == BLE_GAP_ROLE_PERIPH)
{
_prph_cb.connect_cb = fp;
}else
{
_central_cb.connect_cb = fp;
}
}
void BLEGap::setDisconnectCallback(disconnect_callback_t fp, bool isCentral)
void BLEGap::setDisconnectCallback(disconnect_callback_t fp, uint8_t role)
{
if (isCentral)
{
_central_cb.disconnect_cb = fp;
}else
if (role == BLE_GAP_ROLE_PERIPH)
{
_prph_cb.disconnect_cb = fp;
}else
{
_central_cb.disconnect_cb = fp;
}
}
+2 -2
View File
@@ -56,8 +56,8 @@ class BLEGap
uint16_t getPeerName(uint16_t conn_handle, char* buf, uint16_t bufsize);
bool getTxPacket(uint16_t conn_handle);
void setConnectCallback (connect_callback_t fp, bool isCentral);
void setDisconnectCallback(disconnect_callback_t fp, bool isCentral);
void setConnectCallback (connect_callback_t fp, uint8_t role);
void setDisconnectCallback(disconnect_callback_t fp, uint8_t role);
/*------------------------------------------------------------------*/
/* INTERNAL USAGE ONLY