wpf - c# Bluetooth LE - write configuration error - ValueChanged never called -


so try connect c# wpf program ble device , code connect device:

private async task connecttowatcher(deviceinformation deviceinfo) {         try {             // device             bluetoothledevice device = await bluetoothledevice.fromidasync(deviceinfo.id);              // gatt service             thread.sleep(150);             var gattservicesresult = await device.getgattservicesforuuidasync(new guid(rx_service_uuid));             service = gattservicesresult.services[0];              // gatt characteristic             thread.sleep(150);             var gattcharacteristicsresult = await service.getcharacteristicsforuuidasync(new guid(rx_char_uuid));             characteristic = gattcharacteristicsresult.characteristics[0];              // register notifications             thread.sleep(150);              characteristic.valuechanged += (sender, args) => {                 debug.writeline($"[{device.name}] received notification containing {args.characteristicvalue.length} bytes");             };              gattwriteresult result =             await characteristic.writeclientcharacteristicconfigurationdescriptorwithresultasync(gattclientcharacteristicconfigurationdescriptorvalue.notify);             debug.writeline($"characteristics write result: status={result.status}, protocolerror={result.protocolerror}");          } catch (exception ex) when ((uint)ex.hresult == 0x800710df) {             debug.writeline("bluetooth error 1");             // error_device_not_available because bluetooth radio not on.         }     } 

the line

 debug.writeline($"characteristics write result: status={result.status}, protocolerror={result.protocolerror}" 

creates output characteristics write result: status=protocolerror, protocolerror=3 couldn't find anywhere whats supposed mean. effect method characteristic.valuechanged never gets called.

do have more have characteristic configurated? , has idea why method isn't called or error message means?

thanks bunch.

apparently, windows 10 builds have com security bug. solution register windows-insider-program , update windows.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -