BluetoothService object convert to QBluetoothServiceInfo object



  • Hi All,

    Im trying to get a bluetooth communication going between an Android mobile and a bluetooth enabled Desktop PC.

    I have been scanning the bluetooth services from Android using the BluetoothDiscoveryModel QML type, which returns a BluetoothService object type. Now I want to connect to a selected bluetooth service but Im doing this from C++ (not QML). So I need to convert the BluetoothService object into a QBluetoothServiceInfo object.

    How do I do this? Any ideas would be really helpful. Ive been stuck on this for days now! :(

    Thanks a bunch!



  • You do not need a QBluetoothServiceInfo to open a connection. You only need the destination addressand either the port number or the service UUID.

    BluetoothService provides the address and the UUID - so you have already what you need.

    QBluetoothSocket::connectToService(const QBluetoothAddress & address, const QBluetoothUuid & uuid, OpenMode openMode = ReadWrite)


Log in to reply
 

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