0

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?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Iván
  • 33
  • 1
  • 7
  • 2
    No. CoreBluetooth will create an identifier that is based on the MAC but you would normally distinguish devices by the services that they advertise in combination with the name. Once the user has initially connected to the device then you can store the identifier. The next time that device is seen it will have the same identifier. – Paulw11 Sep 08 '16 at 11:04

2 Answers2

1

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.

Deepak Tagadiya
  • 2,187
  • 15
  • 28
0

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.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610