1

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.

Community
  • 1
  • 1
Kanteran
  • 80
  • 8
  • 2
    IOBluetooth and CoreBluetooth do different things. "Non-MFi" isn't a sufficient description to answer your question (unless this is just a terminology issue). You need to know if this is a BTLE device (BT 4.0 / BlueTooth LE / Bluetooth Smart) or "classic" Bluetooth. Do you know the answer to that yet? That should be in the technical information for the device. If for some reason you can't find that info, check out the app LightBlue (no affiliation) and see if _that_ app sees the device. If so, it's an LE device and CoreBluetooth will be the answer. – Brad Brighton Apr 12 '15 at 15:49
  • Sorry I forget to mention that the device is capable of Bluetooth LE. But I thought MFi has an affect on the Bluetooth connection. Thank you for your answer. – Kanteran Apr 12 '15 at 16:04
  • If you know it's BTLE then CoreBluetooth is your way to go and LightBlue is an awesome external tool to verify that your iPhone can see the medical device at all. The device manufacturer has to conform to MFi for traditional Bluetooth devices (and either you or the mfg SDK has to be approved as well to use the ExternalAccessory framework for App Store apps). – Brad Brighton Apr 12 '15 at 16:07
  • What do you mean with "... for traditional Bluetooth devices ..."? – Kanteran Apr 12 '15 at 16:53
  • I'm calling any bluetooth devices that are not BTLE "classic bluetooth". They share a name, but are significantly different. Here is one (of many) high-level comparisons... http://www.medicalelectronicsdesign.com/article/bluetooth-low-energy-vs-classic-bluetooth-choose-best-wireless-technology-your-application – Brad Brighton Apr 12 '15 at 16:57

0 Answers0