Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Connect to bluetooth service watch and read HR data

Connect to bluetooth service watch and read HR data

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestionlearning
19 Posts 5 Posters 3 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.
  • W Offline
    W Offline
    Wim Van den Borre
    wrote on last edited by
    #1

    Hey everyone, I'm a beginner in c++ and I'm trying to connect to my garmin watch via bluetooth. The watch is connected on w10, with bluetooth LE explorer i can see the UUID and service ID for the heartrate. I'm looking for a simple way to connect to it from c++ and read the data. The last 2 days i've been trying even c++ builder, all kinds of libraries but can't connect. I'm surprised i can't find simple examples online, bluetooth and windows doesn't seem to be quite simple. Does anyone have an example on this?

    L 1 Reply Last reply
    0
    • W Wim Van den Borre

      Hey everyone, I'm a beginner in c++ and I'm trying to connect to my garmin watch via bluetooth. The watch is connected on w10, with bluetooth LE explorer i can see the UUID and service ID for the heartrate. I'm looking for a simple way to connect to it from c++ and read the data. The last 2 days i've been trying even c++ builder, all kinds of libraries but can't connect. I'm surprised i can't find simple examples online, bluetooth and windows doesn't seem to be quite simple. Does anyone have an example on this?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      See Bluetooth - Win32 apps | Microsoft Docs[^].

      W 1 Reply Last reply
      0
      • L Lost User

        See Bluetooth - Win32 apps | Microsoft Docs[^].

        W Offline
        W Offline
        Wim Van den Borre
        wrote on last edited by
        #3

        So, I've gotten one stop further, I'm using this code: GitHub - urish/win-ble-cpp: Proof of Concept - BLE on Windows (for Web Bluetooth)[^] I've put in my shortcodes for the service and charachteristic and the code manages to complete them for the right UUID's so I assume it connects! these are the shortcodes and ID's, next up, how can i read the values from these?

        auto characteristicUUID = Bluetooth::BluetoothUuidHelper::FromShortId(0x2A37);

        L 1 Reply Last reply
        0
        • W Wim Van den Borre

          So, I've gotten one stop further, I'm using this code: GitHub - urish/win-ble-cpp: Proof of Concept - BLE on Windows (for Web Bluetooth)[^] I've put in my shortcodes for the service and charachteristic and the code manages to complete them for the right UUID's so I assume it connects! these are the shortcodes and ID's, next up, how can i read the values from these?

          auto characteristicUUID = Bluetooth::BluetoothUuidHelper::FromShortId(0x2A37);

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Sorry, I cannot answer that. Once you have established a connection then the data passed between the stations will depend on the devices being used. Check the technical documents for the watch you are using.

          W 1 Reply Last reply
          0
          • L Lost User

            Sorry, I cannot answer that. Once you have established a connection then the data passed between the stations will depend on the devices being used. Check the technical documents for the watch you are using.

            W Offline
            W Offline
            Wim Van den Borre
            wrote on last edited by
            #5

            Ok, I'm getting closer:

            auto leDevice = co_await Bluetooth::BluetoothLEDevice::FromBluetoothAddressAsync(264540343013609);
            auto naam = leDevice->Name;

            auto servicesResult = co\_await leDevice->GetGattServicesForUuidAsync(serviceUUID);
            auto service = servicesResult->Services->GetAt(0);
            auto characteristicsResult = co\_await service->GetCharacteristicsForUuidAsync(characteristicUUID);
            auto test = characteristicsResult->Characteristics->First();
            	auto characteristic = characteristicsResult->Characteristics->GetAt(0);
            

            So firts line, i'm putting in the mac address manually, i check if the name corresponds and indeed it's my garmin. Then i put in the service and charateristic for the heart rate service. Now i'm stuck, how could I get the heart rate value out of this? I read somewhere that it's the first byte but don't know how to extract this

            L 1 Reply Last reply
            0
            • W Wim Van den Borre

              Ok, I'm getting closer:

              auto leDevice = co_await Bluetooth::BluetoothLEDevice::FromBluetoothAddressAsync(264540343013609);
              auto naam = leDevice->Name;

              auto servicesResult = co\_await leDevice->GetGattServicesForUuidAsync(serviceUUID);
              auto service = servicesResult->Services->GetAt(0);
              auto characteristicsResult = co\_await service->GetCharacteristicsForUuidAsync(characteristicUUID);
              auto test = characteristicsResult->Characteristics->First();
              	auto characteristic = characteristicsResult->Characteristics->GetAt(0);
              

              So firts line, i'm putting in the mac address manually, i check if the name corresponds and indeed it's my garmin. Then i put in the service and charateristic for the heart rate service. Now i'm stuck, how could I get the heart rate value out of this? I read somewhere that it's the first byte but don't know how to extract this

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              As I told you earlier, you need to check the documentation for your device. The format of the data it sends will only be documented by the manufacturer.

              W 1 Reply Last reply
              0
              • L Lost User

                As I told you earlier, you need to check the documentation for your device. The format of the data it sends will only be documented by the manufacturer.

                W Offline
                W Offline
                Wim Van den Borre
                wrote on last edited by
                #7

                @Richard, I'm looking for people who have practical advise in this, I'm new to c++ and to everything i'm trying to do here, I've been struggeling for days. There is also not a lot to find on the internet regarding this. If you don't know the answer that's ok, you don't need to answer. I'm not posting on here to get 'check the documentation' answers.

                L 1 Reply Last reply
                0
                • W Wim Van den Borre

                  @Richard, I'm looking for people who have practical advise in this, I'm new to c++ and to everything i'm trying to do here, I've been struggeling for days. There is also not a lot to find on the internet regarding this. If you don't know the answer that's ok, you don't need to answer. I'm not posting on here to get 'check the documentation' answers.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  As I keep pointing out, the format of the data that will be presented by the device is specific to that device. So the only way to find out what it is, and what format it is sent in, is to get the technical documentation for the device. It is not a C++ issue.

                  W 1 Reply Last reply
                  0
                  • L Lost User

                    As I keep pointing out, the format of the data that will be presented by the device is specific to that device. So the only way to find out what it is, and what format it is sent in, is to get the technical documentation for the device. It is not a C++ issue.

                    W Offline
                    W Offline
                    Wim Van den Borre
                    wrote on last edited by
                    #9

                    thanks for hijacking this question, you spend days and days trying to work stuff out, put a question up for help to get this... Don't you have anything better to do? Incredible

                    L J 3 Replies Last reply
                    0
                    • W Wim Van den Borre

                      thanks for hijacking this question, you spend days and days trying to work stuff out, put a question up for help to get this... Don't you have anything better to do? Incredible

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      What do you mean? I have tried to help you and I have told you where to find the information you need.

                      1 Reply Last reply
                      0
                      • W Wim Van den Borre

                        thanks for hijacking this question, you spend days and days trying to work stuff out, put a question up for help to get this... Don't you have anything better to do? Incredible

                        J Offline
                        J Offline
                        jeron1
                        wrote on last edited by
                        #11

                        Wim Van den Borre wrote:

                        you spend days and days trying to work stuff out

                        And Richard is trying to lessen that time by giving you some sage advice. This is how integrations work, if devices are spitting out data in certain format (and many times that format is specific to the vendor) it is up to YOU to determine (by looking at available vendor documentation) and code for this format.

                        "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

                        W 1 Reply Last reply
                        0
                        • J jeron1

                          Wim Van den Borre wrote:

                          you spend days and days trying to work stuff out

                          And Richard is trying to lessen that time by giving you some sage advice. This is how integrations work, if devices are spitting out data in certain format (and many times that format is specific to the vendor) it is up to YOU to determine (by looking at available vendor documentation) and code for this format.

                          "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

                          W Offline
                          W Offline
                          Wim Van den Borre
                          wrote on last edited by
                          #12

                          Ow boy, i started by telling i'm a complete beginner and was looking for people who have experience in this. I'm not looking for dataformats, i'm looking to connect w10 bluetooth through c++ not a lot to find on the interwebz, so if anyone has had succesfull experience with this please answer this thread.

                          D D 2 Replies Last reply
                          0
                          • W Wim Van den Borre

                            Ow boy, i started by telling i'm a complete beginner and was looking for people who have experience in this. I'm not looking for dataformats, i'm looking to connect w10 bluetooth through c++ not a lot to find on the interwebz, so if anyone has had succesfull experience with this please answer this thread.

                            D Offline
                            D Offline
                            Dave Kreskowiak
                            wrote on last edited by
                            #13

                            You're not going to find anyone who has experience SPECIFIC TO YOUR DEVICE. You're getting the correct advice, and as a beginner, you need to learn that the best source of information on a specific device is the manufacturer of that device.

                            Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                            Dave Kreskowiak

                            W 1 Reply Last reply
                            0
                            • D Dave Kreskowiak

                              You're not going to find anyone who has experience SPECIFIC TO YOUR DEVICE. You're getting the correct advice, and as a beginner, you need to learn that the best source of information on a specific device is the manufacturer of that device.

                              Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                              Dave Kreskowiak

                              W Offline
                              W Offline
                              Wim Van den Borre
                              wrote on last edited by
                              #14

                              years ago i made some mvc apps, the help i got on codeproject was incredible. Seems this is down the drain, none of you 3 are even reading my question, in stead of thinking about an answer (why else would you responsd to a question?) it's rtfm and acting hurt.

                              D 1 Reply Last reply
                              0
                              • W Wim Van den Borre

                                years ago i made some mvc apps, the help i got on codeproject was incredible. Seems this is down the drain, none of you 3 are even reading my question, in stead of thinking about an answer (why else would you responsd to a question?) it's rtfm and acting hurt.

                                D Offline
                                D Offline
                                Dave Kreskowiak
                                wrote on last edited by
                                #15

                                I have read it. THe advice you've gotten gets you to the point right after successfully connecting to the device. Reading data from it is device dependant, and that is where the CP advice ends and the manufacturer advice begins.

                                Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                                Dave Kreskowiak

                                W 1 Reply Last reply
                                0
                                • W Wim Van den Borre

                                  Ow boy, i started by telling i'm a complete beginner and was looking for people who have experience in this. I'm not looking for dataformats, i'm looking to connect w10 bluetooth through c++ not a lot to find on the interwebz, so if anyone has had succesfull experience with this please answer this thread.

                                  D Offline
                                  D Offline
                                  David Crow
                                  wrote on last edited by
                                  #16

                                  Wim Van den Borre wrote:

                                  i'm a complete beginner and was looking for people who have experience in this.

                                  You are making a huge assumption that anyone here, beside yourself, has any experience with talking to a "garmin watch via bluetooth."

                                  "One man's wage rise is another man's price increase." - Harold Wilson

                                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                                  "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                                  1 Reply Last reply
                                  0
                                  • D Dave Kreskowiak

                                    I have read it. THe advice you've gotten gets you to the point right after successfully connecting to the device. Reading data from it is device dependant, and that is where the CP advice ends and the manufacturer advice begins.

                                    Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                                    Dave Kreskowiak

                                    W Offline
                                    W Offline
                                    Wim Van den Borre
                                    wrote on last edited by
                                    #17

                                    If anyone is interested in this project, i found code in c# that does almost exactly what i want hr formats are almost the same for a lot of manufacturers, unfortunatelt i need my code to work in c++. GitHub - cornelhuman/QuickBluetoothLE: Quickly create a C# application to read values from a Bluetooth Low Energy device. This application is a Dot.Net 4.7.2 console application that uses the Universal Windows Platform libraries to interact with Blu[^]

                                    1 Reply Last reply
                                    0
                                    • W Wim Van den Borre

                                      thanks for hijacking this question, you spend days and days trying to work stuff out, put a question up for help to get this... Don't you have anything better to do? Incredible

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #18

                                      Well who'd a thought: https://developer.garmin.com/[^].

                                      D 1 Reply Last reply
                                      0
                                      • L Lost User

                                        Well who'd a thought: https://developer.garmin.com/[^].

                                        D Offline
                                        D Offline
                                        David Crow
                                        wrote on last edited by
                                        #19

                                        That almost looks like tools one could use to read data from a Garmin device. I wonder if it would help the OP!

                                        "One man's wage rise is another man's price increase." - Harold Wilson

                                        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                                        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                                        1 Reply Last reply
                                        0
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • World
                                        • Users
                                        • Groups