Sometimes BLE scan response doesn't include kCBAdvDataLocalName

2.5k Views Asked by At

I'm developing iOS application which works as BLE central.
I have a question about the scan response information.

My application is working in foreground and executing scanForPeripheralsWithService:options() in every 3 seconds repeatedly.

[_centralMgr scanForPeripheralsWithServices:nil
                                        options:nil];

In almost all case, when didDiscoverPeripheral() is called, my application can get the localName of the peripheral with the key @"kCBAdvDataLocalName".
(The peripheral device is developed by other vendor)

Below is the NSLog output of didDiscoverPeripheral() with localName.

[MyApp] <Warning>: (-[MyBleCentralMgr centralManager:didDiscoverPeripheral:advertisementData:RSSI:]) 
    [name:DeviceName], [state:0], [identifier:240FF7D3-45D5-C4EE-2E96-BED578225C56]
[MyApp] <Warning>: (-[MyBleCentralMgr centralManager:didDiscoverPeripheral:advertisementData:RSSI:]) RSSI=-63, advertisementData={
        kCBAdvDataChannel = 39;
        kCBAdvDataIsConnectable = 1;
        kCBAdvDataLocalName = "DeviceName";
        kCBAdvDataManufacturerData = <[manufactorer data of peripheral device]>;
    }

But sometimes(in rare case), the scan response doesn't have localName.
(But it has another name in [peripheral.name])

Below is the NSLog out of didDiscoverPeripheral() without localName.

[MyApp] <Warning>: (-[MyBleCentralMgr centralManager:didDiscoverPeripheral:advertisementData:RSSI:]) 
    [name:DeviceName], [state:0], [identifier:240FF7D3-45D5-C4EE-2E96-BED578225C56]
[MyApp] <Warning>: (-[MyBleCentralMgr centralManager:didDiscoverPeripheral:advertisementData:RSSI:]) RSSI=-63, advertisementData={
        kCBAdvDataChannel = 39;
        kCBAdvDataIsConnectable = 1;
        kCBAdvDataManufacturerData = <[manufactorer data of peripheral device]>;
    }

The engineer of peripheral device says "I'm always including localName in scan response".

If anyone have information about my questions, please let me know.

  1. Is this phenomenon possible ?(localName disappears from scan response)
  2. What is the difference of localName advertisementdata and peripheral.name
0

There are 0 best solutions below