Lots has been written about how to broadcast BLE attributes, however, in trying to do something very simple I can’t quite figure out how to do it with the given API.
Given the code fragment below, how can one get the UUID for the services that exist on the given scanned item? Tried lots of things, but none of them seems to work so I’m probably missing something with this API.
BleScanResult scanResults[SCAN_RESULT_MAX];
void setup() {
(void)logHandler; // Does nothing, just to eliminate the unused variable warning
BLE.on();
}
void loop() {
BLE.setScanTimeout(50);
int count = BLE.scan(scanResults, SCAN_RESULT_MAX);
Log.info("Got %d devices", count);
uint32_t curColorCode;
int curRssi = -999;
for (int ii = 0; ii < count; ii++) {
Log.info("rssi=%d address=%02X:%02X:%02X:%02X:%02X:%02X ",
scanResults[ii].rssi,
scanResults[ii].address[0], scanResults[ii].address[1], scanResults[ii].address[2],
scanResults[ii].address[3], scanResults[ii].address[4], scanResults[ii].address[5]);
// get the service uuid of this scan ?
Log.info("THE UUID IS:");
}
}