Scanning for audio sink CBPeripheral possible?

I am trying to get the charactersics of an attached bluetooth audio sink in my app. Is this possible? I have not had any success with the following code:


- (void)startScanning
{
    self.bluetoothManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
}

- (void)centralManagerDidUpdateState:(CBCentralManager *)central
{
    if (central.state == CBCentralManagerStatePoweredOn) {
        CBUUID *audioSink = [CBUUID UUIDWithString:@"110B"];
        [self.bluetoothManager scanForPeripheralsWithServices:@[ audioSink ] options:nil];
        [self.bluetoothManager retrieveConnectedPeripheralsWithServices:@[ audioSink ]];
    }
}

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
    // Never calls back
}

- (void)centralManager:(CBCentralManager *)central didRetrieveConnectedPeripherals:(NSArray *)peripherals
{
     // Always empty
}


I am pretty sure the UUID is correct, lifted from here: https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery


I have tried the code with and without bluetooth speakers paired, the only peripheral I can find is my laptop if I don't specify the service I am looking for. Does the system handle audio sinks differently?

Answered by Engineer in 31264022

AudioSink is part of the A2DP profile which is a Classic Bluetooth profile. This is not supported via CoreBluetooth.


To communicate with Classic Bluetooth devices, you will need to use the External Accessory framework.

For information about the External Accessory Framework, see http://developer.apple.com/library/ios/#featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html on the Apple iOS Developer site.

Accepted Answer

AudioSink is part of the A2DP profile which is a Classic Bluetooth profile. This is not supported via CoreBluetooth.


To communicate with Classic Bluetooth devices, you will need to use the External Accessory framework.

For information about the External Accessory Framework, see http://developer.apple.com/library/ios/#featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html on the Apple iOS Developer site.

Scanning for audio sink CBPeripheral possible?
 
 
Q