Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.79 KB | None | 0 0
  1. if let bluetoothDevice = IOBluetoothDevice(addressString: "Bluetooth Device ID")
  2. {
  3.     if !bluetoothDevice.isPaired() || !bluetoothDevice.isConnected() { continue }                    
  4.     // Device is connected and paired, everything works fine until here.
  5.     if bluetoothDevice.isHandsFreeDevice
  6.     {
  7.        // This line will also be executed, so the device supports the HFP.
  8.        let handsFree = IOBluetoothHandsFree(device: bluetoothDevice, delegate: self)
  9.        // handsFree?.connect()
  10.        // Swift.print(handsFree?.isConnected) // returns false.
  11.        let batteryValue = handsFree?.indicator(IOBluetoothHandsFreeIndicatorBattChg)
  12.        Swift.print(batteryValue) // Always returns zero, can't be true.
  13.        Swift.print(handsFree?.outputVolume) // Always returns 0.5.
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement