dotnet-bluetooth-le
dotnet-bluetooth-le copied to clipboard
UWP - Characteristics with property Indicate
I have been testing the plugin in UWP and it works fine but I have found that the features with the "Indicate" property are not being enabled correctly. In the file Characteristics.cs of the Plugin.BLE.UWP project, the StartUpdateNativeAsync method would have to be modified to contemplate the "Indicate" option and correctly enable the feature.
Steps to reproduce
- call the method StartUpdateAsync
Expected behavior
The characteristic must be enabled
Actual behavior
The characteristic is not enabled
Solution
I make a change in the method in Characteristics.cs of the Plugin.BLE.UWP project and in this way the characteristic is enabled:
` protected override async Task StartUpdatesNativeAsync() { _nativeCharacteristic.ValueChanged -= OnCharacteristicValueChanged; _nativeCharacteristic.ValueChanged += OnCharacteristicValueChanged;
GattWriteResult result;
if (_nativeCharacteristic.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Indicate))
result = await _nativeCharacteristic.WriteClientCharacteristicConfigurationDescriptorWithResultAsync(GattClientCharacteristicConfigurationDescriptorValue.Indicate);
else
result = await _nativeCharacteristic.WriteClientCharacteristicConfigurationDescriptorWithResultAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify);
result.ThrowIfError();
}`
Configuration
Version of the Plugin: 2.2.0-pre2
Platform: UWP
Device: PC
Hi @Totonti,
I'm the friendly issue checker. Thanks for using the issue template :star2: I appreciate it very much. I'm sure, the maintainers of this repository will answer, soon.