Bluetooth identifier on iOS - ios

See the image above. I am pairing my iOS app from iphone1 to a single Bluetooth device, say BT1, which is further inter-connected with other similar bluetooth devices via Bluetooth Mesh. As soon as I connect with BT1, I get a uuid1 for the connection.
Now, I need to uniquely identify the paired device uuid. This is essential as I would like to transfer my phone app settings to another iPhone, say iPhone2, via cloud, so that any phone can connect to the original paired BT device. But when I try to pair iPhone2 to Device1, I get a different uuid2 for Device1, because of which, I cannot match it with the uuid1. So if uuid1 = uuid2, then the cloud will send me the original settings.
Question -
1. is it technically possible to ensure that a bluetooth device shares the same uuid to all its client?
2. If #1 is no, is there an alternative?
Thanks in adv.

Related

How to clone BLE device (configurations,charcterstics etc)and share it with other

I am working on an app that gets data from the BLE device, I am able to code to get the app to connect with the BLE device. But further characteristics read is an issue as I don't physically have the device
i came across an app named nRF Connect for Mobile . It has the functionality to clone BLE if paired. the video for a BLE clone is shown here but export and import is not avaible
Is there any way I can get the BLE cloned say some configuration file, which then imported in certain app create then same BLE device .i can use to read all the characteristics and other properties
Why don't you just connect to the device in for example nRF Connect, write down the services, characteristics and descriptors you see (usually isn't that many). Then just set up a local GATT server with the same content.
If I understood your question and your video correctly, you would like to copy the advertisement data of a BLE peripheral and use it to advertise on an iOS device yourself.
Maybe CBPeripheralManager can help you do that.
You can call startAdvertising([String:Any]?) and advertise a BLE peripheral.
But iOS limits on a system level which keys you can advertise.
From a short look in the documentation, it seems only the keys
CBAdvertisementDataLocalNameKey
CBAdvertisementDataServiceUUIDsKey
are supported.
But if you'd want to include more information about your peripheral, you could still create an own CBMutableService "deviceInfo" and send information within a characteristic after having established a connection.

Get own Bluetooth unique id

My question is how can we detect our own device's unique bluetooth ID (must be available from other device when we scan for nearby available bluetooth)
I tried this
CBUUID *myService = [CBUUID UUIDWithString: #"MyServiceID"];
but in my case this is same as device UUDI.
You can’t. Apple works hard to ensure that apps can not access any identifiers that uniquely identify a device; the Bluetooth MAC address would be such an identifier.
The Bluetooth identifiers that are reported by Core Bluetooth on another iOS device are local to that device.
You could allocate your own UUID and make that available via a characteristic. That way you would know what value the remote device would see, but it would need to connect to retrieve the value. You could also put a specific name in the advertising data.

Pairing two BLE Devices with the same UUID (with CoreBluetooth)

I have two BLE devices with the same UUID. Is there any way to connect to both of them so that they are both connected at the same time?
Right now I'm not able to even see both devices simultaneously using a bluetooth explorer, so I assume for the system they appear as just one device. Is it still somehow possible?
I assume that with UUID you mean the MAC-Address (Bluetooth address) of the device. UUIDs are typically used for services and characteristics.
All connection procedures work with the Bluetooth address as the main parameter. So two devices with the same address will be treated as the same device. (In fact, it is a common requirement that MAC-Addresses of Bluetooth devices should be unique, exactly for this reason.)
So it is not possible to connect to two devices with the same address at the same time. (*)
You can find more information about how connection is done in the Bluetooth Core Spec, Vol. 3, Part C, chapter 9.3.5 - 9.3.8.
(*) This is meant in the common way of having a connection to two different devices. Since incoming messages are not distinguishable on Link Layer level between the two devices with identical address (your control will always think there is only one device with the given address out there), you could mess around with this fact, especially in non-encrypted connections (since encryption is negotiated on a device-to-device basis, another device could not join in an encrypted connection, even if it has the same Bluetooth address). But it is definitely not recommended to do so.
If two devices are having the same UUID , then I think they would be consider as a single device. What I would suggest , send a trigger notification to the UUID and check which device will respond first . Secondly , try to send notification to devices put them far apart . The nearer to your smartphone/bluetooth explorer , will get notify first . Bluetooth works on the distance basis, the device which is near to the source will get the notification than the other one.I tried the same with Beacons but end up like you.

iOS Bluetooth Device in pheripheral mode send request to one central device

iOS Bluetooth Smart.
We have few central devices and one pheripheral devices. How to send from pheripheral device request to one of centrals?
iOS support something like "direct advertising"?
Bluetooth peripherals are supposed to be used as advertisers that the Centrals can find and connect to. Not the other way around. Basically you need to set up your peripheral with service/s that the Central is scanning for. After the central discovers the peripheral, it can then choose to connect, and then exchange additional data between the devices.
Check out the Bluetooth Developer Site for more information.

How to send data to an iphone which is turned into a iBeacon?

how is it possible to send data to an iPhone which acts as an iBeacon?
I am looking for an process as the following:
Search nearby iBeacons
Connect to some iBeacon
Exchange data between the devices
Does anybody know how to put the different bluetooth functions together to make
this possible?
thx in advance
Standard iBeacons are transmit-only devices that can be seen by mobile devices, but don't actually "connect" to them or exchange data.
But you can still do what you are asking if you have an app on all devices as well as a web service to do the data transfer. This would allow devices A and B to detect each other when they are nearby and exchange data. Here's how:
Your app on devices A and B alternates between acting as an iBeacon (advertising its presence with an application-specific identifier and a phone-specific identifier) and ranging for iBeacon signals including the application-specific identifier.
During its ranging cycle, your app on device A will detect an iBeacon transmission from device B, which includes both your application identifier and the device identifier of B.
App A then makes a "write" call to the web service with a source of "A" and a destination of "B", along with any data you want to transfer, like "Device A says hello to device B."
The app would also periodically make a "read" call to the web service. In this example, device B would read any information destined for B, and the web service would return a record that device A had send it a message with the data "Device A says hello to device B."
Because the same process is also running on both phones, this communication can happen both ways.
iBeacon is a proximity technology and isn't designed for data interchange. However, since the Bluetooth stack is going to be active on your iPhone acting as the beacon (so it can advertise its proximity UUID), you can use Core Bluetooth to connect to the beacon and exchange data between the devices.
Does it specifically need to use iBeacon technology? The reason I ask is that from reading your description of the process, you could achieve the same thing using iOS 7's Multipeer Connectivity. It's able to abstract out all the technical complexities of connecting 2 iOS devices together regardless of the interface, be it WiFi or Bluetooth. I've managed to build something similar using MCNearbyServiceBrowser, MCNearbyServiceAdvertiser, and MCSession classes.

Resources