Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the iPhone simulator in Xcode support Bluetooth Low Energy?

I'm trying some iOS test applications on the new Mac mini, that supports Bluetooth Low Energy. The CoreBluetooth framework is used in those. However, I'm not able to get Bluetooth working in the iPhone simulator, that is part of Xcode.

When I allocate a new CBCentralManager, centralManagerDidUpdateState: receives CBCentralManagerStatePoweredOff which stands for Bluetooth is currently powered off.

The first time I ran the text application, a box was then opened up that looked pretty bugged (only language variables were used, not the actual texts) and with two buttons. The first led me to the settings panel where there was an option to enable Bluetooth. However, after I told it to enable Bluetooth, it just shows the spinning animation, and it won't either complete or cancel. Even after rebooting the Mac, there is still only the spinning animation. The box also does not open up anymore.

Essentially, I think that the iPhone simulator should support Bluetooth Low Energy. Otherwise, it does not really make sense that there is an option in the settings application on the simulator. Also, the central manager state is CBCentralManagerStatePoweredOff but not CBCentralManagerStateUnsupported which would stand for The platform doesn't support Bluetooth Low Energy. This gives also hope that support could exist.

  • Does the iPhone simulator support Bluetooth Low Energy?
  • If yes, how can I enable it?
like image 950
Etan Avatar asked Apr 05 '12 07:04

Etan


People also ask

Can we use Bluetooth in simulator?

Extending the Bluetooth features to the simulator is not supported by the currently available hardware. Communication is intercepted when we use simulators. It is used to connect multiple systems into one device. So it gives easy to access.

What is Bluetooth low energy in iOS?

One of the main features of the Bluetooth 4 specification is Bluetooth Low Energy (BLE). Also called Bluetooth smart, this technology allows peripherals to communicate by consuming much less energy than regular Bluetooth.

How do I turn on ble on my iPhone?

On your iOS device go into "Settings-> Bluetooth" and turn on your BLE device. You should see the device listed in your available devices. Initially it might be described as simply "Keyboard" but eventually it will switch over to "Adafruit EZ-Key" followed by a four character identifier.


2 Answers

The simulator does support Bluetooth Low Energy (4.0) according to this appnote from Apple. The only problem is that even if you have a computer with BLE inside, you will not be able to use the simulator together with it, because (I think) you occupy the availability on BLE for other devices to discover your computer, thereby restricting the functionality of the Mac.

So if you go get yourself a BLE USB dongle you will be able to use it in simulator.

EDIT: Adding information from @JoeShaw:

Unfortunately it appears as though Core Bluetooth support has been dropped from the simulator for iOS 7. Reference: doubleencore.com/2013/09/whats-new-in-bluetooth-le-ios-7. In addition, the linked technote seems to have been removed.

like image 69
chwi Avatar answered Sep 19 '22 03:09

chwi


I have been using the simulator to test BLE apps - but you need to be on OSX 10.7. As Wilhelmsen mentioned, you also need a BLE USB dongle. In addition, you need to set an NVRAM setting:

$sudo nvram bluetoothHostControllerSwitchBehavior="never" 

See this Technical Note from Apple for more details on using the simulator to test BLE apps: http://developer.apple.com/library/ios/#technotes/tn2295/_index.html

like image 37
mezulu Avatar answered Sep 18 '22 03:09

mezulu