I'd like to setup a connection between a iPhone and a medical device which provides information about the heart. I will get information about the bluetooth protocol soon. At the moment I have trouble using apple's bluetooth library. Is CoreBluetooth or IOBluetooth better for connecting to non MFI devices?
Here is some code I found (link) it should find all devices around but it didn't work. I tried different ways to set things up.
import IOBluetooth
import XCPlayground
class BlueDelegate : IOBluetoothDeviceInquiryDelegate{
func deviceInquiryComplete(sender: IOBluetoothDeviceInquiry, error: IOReturn, aborted: Bool) {
aborted
println("called")
var devices = sender.foundDevices()
for device : AnyObject in devices {
if let thingy = device as? IOBluetoothDevice {
thingy.getAddress()
}
}
}
}
var delegate = BlueDelegate()
var inquiry = IOBluetoothDeviceInquiry(delegate: delegate)
inquiry.start()
XCPSetExecutionShouldContinueIndefinitely()
I tried to use CoreBluetooth too but it didn't call the delegates methods either.