0

I am trying to communicate between Mac OS and iOS for sending data back and forth.In Mac OS IOBluetooth framework provides L2cap channel but when I open it and use iOS Core Bluetooth L2CAP it doesnt connect to the channel.How do I make them work as l2capchannel should be same irrespective of the framework.Any ideas or suggestions

md12
  • 111
  • 1
  • 8
  • 1
    You can communicate between iOS and macOS with L2Cap. My [demo app](https://github.com/paulw11/L2CapDemo) has both iOS and Mac apps. – Paulw11 Jan 06 '20 at 19:44
  • can iOS device connect to IOBluetoothL2CAPChannel from Mac. – md12 Jan 07 '20 at 17:02
  • 1
    You use Core Bluetooth on both sides; it is available on both platforms. – Paulw11 Jan 07 '20 at 18:16
  • Thanks Paulw.I could get them working with Core Bluetooth however the Mac OS app IOBluetoothL2CAPChannel works with windows as well but I couldn't get the same IOBluetoothL2CAPChannel to work with iOS.Core bluetooth won't work with windows and then I will have to write a separate app for windows and iPhone .Any suggestions – md12 Jan 07 '20 at 18:30
  • I have never tried with IOBluetooth, but that framework is for legacy Bluetooth, not BLE. iOS apps only have access to BLE via Core Bluetooth so I don't think you will be able to communicate with an IOBluetooth channel from iOS. – Paulw11 Jan 07 '20 at 18:40
  • i think your problem is that your iOS app simply can't discover the Mac unless it is advertising a BLE service, which means core Bluetooth. Did you advertise the IOBluetooth PSM via Core Bluetooth and try and connect to it? – Paulw11 Jan 07 '20 at 18:47
  • Thasts correct @Paulw11. I advertise PSM with IOBluetooth with this method if(sppServiceRecord?.getL2CAPPSM(&psm) != kIOReturnSuccess) and open l2capchannel with selectedDevice?.openL2CAPChannelSync(&l2capChannel, withPSM: psm, delegate: l2chanDelegate) – md12 Jan 07 '20 at 18:50
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/205549/discussion-between-paulw11-and-md12). – Paulw11 Jan 07 '20 at 18:51

0 Answers0