C# examples for connecting to a Bluetooth Low Energy Device? RRS feed

  • Question

  • All the samples I found were for JS projects.

    I downloaded C++ samples, but could not get any of them to work correctly.

    I am able to enumerate my heart rate monitor, but I cannot connect to it.

    I can use Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(), 

    and it returns all the devices, but I can't figure out what to do with it from here.

    I instantiated a PortableDeviceApiLib.PortableDeviceManager, but if I use that API to call GetDevices or GetPrivateDevices, I don't see my heart rate monitor in the returned devices.

    So I tried using the pnpid I got from FindAllAsync with a PortableDeviceApiLib.PortableDeviceDispatchFactory, but it throws an exception when I call GetDeviceDispatch with the pnpid. It however, succeedes, if I use the exact same code to get the device dispatch for a thumbdrive, so the code for obtaining the pnpip and using the factory works, it only fails when the device is a BT/LE Heart Rate Monitor.

    Someone suggested compiling user mode drivers, so I downloaded those samples, and they built sucessfully, but I can't isntall them, as it keeps saying that they are "not compatible". I disabled signature verification, I checked to make sure the debug drivers were signed, I enabled testsigning, etc, but they still won't install. So I'm not sure if this problem is related.

    If anyone can shed any light on this, I'd be very appreciative, as so far the samples don't seem very helpful.


    Tuesday, October 30, 2012 6:51 PM


All replies

  • did you ever find anything?

    2010: Q6700 3GHz; 6GB DDRII; ~ 2.7TB internal; ATI RAEDON 5770 1GB @ Stock; Elixir Keyboard; Gigabyte GM-M6800; 2 x E173FPf 2005: 2GIG RAM, 3.6Ghz P4, 2 x 200gb SATA HD 8mb cache, 256mb 9950 ATI RADEON,19" LCD Core i7 3.2GHz, 6GB DDRIII, ASUS 512MB EN8800GT

    Tuesday, January 14, 2014 7:18 PM
  • Bluetooth LE support is new for Windows 8.1. See the Bluetooth Generic Attribute Profile - Heart Rate Service  sample.
    Tuesday, January 14, 2014 9:35 PM
  • Does it still require you to write a custom user mode driver? A while ago, someone pointed me to the "new" API support, but I found the user mode driver to be a huge pain in the arse. Most people I talked to said it was far easier to use a side-band driver interface than to use MSFT's new APIs... Was this remedied in 8.1? The previous samples were for Windows 8. The previous sample app didn't even work, as it couldn't discover any of my heart rate monitors, which worked fine with the BT/LE APIs on both Android and iOS. I think the main problem was the lack of documentation...
    • Edited by avs Tuesday, January 14, 2014 9:48 PM
    Tuesday, January 14, 2014 9:46 PM