public static async Task <bool> WriteByteArrayToCharacteristicAsync(this GattCharacteristic characteristic, byte[] bytes)
        {
            try
            {
                if (characteristic == null)
                {
                    throw new ArgumentNullException(nameof(characteristic));
                }

                var writeOperationResult = await characteristic.WriteValueAsync(bytes.AsBuffer());

                return(writeOperationResult == GattCommunicationStatus.Success);
            }
            catch (Exception ex)
            {
                Microsoft.HockeyApp.HockeyClient.Current.TrackException(ex);
                return(false);
            }
        }
Ejemplo n.º 2
0
 async Task PlatformWriteValue(byte[] value, bool requireResponse)
 {
     await _characteristic.WriteValueAsync(value.AsBuffer(), requireResponse?Uap.GattWriteOption.WriteWithResponse : Uap.GattWriteOption.WriteWithoutResponse);
 }
Ejemplo n.º 3
0
 async Task DoWriteValue(byte[] value)
 {
     await _characteristic.WriteValueAsync(value.AsBuffer());
 }