I got this Nordic nRF52 BLE peripheral which doesn't advertise its services. I'm able to connect to it, but can't discover services on iOS. Since I know the service UUIDs, I've tried to pass them to the discoverServices
function. But this does not work.
After about 30 seconds it finally disconnects.
On the peripheral the GAP advertising flag is set to General Discoverable
. Using apps like LightBlue
or nRF Connect
I see the name and UUID of the peripheral but no service. When connecting with the LightBlue app, after a few seconds an error (Timeout interrogating the peripheral
) is shown.
On Android discovering the unadvertised services works just fine.
As of the Core Bluetooth Programming Guide, it should basically work:
After you have established a connection to a peripheral, you can explore its data. The first step in exploring what a peripheral has to offer is discovering its available services. Because there are size restrictions on the amount of data a peripheral can advertise, you may discover that a peripheral has more services than what it advertises (in its advertising packets). You can discover all of the services that a peripheral offers by calling the peripheral’s discoverServices: method, like this:
[peripheral discoverServices:nil];
Does anyone know what the differences in the SDKs are and if there is a possibility to discover unadvertised services on iOS like Android does?
I've read that iOS is capable of connecting directly, skipping the discovery process, when the peripheral is cached. But having the peripheral cached, it needs to be paired once. Is there maybe a way to set the cache manually?
Appreciate any help, thanks!
CBPeripheral
(that's usually a common mistake on CoreBluetooth. The framework tends to not keep strong references, and since the delegates call are "async", it will forget the peripheral exists).? – Larme