Exemple #1
0
        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);
        }
Exemple #2
0
        public override void OnCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, GattStatus status)
        {
            base.OnCharacteristicWrite(gatt, characteristic, status);

            WriteSemaphore.Release();
        }