1

I am creating Os x Application on Mavericks with Xcode 6. I want to do simple task in this Application like search for Bluetooth Devices and display List, Connect with device which is selected from list.

I am using IOBluetooth Framework. I have completed searching, display and selection part but I am not able to connect with device.

I have write

IOBluetoothDevice *device= [[IOBluetoothDevice alloc] init];
IOReturn status=[device openConnection:[self.list objectAtIndex:row]];
if(status == kIOReturnSuccess){ 
    NSLog(@"Device Connect Successfully::::");
}

"Device Connect Successfully" Message printed on console but device is still not connected.

So I am following right way to connect device? If Device is Connected then how do I Check it is connected or not?

Paulw11
  • 108,386
  • 14
  • 159
  • 186
nadim
  • 776
  • 1
  • 12
  • 26
  • This method is asynchronous - you need to wait for the callback to know that the device is connected - "If a target is specified, the open connection call is asynchronous and on completion of the CREATE_CONNECTION command, the method -connectionComplete:status: will be called on the specified target." Are you working with "legacy" Bluetooth devices or BLE? If BLE then CBCentralManager is a better class to use than IOBluetooth – Paulw11 Oct 29 '14 at 21:59
  • Thanks for your reply. I have successfully connected device using IOBluetooth. I am passing Peripheral as parameter for OpenConnection instead of that I have to pass IOBluetoothDevice Object. I have tried with CBCentralManager But its not worked so I have found alternative way IOBluetooth. Anyway Thank you so much for your reply. – nadim Oct 30 '14 at 04:48

0 Answers0