Xcode iOS Bluetooth pairing issues - ios

Once a Bluetooth device has been stopped and the connection is lost. Is it possible for the iPhone to automatically pair to that device once it is turned on again? Instead of manually going into the iPhone settings to connect that device.

It is not related to iOS device. Auto parse is the job of the device you are trying to connect (I am using EA framework, not core bluetooth). I have the same problem on current project. What we did is update firmware that can remember last connection, so next time it will automatically connect to iPhone.

Related

CTKD implementation issue on iOS

I am working on an audio device project with dual-mode Bluetooth. I want to create a seamless connection experience with iOS devices, so I use CTKD with iOS. This gives us the ability to connect both BR/EDR and BLE without leaving our app in the system settings.
It works perfectly if the initial pairing happened inside the app. I got both BR/EDR and BLE connected and working and only one device shows on the Bluetooth page.
But if I pair the Bluetooth(BR/EDR) first in the system settings and then go to the app to pair BLE. The app initiated a new CTKD process, which creates a new BLE connection beside the BR/EDR connection.
My question is if I pair BR/EDR first in the Bluetooth settings, is there a way that I can only pair BLE and didn't trigger the CTKD while keeping the one device displayed on the Bluetooth settings page? Or anything else that can get the same result?

Why does CBCentralManager report "Peer removed pairing information" with 1st phone after 2nd phone is paired with device?

Background
I'm using a couple of different hobbyist BLE devices (HM-10). This particular one is an example of one of them.
It's a simple 4-pin device and I've set all the parameters on it using an Arduino Nano and I can see the data coming into it live since it is connected to USB of my computer and I'm monitoring serial data using Arduino Serial Monitor.
The device works great. I have it set to Type 3 which forces it to pair/bond (so iphone or ipad will force you to enter the 6-digit PASS code, which I've set on the device.
iPhone App Works
I have written a simple Single-View iOS app which runs on my iphone / ipad and finds local BLE peripherals.
Everything works great.
When I select the item (HM-10) shown above by name I see the iOS pairing dialog & successfully pair the item.
I can send data and everything works fine. If I go out of distance or turn off bluetooth on my device then come back into proximity or turn the device back on, then the iphone can send data again and I see it in the Serial Monitor. Works great.
** The Problem **
The problem occurs if I then pair this device with any other iphone or ipad.
After that, the new iphone / ipad can send data to the device with no problem.
However, if I then go back to my original iphone and attempt to send data again, I see the following error raised by the CBCentralManager:
"Peer removed pairing information."
After that, I cannot send data from the original iphone to the device again, unless I go to Bluetooth settings on the phone and say, "Forget this device".
Android & HC-06 Bluetooth Devices
I've developed simple Android apps which use a similar Bluetooth classic device (HC-06) and I could pair multiple devices.
Questions
Does BLE 4.0 Allow multiple devices to be paired & bonded?
Do you know why the Peripheral would remove the pairing info? (again, this only occurs if I pair the device with a new iphone / ipad).
Is there a way to send something via iOS app that would tell it to renew the pairing information?
Do you have any suggestions (code to try or other) that would allow me to definitively know that this device does or does not allow multiple phones to pair with it? (I've contacted the manufacturer also.)
Note: I also have a another BLE device here and it seems to exhibit the same behavior. This seems odd though, because I have a BLE speaker that will pair with multiple devices so it must be possible. And I understand that could depend upon the BLE hardware.
Does BLE 4.0 Allow multiple devices to be paired & bonded?
Sure. But that doesn't mean that the device does. It needs to allocate memory for it, and smaller devices often don't.
Do you know why the Peripheral would remove the pairing info? (again, this only occurs if I pair the device with a new iphone / ipad).
It doesn't remove the pairing info. It's telling you the device has removed the pairing info. Pairing info includes a shared secret, so if one side throws away their secret, there's no point in you keeping yours. You have to create a new one.
Is there a way to send something via iOS app that would tell it to renew the pairing information?
Unfortunately no. Apple doesn't give any access to the pairing experience.
There isn't any standardized way to ask devices this kind of information. Some devices support a single pairing Some support two. Some support "a few." But it's really up to the device.
It is very possible that you will get a better overall experience with a Bluetooth 4.1 or 4.2 device, because they've added better security protocols. With iOS 13, the phone also supports cross-transport key derivation, which possibly will help here (if the device also supports it). But I don't think you can improve things with a Bluetooth 4.0 device.

Issue reconnecting to periphal device with iPhone (QT)

I have a qt app running on Android and iOS. The Bluetooth part of the code is in c++ and currently works for Android.
Currently on the iOS side I can discover the device and pair to it and connect. However when I go to connect to the device again after closing and reopening app (or restarting the phone) I cannot reconnect to the device.
I save the Devicee UUID that iOS creates for the device (since there is no MAC Address) and I get the error from my QLowEnergyController that says "Remote Device Not Found".
Things I have tried after pairing:
1. Restart app and try connecting.
2. Go into settings and manually connect to the device. Still doesn't find the device.
Are there any specific steps to reconnect to iOS?
I am expecting that the app will connect my iPhone to the device just like in Android.

Pairing a bluetooth device with iOS using Cordova

I'm connecting to a BLE device in a Cordova application using the ble-central plugin. I can connect to the device from the application without a problem, when I connect to the device from iOS I get prompted for the PIN and on entering the PIN I get connected, all as expected.
The problem is that the device does not get remembered on iOS, and that every time the application is restarted, or if the connection fails, I get prompted for the PIN again.
Is there a way to force iOS to remember the device? The strange thing is that even though I can connect to the device from the application, or something like the LightBlue application I cannot seem to detect the device from the settings.
Not sure if this is some iOS limitation, if the device should somehow be iOS enabled like older devices did? It seems to me I wouldn't be able to connect at all if that was the case?
Any help or idea is appreciated.

How does iPhone discover an external accessory via Bluetooth?

How does an iPhone know to connect to an MFi device via Bluetooth automatically? Is the Bluetooth on iPhone constantly looking for a device to hook up to? What happens if there are a few MFi (all with Bluetooth support) around?
You import ExternalAccessory/ExternalAccessory.h in your .m file(implementation) so that you can use the libraries that contains the accessory information or get available accessories around. Using this, we can also open a session with the selected accessory.
I'm not sure if you can connect to multiple bluetooth devices that are detected.
The user must go to Settings/Bluetooth or Settings/General/Bluetooth (according to which version of iOS the device runs), and wait till the MFi accessory got discovered by the iOS.
Then the user must manually connect the device for the first time. The accessory usually remembers the pairing relationship and reconnect to the iOS automatically, if the user got so lucky when the bluetooth of iOS is on.
Though I have never tried to played with connection of multiple bluetooth MFi devices, Apple's documents suggested that after iOS 5, it is supported.

Resources