Identifying another device using CoreBluetooth - ios

I'm jut trying to make a sample iOS app that will scan & collect data from a another bluetooth enabled device. Initially I'm just trying to scan a another bluetooth enabled device. So I downloaded a sample from Apple "BTLE Central Peripheral Transfer" app. I'm confused with UUID. There are two types of UUID I see in the sample app Service and Characteristic. How to get this two different UUID's ? My first mission is two identify a another bluetooth enabled device through my app. Now I'm testing with two iPhone (5 & 4 running iOS 7),trying to scan a another iPhone through my app. It looks quite difficult at the moment. By changing the correct two UUID's Is it possible to scan the another device ? Please provide your suggestion.
Edited :
I have two iPhone for testing 1. iPhone 5 2. iPhone 4 My big concern is Does iPhone 4 has BTLE ? Do both iPhone I test requires BTLE ?
How to identify a another device and pair it ?

I would suggest taking a look at this example on github: https://github.com/liquidx/CoreBluetoothPeripheral/tree/master/CoreBluetoothOSXCentral
If that works for you - try adopting your code. Otherwise, provide code examples that you assume may be problematic

Related

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.

NFC data transfer on iPhones

Is it possible to transfer data between two iPhones using NFC? I'm working on an app that aims to exchange specific strings between two phones and would preferably use NFC. (If so, would it work for iPhone - Android connection?)
The Answer is NO.
So far apple has only allowed to read data. We cannot send any data between two iPhones or between an iPhone and a Android Device.
iOS11 seems to offer the potential to read NFC data so one-way traffic between Android and iOS appears possible.

iOS PKPKT BLE concept

I understand that the iOS App "PKPKT" is using BLE (Bluetooth Low Enery). But what I am curious about it is, is it purely using BLE only? Or does it switching between BLE and Classic Bluetooth?
I tested with a iPhone 5 and a iPhone 5s with both installed the app. I turned on bluetooth on both devices. And then i checked the "DEVICES" list to see if the other iPhone is paired with one another, I found that they are not. Until i launched the PKPKT on one of the device, and the i check the "DEVICE" list again, now they are paired and connected. So, i'm thinking is this pairing done by the BLE pairing? Meaning one of "Just works", "Out of Band", or "Passkey entry" methods.
There is also a "Chat" functionality in that app. This make me curious if the chatting function using BLE or Classic Bluetooth?
So my question is actually "Is switching between BLE and Classic bluetooth possible?". This is part of the study on this BLE technology. Hopefully someone could help me and other newbie on this new technology.
Thanks in advance!
I wrote PKPKT. I only use BLE. No classic. iBeacon is cool but doesn't have the background scanning needed to discover other players. I use game center, but only for scores, no sessions. It's optional in the app to enable game center (those banners can be distracting!)
The chat is also over BLE.
Because the connections are not encrypted, you don't need to manually pair the devices, and "just works"
I think you might find this link helpful. It implements something that looks to be a simpler version of PKPKT. I believe the app uses a combination of GameKit/iBeacon. The app requires iOS7.0+ and states, "PKPKT does the hard work of finding other players by detecting them using Bluetooth Low Energy (BLE) in the background." iBeacon would be the most battery-efficient way of accomplishing this and is a new feature in iOS 7. There is a wealth of information online(particularly on SO) about peer to peer bluetooth gaming using GameKit, if you are interested.
We can't say for sure unless the developer lets us know. If one were to attempt to recreate the application, GameKit and iBeacon would be the technologies that I believe most would recommend.
You might find this project helpful as an overview of how to use Bluetooth LE to communicate between two devices. You don't need to pair the devices, and unlike iBeacons, it works when the app is in the background.
SimpleShare - Easy Proximity-based Sharing for iOS
You can use the delegate methods of the SimpleShare project to easily share arrays of strings between nearby users running your app, such as user IDs, which you could then use to get more info, photos, etc, about that user from a web service.

Multi bluetooth device Connection using EAAccessory framework

This question might seem silly but since im new to IOS Developement i ask it again.
Can we connect to multiple devices at a time in IOS using the EAAccessory framework?
What is the maximum data rate for an Iphone, Ipad mini, Ipad, Ipod using bluetooth connection?
Will the data rate change according to the framework used in the application? If so, then what is the maximum data rate for the Iphone, Ipad mini, Ipad, Ipod?
Thanks in Advance
Ramnathpraveen G
I only have an answer to your first question.
Yes it is possible. I just did a small test with a iPhone 5c and 2 accessories connected via Bluetooth. I can see that these accessories can connect at the same time.
I recommend that you give the EADemo a try to test more scenario's.
I do not have information regarding your your other 2 questions.

Using custom/existing bluetooth HID with iOS Devices?

I am working on building or using an existing bluetooth HID device (something like this http://www.icontrolpad.com) and to get my iOS device to read the data coming from it. So i have some questions regarding this:-
Is it possible at all to do this, considering that the Bluetooth stack is not available on non jail broken devices.
Do i need to register with apples Mfi program? If i don't need to, what are the alternatives?
If i do register with Apple's Mfi program will i get access frameworks that will allow me to read data off the Bluetooth stack.
Considering that there will be a custom application sitting on the iOS device that needs to communicate with the HW im building, what are the implications w.r.t the approval of the app from Apple's side?
Thanks in advance, any help is greatly appreciated!
Core Bluetooth framework is available for Bluetooth Low Energy devices on iOS 5, no MFi membership is required.
With Made for iPhone, you basically get a serial pipe to your device using the ExternalAccesory Framework (in fact, it IS using the serial port profile plus some authentication). So you while you cannot use an actual HID device, you could send your data over.

Resources