قالب وردپرس درنا توس
Home / IOS Development / core bluetooth – multiple L2CAP channels on iOS (rdar: // 46227689)

core bluetooth – multiple L2CAP channels on iOS (rdar: // 46227689)



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

MacOS app published two channels: PSM = 193 and PSM = 194 . [19659002] I open these channels on iOS app:

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

And then I get successful delegated callbacks:

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

print ("Open channel PSM is:  (channel.psm)")

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

What's interesting, but is the result …:

  Open Channel PSM is: 1
93 Open channel PSM is: 193 //!?!

Delegated callback is called with another channel instance, but with the same PSM.
On the MacOS app, I get a callback that the channel 194 was opened though. However, when I write some data to the 194 channel, it is actually sent to the first 193 channel that I opened.
Am I doing something wrong or is it a CoreBluetooth error?


Source link