Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Connecting Bluetooth headset to an embedded Linux device
Qt 6.11 is out! See what's new in the release blog

Connecting Bluetooth headset to an embedded Linux device

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 458 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lino_lastella
    wrote on last edited by
    #1

    Hello.

    I am trying to play some audio files from my Bluetooth headset in a Qt Application running on an embedded Linux system.

    So far I managed to pair and connect the device using the following code:

    /*use a discovery agent to find the device*/
    deviceDiscAgent = new QBluetoothDeviceDiscoveryAgent(this);
        connect(deviceDiscAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
                this,            SLOT(deviceDiscovered(QBluetoothDeviceInfo)));
    
    /*inside slot, when found my device*/
    localDevice->requestPairing(device.address(), QBluetoothLocalDevice::AuthorizedPaired);
    
    /*inside slot callback after pair is successful*/
    socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
    socket->connectToService(address, QBluetoothUuid(uuidStr));
    
    /*in callback after connection to socket is successful*/
    const auto deviceInfos = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
    
        for (const QAudioDeviceInfo &deviceInfo : deviceInfos) qDebug() << "Device name: " << deviceInfo.deviceName();
    

    Now, the listing of output audio device does not include my Bluetooth headset. What am I doing wrong? And if it turns out I can't use the QAudio framework, how can I go about playing a .wav file from the connected socket?

    Thanks a lot

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved