Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Make Bluetooth app that act as Headset
QtWS25 Last Chance

Make Bluetooth app that act as Headset

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 3.1k Views
  • 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.
  • P Offline
    P Offline
    prsolucoes
    wrote on last edited by
    #1

    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.

    jsulmJ 1 Reply Last reply
    0
    • P prsolucoes

      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.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • A Offline
        A Offline
        ambershark
        wrote on last edited by ambershark
        #3

        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. :)

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        1
        • P Offline
          P Offline
          prsolucoes
          wrote on last edited by
          #4

          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.

          A 1 Reply Last reply
          0
          • tekojoT Offline
            tekojoT Offline
            tekojo
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            1
            • P Offline
              P Offline
              prsolucoes
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              1
              • P prsolucoes

                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.

                A Offline
                A Offline
                ambershark
                wrote on last edited by
                #7

                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. ;)

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                1 Reply Last reply
                0
                • tekojoT Offline
                  tekojoT Offline
                  tekojo
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  2

                  • Login

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