In my iOS app I am reading the measured data from BLE blood pressure and weight scale devices. Now I need to make a list of available paired BLE bluetooth devices in the bluetooth section. I am using swift 3.
However I have searched a lot regarding this problem and found the following links Link 1! Link 2! Link 3! Link 4! Link 5! Link 6! Link 7!
I have found a lot of similar questions in Stack Overflow, but I did not found any suitable sollution for this problem. Sorry for the repeated question.
I have tried with the following code to retrieve the paired bluetooth devices in didDiscover function, but it is showing the BLE devices information only when it is connected.
func centralManager(_ central: CBCentralManager,
didDiscover peripheral: CBPeripheral,
advertisementData: [String : Any],
rssi: NSNumber) {
print("Peripheral Name: \(peripheral.name)")
if peripheral.name != DashboardViewController.UNKNOWN_DEVICE_NAME{
self.connectedPeripheral = peripheral
self.connectedPeripheral?.delegate = self
centralManager.stopScan()
centralManager.connect(self.connectedPeripheral!, options: nil)
let paired = centralManager.retrievePeripherals(withIdentifiers: [(peripheral.identifier)])
print("Paired Devices:\(paired)")
}
}
In my case I need the list of all paired bluetooth devices(connected + disconnected)
Please give me some guidelines to solve this issue.