Getting Service ID For BLE Device on an Argon

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



void loop() {

    int count = BLE.scan(scanResults, SCAN_RESULT_MAX);"Got %d devices", count);

    uint32_t curColorCode;
    int curRssi = -999;

    for (int ii = 0; ii < count; ii++) {
       "rssi=%d address=%02X:%02X:%02X:%02X:%02X:%02X ",
        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 ?"THE UUID IS:");


First, the advertisement data block in BLE is very limited in size, so not all services can be packed into it. So the data you are looking for may not be there at scan time at all.
To get the full list of UUIDs you may need to connect to the peripheral.

A good way to find out what exactly any given device advertises is to use a BLE scanning app (e.g. nRF Connect) and see what is offered when in what way.

However, if the desired service UUID actually is part of the advertisement data then you can have a look at this example to see how to extract it from the advertisement data block
(i.e. this line size_t svcCount = scanResults[ii].advertisingData.serviceUUID(&foundServiceUuid, 1);)

or this
(i.e. this line len = scanResults[ii].advertisingData.get(BleAdvertisingDataType::SERVICE_UUID_16BIT_COMPLETE, buf, BLE_MAX_ADV_DATA_LEN);)

Granted, the BLE reference docs could/should offer a lot more of this info directly instead of having to look at the examples “hidden” under tutorials.
This is what we got in this regard so far