locked
[UWP][C#]Bluetooth Low energy unable to connect RRS feed

  • Question

  • This is my code to connect to my BLE device:

    bleDevice = await BluetoothLEDevice.FromIdAsync(Information.Id);
    if (bleDevice == null)
    {
        throw new Exception("Device unavailable");
    }
    service = bleDevice.GattServices[0];
    GattReadResult result = await service.GetAllCharacteristics()[0].ReadValueAsync();
    if (result.Status == GattCommunicationStatus.Unreachable) {
        throw new Exception("Device unavailable");
    }

    // some unimportant code which finds my characteristic - I enable notification for it later:

    GattCommunicationStatus stat = await characteristic.WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify);

    Yesterday, this code worked well. Today, without touching a single line of the code, I'm unable to communicate with BLE device. My program always freezes at WriteClientCharacteristicConfigurationDescriptorAsync. Once, the program displayed exception about some server and max connections reached (0x800704D6 HRESULT) at WriteClientCharacteristicConfigurationDescriptorAsync line.

    Also, my question is how it is possible that ReadValueAsync in my code returns success when obviously Windows are not able to connect to my device (the BLE device is always advertising and I never see Connected label in Settings->Devices->Bluetooth for my BLE device - there is always Paired displayed)?

    Also, please note, that I have no problem with communicating with the BLE device on Android platform.

    And the last thing - removing BLE device (unpairing it) and then again pairing it solves the problem. However, this is bad solution of the problem of course.


    Thursday, October 13, 2016 11:10 AM

Answers

  • Hi Martin Dusek,

    >>” And the last thing - removing BLE device (unpairing it) and then again pairing it solves the problem. However, this is bad solution of the problem of course.”

    It seems no better solution than unpair-and-repair. But there is a good news that you can do unpair-and-repair programmatically and avoiding doing this in windows Bluetooth setting app.

    Best Regards,

    Xavier Eoro


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Saturday, October 15, 2016 11:51 AM
  • @Martin Dusek,

    HRESULT 0x800704D6 means that a connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 19, 2016 9:34 AM

All replies

  • Hi Martin Dusek,

    Welcome to the Developing Universal Windows apps forum!

    Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools  

    We need to know your project's type, and you would need to add tag to title by yourself.

    About your issue, I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Best Regards,

    Xavier Eoro


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 14, 2016 7:00 AM
  • Thank you. I edited the post title and I'm waiting for your response.
    Friday, October 14, 2016 10:30 AM
  • Hi Martin Dusek,

    >>” And the last thing - removing BLE device (unpairing it) and then again pairing it solves the problem. However, this is bad solution of the problem of course.”

    It seems no better solution than unpair-and-repair. But there is a good news that you can do unpair-and-repair programmatically and avoiding doing this in windows Bluetooth setting app.

    Best Regards,

    Xavier Eoro


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Saturday, October 15, 2016 11:51 AM
  • Hi Xavier,

    Thanks for your reply. So is this confirmed as a bug in Windows 10 SDK? When is it expected to be repaired?


    Please note that re-pairing is not good idea as the symptom of the bug is that the app freezes in WriteClientCharacteristicConfigurationDescriptorAsync for minute or two. This delay is not acceptable for the user.
    Saturday, October 15, 2016 9:27 PM
  • Hi Martin,

    Since I didn’t come access this problem with my BLE device.

    I think the key issue is in your BLE device because if it doesn’t store bonding information(for future connections), inevitably, repairing is needed.

    Best Regards,

    Xavier Eoro


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 17, 2016 9:17 AM
  • Hi Xavier,

    I come across this problem very rarely, like 1 occurrence in 50 trials. I always run my program from Visual Studio As Debug x86.

    My BLE device stores bonding information. I already know that one gets different exception (something with session keys, I can't remember exactly) during subsequent connection trials when bonding information are not stored. And I know I got this exception immediately after initiating connection, not after one or two minutes being stuck in WriteClientCharacteristicConfigurationDescriptorAsync.

    I think crucial would be finding more information about exception HRESULT 0x800704D6 . Can you please provide what this exception mean in connection with BLE?

    Monday, October 17, 2016 10:00 AM
  • @Martin Dusek,

    HRESULT 0x800704D6 means that a connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 19, 2016 9:34 AM