0

I can only successfully connect to my device when it says "Connected" in Windows Bluetooth Menu, which happens only for a brief second after pairing, otherwise when the device says "Paired" I get an error when writing to the descriptor or characteristic.

// ret is E_ABORT
HRESULT ret = BluetoothGATTSetDescriptorValue(hLEDevice, descBuffer, &newValue, BLUETOOTH_GATT_FLAG_NONE);

Is there any way to signal the device into the "Connected" state from the host or is there another way to solve this issue?

karamazovbros
  • 950
  • 1
  • 11
  • 40
  • 1. Use WinRT instead of classic API. If it is not possible then right after pairing read device's services, this keeps device connected. – Mike Petrichenko Oct 23 '19 at 20:42
  • Why switch to WinRT? My app does work successfully while in the "connected" state, but that's problematic, because it's not efficient to that every time. – karamazovbros Oct 23 '19 at 20:53
  • Why WinRT? Becasue you do not need to pair with device. If your device has random MAC you must repair it each time (with WinRT you simple connect to it without pairing). – Mike Petrichenko Oct 23 '19 at 21:04
  • The read/write operation should be executed when the device is in connected state. So why the device goes to paired is the issue we need to find out. Could you show a mini, complete and reproducible code sample? And what's your windows version? – Rita Han Oct 24 '19 at 01:07
  • @RitaHan-MSFT I believe that communication is being handled between Windows and the device when it's initially paired. As to why it goes into the "paired" state, it's most likely because Windows finished that initial setup after discovering the services. I guess that's why I was wondering if this is a device firmware issue for handling communication with Windows setup process or if there Windows API exists to signal the device back into the connected state. – karamazovbros Oct 24 '19 at 17:14
  • Also going to link this, because I discovered this is a similar problem. https://stackoverflow.com/questions/32368370/bluetooth-low-energy-low-rate-on-windows – karamazovbros Oct 24 '19 at 21:00
  • @karamazovbrosk You can use [this UWP sample](https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/BluetoothLE) to narrow down this issue if it is Windows or the device related. If the UWP sample can't reproduce this issue please show a mini, complete and reproducible sample code I can do a further investigation. – Rita Han Oct 25 '19 at 06:45
  • @RitaHan-MSFT I ended up using WinRT ABI, which gave me a better insight on how to establish connection with a paired or unpaired device. – karamazovbros Nov 14 '19 at 18:41

0 Answers0