I'm trying to open two L2CAP channels between iOS and MacOS app.
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?
Running iOS 12.1
MacOS Mojave