private async Task WriteCharacteristic(UUID uuid, byte[] value) { if (!BcoreCharacteristics.ContainsKey(uuid.ToString().ToLower())) { return; } var characteristic = BcoreCharacteristics[uuid.ToString().ToLower()]; if (!characteristic.Properties.HasFlag(GattProperty.WriteNoResponse)) { return; } await WriteSemaphore.WaitAsync(); characteristic.SetValue(value); DeviceGatt.WriteCharacteristic(characteristic); }
public override void OnCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, GattStatus status) { base.OnCharacteristicWrite(gatt, characteristic, status); WriteSemaphore.Release(); }