Multiple L2CAP channels on iOS (rdar://46227689)

406 views Asked by At

I'm trying to open two L2CAP channels between iPhone and app running on MacOS.

MacOS app published two channels: PSM=193 and PSM=194.

I open those channels on iOS app:

peripheral.openL2CAPChannel(CBL2CAPPSM(193))
peripheral.openL2CAPChannel(CBL2CAPPSM(194))

And then I get successful delegate callbacks:

public func peripheral(_ peripheral: CBPeripheral,
                    didOpen channel: CBL2CAPChannel?, 
                              error: Error?) {

   print("Opened channel PSM is: \(channel.psm)")

   // Keep strong reference to opened channel
   openedChannels.append(channel)
}

What's interesting though is the output...:

Opened channel PSM is: 193 
Opened channel PSM is: 193 // !?!

Delegate callback is called with different channel instance but with the same PSM. On the MacOS app, I do get callback that channel 194 was opened though. However, when I write some data to the 194 channel, it's actually send to the first 193 channel that I opened. Am I doing something wrong or is it a CoreBluetooth bug?

0

There are 0 answers