Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purpose of CBCentralManagerScanOptionSolicitedServiceUUIDsKey

The CBCentralManagerScanOptionSolicitedServiceUUIDsKey option is available when scanning for devices in CoreBluetooth, the documentation states

Specifying this scan option causes the central manager to also scan for peripherals soliciting any of the services contained in the array.

What is the purpose of this option? What is a 'solicited service'? How is it different to specifying the service UUID in the services array?

like image 985
Nick Avatar asked Feb 14 '14 17:02

Nick


1 Answers

As I understand, service solicitation means that the peripheral can indicate what services it will want to use on the central when the connection happens. For example, you have an ANCS peripheral (a smart watch or whatever) that advertises itself and adds the ANCS service as solicited service to the advertisement. This will indicate to the central that this peripheral will look for the ANCS service once connected. In case of iOS this results that the user can connect to the peripheral from the Bluetooth devices list without running any apps.

In the current Core Bluetooth implementation this is not really feasible between two iOS devices. But if you initialize a CBPeripheralManager with the solicited services (no need to advertise those) and use a CBCentralManager to scan for peripherals that want to use those solicited services, then in the end the scanned peripheral will probably be able to use the services provided by your CBPeripheralManager once the connection is established. Two iOS devices cannot do this at the moment, as there is no API for it to add the solicited services to the advertisement. (Connecting back from the peripheral side may be possible if the retrieveConnectedPeripheralsWithServices method on the CBCentralManager returned the other end as CBPeripheral if it has its CBPeripheralManager initialized.)

Related SO question: Bluetooth LE and ANCS in iOS
Referenced blog post: http://blog.punchthrough.com/post/63658238857/the-apple-notification-center-service-or-wtf-is

Bluetooth spec V4.0 Vol 3. Part C. Section 11.1.9

11.1.9 Service Solicitation

One of the Service Solicitation AD types may be sent to invite other devices that expose one or more of the services specified in the Service Solicitation data to connect. The device should be in the undirected connectable mode and in one of the discoverable modes. This enables a Central providing one or more of these services to connect to this Peripheral, so that the Peripheral can use the services on the Central.

like image 69
allprog Avatar answered Sep 25 '22 09:09

allprog