Sending a message/notification from a Garmin watch app to a Qt android app

I have developed a Qt C++ application that runs on my Samsung S22 phone. This phone app controls a pickleball machine that I built.

The Qt app on my phone uses classic Bluetooth to communicate with a Raspberry PI 3A+ that controls the pickleball machine. I was thinking of programming a watch app on my Garmin Forerunner 945 to simply start and stop the pickleball machine instead of always relying on my phone.

The use case is that I would use my phone to just setup the pickleball machine (ball speed, height etc) and leave the phone in my pocket or in a bag. The watch app would make it very convenient to start, stop, pause my machine on a pickleball court.

I have already coded a simple watch app to learn the basics of coding with Connect IQ.

I'm looking for a recommendation for the use case I described above: is it possible to send a message/notification from my Garmin watch app to the custom Qt app on my phone? This would the idea case.

I also experimented with some code on my watch to use Bluetooth LE to directly interface with my Raspberry PI but this is somewhat complicated by the fact that I already use classic Bluetooth and my Garmin app does not seem to detect the BLE server I created on the PI for testing purposes (the watch app can scan other BLE devices when I check the log app on my watch). I already used some BLE example code I found on the Garmin forum related to the Raspberry PI.

Any ideas, suggestions are welcome. Thank you.

  • (updated)

    Here's a blog post I did a few years back about using CIQ BLE with a Raspberry Pi.  It talks to a pi directly, and not the phone, as trying to use BLE on the same phone as you are paired to doesn't seem possible.  You can use makeWebRequest to talk to a server on your phone if that's needed.

    https://forums.garmin.com/developer/connect-iq/b/news-announcements/posts/would-you-like-some-raspberry-pi-with-your-connect-iq

    I use the Pi Zero, Pi Zero 2, Pi 3, 4.and 5

    With my blescan app, you can see exactly what a garmin sees.

    https://apps.garmin.com/apps/9bcc8b66-8385-4afb-b93e-f69e01422284

    Since I did the blog post, I use basically the same logic with environmental sensors, HVAC, and a much more complex interface for a garage door, and have LED, TFT and Eink interafces on the pi to watch things without running an app on my Garmin.

    Depending on your Garmin, the BLE range can vary.

  • Hello Jim,

    Thanks a lot for your reply. I will try your blescan app.

    I actually leveraged some of your connect iq code from the post you mentioned in your reply. From my Garmin watch, I can scan for BLE devices using your code. Your code was definitely a great example to show how to use BLE from my watch.

    On the PI side, since I already use Python, I tried this Python gatt server code to advertise my service using this project as a starting point, from which I extracted only the BLE server code. It seems to run OK but I can't see it from my connect iq app.The name defined in the BLE gatt server appears briefly though when I scan for bluetooth devices using my phone before the raspberry device name takes over in the scan list.

    https://github.com/gitdefllo/lighthouse-weather-station/tree/master/station/ble_gatt_server

    May be I should try your code on the PI side, this is the next step. However, I have a simple question:

    Can the PI support both my classic Bluetooth Python server and another BLE server running at the same time? 

    In /etc/bluetooth/main.conf on the PI, the ControllerMode is the default for dual, both BLE and classic so I would guess it should allow both modes concurrently?

    Best Regards,

    Pierre

  • I've never had any luck running two BLE servers (different UUIDs) on the same pi at the same time.

  • Thanks Jim.

    This is the problem I suspected.

  • Jim, I can't thank you enough for suggesting to use makeWebRequest. It turned out to be a very simple solution.

    I implemented a simple Qt http server listening on 127.0.0.1:8000 in my existing Qt application 6.5.3 running on my Samsung phone S22. It just takes a few lines of code in Qt to do this in the phone app using the built-in httpserver module.

    On my phone, I have this code waiting for a web request from my Garmin watch app.
    This web request will simply invoke the start button in the GUI to start launching pickleball balls like if
    I had actually clicked on the button myself in the GUI.

    Qt code excerpt:

    httpServer.route("/start_launcher", []() {
        qDebug() << "started pickleball launcher" ;
        m_startButton->clicked();
        return "launcher_started";
    });

    My Garmin watch app (Garmin Forerunner 945) sends this request:

    function makeRequest() {
    var url = "">127.0.0.1:8000/start_launcher";
    ....

    I wasn't sure if Garmin had blocked non https requests based on some posts I read before but it works in my case. This is now so cool, I can just click on a button on my watch to start and stop my machine!

  • HTTP can be used but only with a server on your phone, addressed by 127.0.0.1 or localhost