Skip to content

[BluetoothLEHelper] ObservableGattCharacteristics improvements (respect properties) #2873

@GeertvanHorrik

Description

@GeertvanHorrik

I'm submitting a...

Current behavior

The ObservableGattCharacteristics does not respect the properties when calling methods.

Expected behavior

Respect the bluetooth specs.

Potential fix

These fixes might contain pseudo code:

  • ReadValueAsync
if (!Enum<GattCharacteristicProperties>.Flags.IsFlagSet(_characteristic.CharacteristicProperties, GattCharacteristicProperties.Read))
{
    Log.Debug($"[{this}] Reading is not supported");
    return null;
}
  • SetIndicateAsync
if (!Enum<GattCharacteristicProperties>.Flags.IsFlagSet(_characteristic.CharacteristicProperties, GattCharacteristicProperties.Indicate))
{
    Log.Debug($"[{this}] Indicate is not supported");
    return false;
}
  • SetNotifyAsync
if (!Enum<GattCharacteristicProperties>.Flags.IsFlagSet(_characteristic.CharacteristicProperties, GattCharacteristicProperties.Notify))
{
    Log.Debug($"[{this}] Notify is not supported");
    return false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions