dotnet-bluetooth-le icon indicating copy to clipboard operation
dotnet-bluetooth-le copied to clipboard

UWP - Characteristics with property Indicate

Open Totonti opened this issue 5 years ago • 1 comments

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

  1. 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

Totonti avatar Sep 27 '19 06:09 Totonti

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.

smsissuechecker avatar Sep 27 '19 06:09 smsissuechecker