I'm not lazy, just the opposite. I try to do my own research, but there are very few examples on this forum and on the internet referencing the retrieval of the UUID from a BLE device. I want the 32 byte UUID, not the 4 byte one.
Here is my sketch:
#include <BLEAdvertisedDevice.h>
#include <BLEDevice.h>
#include <BLEScan.h>
#include "BLEUtils.h"
#include "sdkconfig.h"
#include <sstream>
#include "BLEAdvertisedDevice.h"
#include "BLEUtils.h"
#include "esp32-hal-log.h"
const int PIN = 4;
const int CUTOFF = -60;
void setup() {
pinMode(PIN, OUTPUT);
BLEDevice::init("");
int first = 100;
int second = 200;
Serial.begin(9600);
Serial.println(first);
Serial.println(second);
}
void loop() {
BLEScan *scan = BLEDevice::getScan();
scan->setActiveScan(true);
BLEScanResults results = scan->start(1);
int best = CUTOFF;
for (int i = 0; i < results.getCount(); i++) {
BLEAdvertisedDevice device = results.getDevice(i);
int rssi = device.getRSSI();
if (rssi > best) {
best = rssi;
}
}
digitalWrite(PIN, best > CUTOFF ? HIGH : LOW);
if (PIN, best > CUTOFF) {
BLEUUID BLEAdvertisedDevice::getServiceUUID() ;
digitalWrite(PIN, LOW);
delay(10000);
}
}
When compiling, the sketch stops at: BLEUUID BLEAdvertisedDevice::getServiceUUID(); with this error message:
exit status 1
qualified-id in declaration before '(' token