Sure, thank you!
It gives me this:
Scan Data 26
06:57:48.511 -> ADVType | AddrType | BT_Addr | rssi
06:57:48.511 ->
CON_UNDIRECT | random | c8:39:2e:90:32:30 | -42
06:57:48.511 ->
GAP_ADTYPE_FLAGS: 0x6
06:57:48.511 ->
GAP_ADTYPE_MANUFACTURER_SPECIFIC: company_id 0x59, len 6
#include "BLEDevice.h"
#include "BLEScan.h"
int dataCount = 0;
BLEAdvertData foundDevice;
void scanFunction(T_LE_CB_DATA* p_data) {
Serial.print("Scan Data ");
Serial.println(++dataCount);
BLE.configScan()->printScanInfo(p_data);
foundDevice.parseScanInfo(p_data);
if (foundDevice.hasName()) {
if (foundDevice.getName() == String("WoHand")) {
Serial.print("Found BOT Device at address ");
Serial.println(foundDevice.getAddr().str());
}
}
uint8_t serviceCount = foundDevice.getServiceCount();
if (serviceCount > 0) {
BLEUUID* serviceList = foundDevice.getServiceList();
for (uint8_t i = 0; i < serviceCount; i++) {
if (serviceList[i] == BLEUUID("CBA20002-224D-11E6-9FB8-0002A5D5C51B")) {
Serial.print("Found BOT2 ");
Serial.println(foundDevice.getAddr().str());
}
}
}
}
void setup() {
Serial.begin(115200);
BLE.init();
BLE.configScan()->setScanMode(GAP_SCAN_MODE_ACTIVE); // Active mode requests for scan response packets
BLE.configScan()->setScanInterval(500); // Start a scan every 500ms
BLE.configScan()->setScanWindow(250); // Each scan lasts for 250ms
BLE.configScan()->updateScanParams();
// Provide a callback function to process scan data.
// If no function is provided, default BLEScan::printScanInfo is used
BLE.setScanCallback(scanFunction);
BLE.beginCentral(0);
BLE.configScan()->startScan(5000); // Repeat scans for 5 seconds, then stop
}
void loop() {
delay(1000);
}