add checkReportForService() helper

This commit is contained in:
hathach committed 2017-07-13 17:36:15 +07:00
1 parent d7e50b2a25
commit 98bae8d1cb
3 files changed
+14 -1

No files matched your search

@@ -58,7 +58,7 @@ void setup()
void scan_callback(ble_gap_evt_adv_report_t* report)
{
// Check if advertising contain BleUart service
if ( Bluefruit.Scanner.checkReportForUuid(report, BLEUART_UUID_SERVICE) )
if ( Bluefruit.Scanner.checkReportForService(report, clientUart) )
{
Serial.println("BLE UART service detected");
Serial.println("Attempt to connect ... ");
@@ -210,6 +210,17 @@ bool BLEScanner::checkReportForUuid(const ble_gap_evt_adv_report_t* report, BLEU
return false;
}
bool BLEScanner::checkReportForService(const ble_gap_evt_adv_report_t* report, BLEClientService svc)
{
return checkReportForUuid(report, svc.uuid);
}
bool BLEScanner::checkReportForService(const ble_gap_evt_adv_report_t* report, BLEService svc)
{
return checkReportForUuid(report, svc.uuid);
}
/**
* Event Handler
* @param evt
@@ -70,6 +70,8 @@ public:
uint8_t parseReportByType(const ble_gap_evt_adv_report_t* report, uint8_t type, uint8_t* buf, uint8_t bufsize = 0);
bool checkReportForUuid(const ble_gap_evt_adv_report_t* report, BLEUuid ble_uuid);
bool checkReportForService(const ble_gap_evt_adv_report_t* report, BLEClientService svc);
bool checkReportForService(const ble_gap_evt_adv_report_t* report, BLEService svc);
/*------------------------------------------------------------------*/
/* INTERNAL USAGE ONLY