none
Unable to Create a IBluetoothLEDeviceStatics RRS feed

  • Question

  • Hello,

    I try to use WRL/C++ to first scan for Bluetooth LE devices and then to connect to a discovered device. The scanning and discovering devices, works like a charm. Now, I've obtained a 64 bit MAC of a device to connect and I want to use this MAC to call BluetoothLEDevice::FromBluetoothAddressAsync() to connect to this device. To do so in C++, I have to obtain the instance of an object, that implements IBluetoothLEDeviceStatics, which represents the static member functions of BluetoothLEDevice:

        ComPtr< IBluetoothLEDeviceStatics > statics;
        check( GetActivationFactory( HString::MakeReference( InterfaceName_Windows_Devices_Bluetooth_IBluetoothLEDeviceStatics ).Get(), &statics ) );
    

    This fails at runtime with the error code 0x80040154 (Class not registered). What am I'm doing wrong here? (Windows 10 OS Build is 15063.608). Other parts of the Bluetooth LE API works. For example, I can create a IBluetoothLEAdvertisementWatcherFactory using GetActivationFactory().

    Any thoughts, ideas, pointers?

    Thanks in advance and kind regards,

    Torsten

    Wednesday, October 4, 2017 4:02 PM

Answers

  • I believe that you need to do something like this:

    ComPtr <IBluetoothLEDeviceStatics> statics;
    status = GetActivationFactory (StringReference (RuntimeClass_Windows_Devices_BluetoothLEDevice).Get (), statics.GetAddressOf ());

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Wednesday, October 4, 2017 6:40 PM
    Moderator

All replies

  • I believe that you need to do something like this:

    ComPtr <IBluetoothLEDeviceStatics> statics;
    status = GetActivationFactory (StringReference (RuntimeClass_Windows_Devices_BluetoothLEDevice).Get (), statics.GetAddressOf ());

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Wednesday, October 4, 2017 6:40 PM
    Moderator
  • Hi Brian,

    thanks for your response. Good spot! I just found InterfaceName_Windows_Devices_Bluetooth_IBluetoothLEDeviceStatics in the windows.devices.bluetooth.h header and thought, that this must be the correct string constant to be passed to GetActivationFactory(). The correct name of the constant seems to be "RuntimeClass_Windows_Devices_Bluetooth_BluetoothLEDevice" (note: one Bluetooth more ;-) I would have expected to have the "Static" in the name of the key to the factory function, but it looks like, that the function also retrieves additional information from the type of the second parameter (tricky!).

    Thank you very much!

    Kind regards,

    Torsten

    Wednesday, October 4, 2017 7:08 PM