Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Connecting Bluetooth headset to an embedded Linux device
lino_lastella last edited by
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