BT: How to pair and add services



  • I'm playing with Bluetooth classes on Qt5.6.
    My goal is to handle the pairing of a client, showing up the pin and decide which services connect: A2DP and/or HFP.

    Right now I set the local adapter in discoverable mode:

    QBluetoothLocalDevice localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable);
    

    then I connected all signals to related slots.
    From my smartphone I discover the adapter and once clicked the deviceConnected signal is fired. Now I call:

    localDevice.requestPairing(address, QBluetoothLocalDevice::Paired);
    

    The pairingFinished signal is fired and after few seconds also the deviceDisconnected one.

    Because I request "paired" mode I was expecting also the pairingDisplayPinCode and pairingDisplayConfirmation signals.

    Furthermore, how to add services? Is there an example?



  • You use QBluetoothLocalDevce LocalDevice.is it available?what's the LocalDevice.isValid() return back?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.