How to retrieve all connected bluetooth peripherals

Viewed 1714

I am trying to get a list of all connected Peripherals to an iPhone. I have a Bose Soundlink connected but it doesn't show up in my app. I don't know the UUID so am passing [] as this should get all I think?

func centralManagerDidUpdateState(_ central: CBCentralManager) {
    var message = ""

    switch central.state {
      case .poweredOn:
         message = "Bluetooth LE is turned on and ready for communication."

         // scan for ALL devices
        centralManager.scanForPeripherals(withServices: nil, options: nil)

         let connectedPeripherals = self.centralManager.retrieveConnectedPeripherals(withServices: []) 
        // WILL [] RETURN ALL CONNECTED PERIPHERALS?
        print("connectedPeripherals are \(connectedPeripherals)")
    }
}
1 Answers
Related