Now I'm looking for the solution to get the correct peripheral from IOS.
Our situation is we have 3-5 ble devices which have the same NAME (say "ZL_RELAY02") And we also have MAC of each devices. In android it very easy because we have MAC address but for IOS how can we identify to correct peripheral?
This case is iPhone device doesn't know all peripherals attributes before. it just have MAC & Password of target peripheral from server.
Hope someone have an idea to help us.
Thanks
Related
I'm a new developer developing a BLE service on iOS and Android. Currently there is a problem that I am facing, that the device address on iOS is the UUID mapped from the mac address, and on Android it is the mac address of the device. So now is there a way on iOS, from the mac address I received can get the corresponding UUID? Thanks everyone!
I am not sure how to do it.
the device address on iOS is the UUID mapped from the mac address
This is incorrect. The peripheral ID is not "from" the MAC address. It's just a random UUID. It's not even stable (it can, and does, change over time, though not quickly). There is no way on iOS to get the MAC address of a BLE device, or even to absolutely uniquely identify a BLE device unless you control the firmware. If you do control the firmware, then you can provide some mechanism to uniquely identify the device over a protocol of your own design.
As a broad rule, you can use the peripheral ID to identify or connect to a device you've connected to before. This isn't 100%, because the ID does change sometimes. But for the most part it does work (and it's intended to work, so Apple won't just break this arbitrarily). But you cannot otherwise identify the device.
As a corollary, the peripheral ID on one iPhone is completely unrelated to the peripheral ID on another phone for the same device. This is intentional.
You will have to adjust your design to deal with these facts.
I just started learning the ionic framework and I am working with BLE libraries.
I can scan for other BLE devices and get thier information when I run it on an Android phone (physical). The response look something like this...
'name': 'Device Name',
'id': 'DC:A6:32:D9:56:15',
'advertising': {},
'rssi': -35
link to documentation of BLE https://ionicframework.com/docs/v3/native/ble/
I was able to do the same thing on IOS BUT the MAC address/ID looks like this...
88C4BC81-E67F-E804-03C3-47E4296F577D
It looks like a serial number.
Can someone please explain to me why?
I look at different encoding and such but no luck.
To be honest I do not know what the right question is to ask.
Thank you for your help.
Sorry if this question is not clear.
The "MAC address/ID" on iOS is not a MAC address. You're reading the identifier property. That's a UUID created by the phone. It's generally consistent for a given device, but may change over time (though never during a single connection, and they don't generally change that often).
There is no way to get the MAC address of a CBPeripheral on iOS. There is no way to uniquely identify a BLE device on iOS in a way that is consistent across iOS devices, or that is promised to be permanent on a single iOS device.
I would like to get the MAC address of the device my iOS device connects to via BLE, but I can see only the UUID.
I've understood from searching the issue over the web that's it's not possible to get the MAC, but only in UUID. I've also understood that the UUID is generated by the iOS and that the device doesn't "know" it...however the posts i've found were old (2-3 years old) so I was wondering if anything has changed? Is there a way to get the MAC rather than the UUID, or at least reproduce the process that iOS does to convert UUID back to MAC address?
Thanks in advance
In iOS not possible to get mac address of CBPeripheral object. If CBPeripheral object advertisement mac address in "kCBAdvDataServiceData" value then convert to mac address, otherwise not possible. In iOS unique id is UUID for CBPeripheral. Every diff. iOS device shows diff. UUID of same CBPeripheral. If differentiate two or more CBPeripheral object then use RSSI range/value.
I'm working on an application for iOS (Objective-C).
I'm looking for a way to connect to a BLE device so that you can specify the MAC or UUID of this device.
Currently I have two BLE devices with the same name so the app is not able to differentiate between the two , which gives many problems (these devices do not have the same functions).
Is there any way to specify the MAC or UUID when connected to BLE device?
RSSI signal strength discover the differentiate two or more device.
If once time UUID get from peripheral then also differentiate peripheral.
Note: iOS doesn't give permission to read MAC address of peripheral.
The MAC of the device is not available, nor is any other particularly useful identifier. However, since "these devices do not have the same functions," they should have different services that they advertise. When calling scanForPeripherals(withServices:options:) you should be passing the specific service or services you're interested in. This is much better for performance, and also will automatically filter out devices you are not interested in. Passing nil for serviceUUIDs should only be done for a generic BLE scanner.
If you control the device firmware, you can add services to identify the type of device, or add information in the manufacturer's advertising data to distinguish the devices during scanning.
If these devices advertise the same services and are otherwise identical, then you will need to connect to both and query them to determine which device you wanted. You still will not receive a MAC, however, unless the device provides it via some characteristic.
Typically, a given device will continue to have the same CBPeripheral UUID, and this can be used to reconnect to previously known devices. However, if the device never pairs securely, this UUID is not always stable, either.
Current status , I have a BLE Device which uses ANCS so I thought this is the place ot ask the question.
My BLE device lights an LED when my phone rings and I also receive the ANCS messages on my iPHone in the Notification center.
I want to build an app that interacts with the BLE device that has the ANCS and have an options section, I have the ability to to connect to my BLE device by doing a scan and than connecting, But my question is when i am connected to the BLE Device with my iPhone and receive ANCS messages , How do I also connect my App to the BLE device and communicate with it , while it is connected to my iPhone.
Any help guidance direction is greatly appreciated.
JZ
Not sure if this post will solve your issue, but it sounds similar to your problem and might point you in the right direction (iOS isnt really my thing, so I cant give you much information)
Hope it helps.