Post

Replies

Boosts

Views

Activity

CentralManager does not get the changed localNameKey at advertisement[CBAdvertisementDataLocalNameKey]
I scan my ble device with the code below. centralManager.scanForPeripherals(withServices: [connectionServiceUUID], options: nil) and the call back method is called when the device is scaned. func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) { ... } I have 2 questions with the value of advertisementData[CBAdvertisementDataLocalNameKey] from the callback method. Suppose there is connections, and the localNameKey of the device is A. When it is scanned and connected at first, the advertisementData[CBAdvertisementDataLocalNameKey] I get is not A but something else. Here, if I do the same then I get A. Now, I change the localNameKey of the device to B. And when it is scanned, the advertisementData[CBAdvertisementDataLocalNameKey] is still A, and I do the same, now it is B. Why? When the screen is off, advertisementData[CBAdvertisementDataLocalNameKey] never changes, why?
0
0
328
Jan ’24
centralManager does not get the changed advertisementData[CBAdvertisementDataLocalNameKey] when the screen is off
I have a BLE device and the centralManger scans with "centralManager.scanForPeripherals(withServices: [connectionServiceUUID], options: nil)" Then func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) { ... } is called. Here, I could get the advertisementData[CBAdvertisementDataLocalNameKey]. I have set my BLE device to change its local name key for every connections. The BLE communication is repeated in the background.(scan, connect, stop scan, disconnect, ... etc) It works well, but when the screen is off, the value of advertisementData[CBAdvertisementDataLocalNameKey] in didDiscover does not change. Why?
0
0
446
Jan ’24