2017-10-02 26 views
0

iPhoneに接続されているすべての周辺機器のリストを取得しようとしています。私はボーズサウンドリンクを接続しているが、それは私のアプリに表示されません。私はUUIDを知っていないので、これは[私が思うすべてを得なければならないので]渡していますか?接続されたすべてのBluetooth周辺機器を取得する方法

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

Bluetoothのクラシックだけでなく、本当にBLEですか? – Larme

+0

あなたの記事に感謝を込めてください。https://meta.stackoverflow.com/questions/288160/no-thanks-damn-it –

+0

良い点Larme、Boseは確かにBluetooth Classicです。くそー! – richc

答えて

0

あなたが接続されているすべての周辺機器を取得したい場合は、私の提案は次のとおりです。retrieveConnectedPeripheralsにパラメータとして文字列180Aを追加します。すべてのBluetoothスマートデバイスは、デバイス情報(180A)サービス(少なくともこの1つ)を実装しています。

関連する問題