I figured out how to make a channel and receive data. But the data function isn't printing anything. Here is what I have so far:
class ChannelDelegate: IOBluetoothL2CAPChannelDelegate {
func l2capChannelOpenComplete(_ l2capChannel: IOBluetoothL2CAPChannel!, status error: IOReturn)
{
print("Channel Opened!")
}
func l2capChannelData(_ l2capChannel: IOBluetoothL2CAPChannel!, data dataPointer: UnsafeMutableRawPointer!, length dataLength: Int) {
print(dataPointer)
}
let device = IOBluetoothDevice(addressString: "A4:38:CC:3A:BF:16");
var channel: IOBluetoothL2CAPChannel? = IOBluetoothL2CAPChannel()
device?.openL2CAPChannelSync(&channel, withPSM: 1, delegate: ChannelDelegate()))
channel?.setDelegate(ChannelDelegate())