Hello,
I've asked this question already at StackOverflow, and while I try Wireshark I wanted to see if someone has experienced the same issue and/or can provide further information. Thestack overflow link is the following: Link. The explanation of the issue will be pretty much the same.
I'm developing an UWP app meant for Windows10 that prints connects to the sensor and prints some of the data it sends. It doesn't do anything else.
I have a BLE sensor based on the Nordic nRF52832 SoC that sends data at a frequency of 100Hz and I've developed an UWP application to receive this data. I'm having a weird issue where after a couple of seconds of everything working fine, I stop recieving notifications for new data and the sensor disconnects.
Now, I say it's weird because this happens when I'm using the laptop's internal bluetooth but not when using a bluetooth dongle. When using the dongle it works fine and never stops. Both internal bluetooth and dongle drivers are updated to the latest version Windows can find.
A bit of information about my code:
- I have a Sensor.cs class in which I handle the connection and the streaming of the data.
- I'm using
BluetoothLEAdvertisementWatcher
in order to find the sensor. - The
GattCharacteristic
's are private members of the Sensor class. - I subscribe to notifications by calling:
await _gattDataSensorsCharacteristic.WriteClientCharacteristicConfigurationDescriptorAsync( GattClientCharacteristicConfigurationDescriptorValue.Notify);
- The characteristic I'm calling admits read/notify. And the issue is that characteristic.ValueChanged += Characteristic_ValueChanged; stops firing.
I've done quite a research and couldn't find anything similar. I've found posts about notifications stopping because the object was taken away by the GC, the characteristics were local variables instead of class members or calls weren't awaited.
Things I've tried:
The laptop is running the max performance power consumption profile, this issue happens when the laptop is plugged to a power source or not.
In Windows Device Manager under Bluetooth device properties. Right clicked and checked the propeties of the BT, in the Power Management tab "Allow the computer to turn off this device to save power" is unchecked.
As posted in StackOverflow, the link to the code I'm using is here: GitHub
Does anybody know why does this happen? Or point me to the right direction to solve the issue? Having to carry the dongle is a pain in the ass and they are rather fragile, I've already broken 2 this month.
Thanks.
1st edit
I've scanned the traffic usig USPCap and loading the data to WireShark. Tried to understand what the pcap file generated by USBPcap, but I simply don't understand. I've tried the issue with 2 sensors and the disconnect/notification stop pattern looks different for each sensor. I've made a Dropbox folder containing the two pcap files: Dropbox
From what I understood, in the file "ble-FE592382586F.pcap" the interesting line No are: 12647 and 12681. It says the source is the controller and the destination is host. Is the controller the laptop's bluetooth driver?