I'm developing an iOS application that connects to a peripheral device. The peripheral device is bonded with the phone.
Even if my application is killed by user, the phone reconnects automatically when the peripheral is in range. But this does not happens always. Does the operating system tries to reconnect automatically to bonded slave devices? I didn't find anything in the iOS Bluetooth documentation about such an automatically reconnect.
So why does this happen? I'm confused: who should deal with the reconnect: the app or the iOS operating system?
Related
Is there a way I can program an app to wake up when the device receives a specific hardware interrupt?
For example, I created an IOT device which connects to the lightning port of my iPhone and I programmed my IOT device to send a specific device code (as an interrupt) when connected.
Will it be possible to code in way that the IOS detects this device code and knows that it has to wake a specific application (built for the device)? My use case is to make the application start automatically when the device is connected (even if the phone is in a locked state).
I am using HM10-BluetoothSerial-iOS as base for my own application where I remotly control an AtMega.
I wish to automatically reconnect to the HM10 Bluetooth device. As far as I know you cannot store CBPeripherals for a later connection. So how can I reconnect at a later time?
I have been exploring CoreBluetooth and BLE connections between OS X and iOS, where I've discovered an interesting problem. I have the Mac implementing CoreBluetooth central and iOS implementing CoreBluetooth peripheral. Since iOS no longer broadcasts a constant, consistent MAC address or other identifier, there is no reliable way (that I can find) to allow the Mac to connect to the iOS peripheral whenever it is in range, including when the iOS app is running in the background.
By storing the last connected peripheral, I can get OS X to constantly search for the iOS device like shown:
[central connectPeripheral:self.lastPeripheral options:nil];
Which works if self.lastPeripheral was previously connected to the OS X client. This initial connection can only be created if the iOS app is open at the time; it will not work if it is backgrounded. This in itself is not a horrible issue, but every single time the OS X app quits, this connection must be reinstated by opening the iOS app.
Is there any way to connect and reconnect (when the device moves back into range) via BLE to an iOS device when the iOS application is backgrounded, especially to persist between app launches?
BluetoothLE is still a energy consuming technology. And Apple goes into great lengths to limit its "active" usage on iOS, in situation they don't deem as correct (e.g. background). That said, there are no guaranties on for how long a iOS device in peripheral mode continues to advertise (pre-requirement for reconnection).
Did you think about switching the roles. Making the OS X machine the peripheral, and the iOS device the central? I know from experience that iOS behaves much nicer when acting as a central.
I have read the docs about the BLE for iOS, and i could see that every device has its UUID instead of mac adress for the BLE.
My question ,in which there is no answer to on the docs, is- when you turn on the bluetooth on the device ( without opening any app) , so the device's bluetooth is on , what does it advertise then, and could I discover that device or get its UUID, while his bluetooth is on,but without any app that is open.
I am pretty sure that when the BLE is on, you can discover that device, or awake him, but I wonder what data can I get from him while its on without an app .
(same for Android.. )
iOS does not advertise any Bluetooth Low Energy services that are visible to another iOS device without an app running. Once an app advertises a service you will see additional services available - device information, time service, battery level.
If you are using different Bluetooth hardware to scan then you may see some advertisements without an app but the reported UUID of an iOS device changes every 15 minutes for privacy reasons - See this answer - Corebluetooth, How to get a unique UUID?
Is is possible to "pair" a Bluetooth BLE device such that they automatically connect when in range? (ie. an iPhone app sets up a connection to the Bluetooth device and from then on, the iPhone automatically reconnects to the device if in range, even if the app hasn't been opened in days and is fully closed).
Once reconnected, the device could either using Event Backgrounding to prompt the user to open the app or otherwise interact with a possibly backgrounded app (as described here).
Anecdotally, I've used Bluetooth keyboards that automatically reconnect to my laptop when back in range. These are not necessarily BLE devices, is this something that's possible in BLE land?
Could this be possible if the iPhone were the server instead of the device? What if this were done using traditional Bluetooth under the MFI program?
There are number of relevant comments here and on the Apple Bluetooth-dev mailing list, but nothing that cleared it up for me. Thank you for your help.
I posted my question on Bluetooth-dev, I'm leaving the response here for posteriority: http://lists.apple.com/archives/bluetooth-dev/2012/Sep/msg00117.html