Make Bluetooth app that act as Headset



  • Hi,

    I want make an open source desktop app that act as headset, and have some buttons to send play/pause command.

    Im using the chat example to try make it possible, but after a lot of search and tests i cant make it possible.

    Anyone have an example about how i can do it?

    Thanks.


  • Moderators

    @prsolucoes How to do what?
    Your question is way to generic!
    You should tell what you did and what did not work.



  • Just to warn you, Qt bluetooth support is not great. Every time I've tried to use it I have run into some major blocks. Some of those blocks get resolved in new versions of Qt, but overall I find it to be severely lacking.

    I love most of Qt, but I would steer clear of the bluetooth stuff to save yourself a ton of aggravation. It just isn't ready for the real world yet.

    Small disclaimer here, it worked for basic usage but if I got advanced or used devices that required a bit "more" it failed almost all the time. Specifically my work was with credit card terminals. So while I could pair and play with things like headsets no problem, when I got into more complicated devices it just didn't cut it.

    One particular problem I dug into the Qt code itself and found it just wasn't even finished. There were execution paths that did absolutely nothing. So use at your own risk. :)

    And finally, your question is basically asking for a working application which would be us writing the whole thing for you. You definitely need to do some work and present us with problem code to help you figure out. :)



  • Hi,

    My code is based on "Bluetooth Chat" example, but im working only with the server part.

    I want change the server part to make the bluetooth server act as a Headset. After it, i want connect any smartphone to it and send over bluetooth the command to play/pause, to simulate a radio or headset their bluetooth commands.

    I dont make nothing more that try connect my smartphone android with the server of chat. But i dont have success, because when i select it on my phone it connect and disconnect at the same time.

    There is any other bluetooth framework than from Qt?

    Thanks.


  • administrators

    Having seen a couple of similar threads in the past.

    What you are trying would require your hardware and operating system to support the needed bluetooth services (HSP, HFP...).
    Then some protocol that handles the stream once you have an audio connection (I have no clue what that format is).
    And last you would need to have an encoder and a decoder for the sound in the stream.

    Qt does not have those pieces, as they are usually provided by the operating system.

    So the answer is; it probably can be done, but needs a lot of work.



  • Thanks.

    But i need only send some commands over bluetooth, dont need send the file/audio over it.

    Example:
    Sending 0x00000055 over BT make the device play/pause.
    Sending 0x00000058 over BT make the device go to previous music.

    Is only this i need. But the bluetooth server need be a headset type.



  • There is any other bluetooth framework than from Qt?

    Well Qt just wraps bluetooth systems for each platform. So you could write directly to those. For instance bluez in Linux.

    That's what I ended up doing is writing direct. It's a lot to deal with and it would be nice if the QtBluetooth stuff worked better. It may now, my first project with bluetooth was 2 years ago and my latest was a year ago. Things may be great now in comparison. ;)


  • administrators

    That should be doable nowadays.
    The protocol and service type uuids you need are supported (see for the lists http://doc.qt.io/qt-5/qbluetoothuuid.html )

    I probably would take the heart rate server example as a base from which to go forward http://doc.qt.io/qt-5/qtbluetooth-heartrate-server-example.html
    It is BT LE, but it is a really simple example on how to set up a server.


Log in to reply
 

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