Esempio n. 1
0
        /// <summary>
        /// Sends a transaction to the device, which immediately echoes the same data back.
        /// This command is defined to be an uniform function for debugging, latency and performance measurements.
        /// </summary>
        public async Task <ArraySegment <byte> > Ping(ArraySegment <byte> pingData, CancellationToken cancellationToken = default(CancellationToken))
        {
            var message  = new FidoU2FHidMessage(GetChannel(), U2FHidCommand.Ping, pingData);
            var response = await QueryLowLevelAsync(message, cancellationToken);

            if (!pingData.ContentEquals(response.Data))
            {
                throw new InvalidPingResponseException("The device didn't echo back our ping message.");
            }

            return(response.Data);
        }
Esempio n. 2
0
        /// <summary>
        /// Sends a transaction to the device, which immediately echoes the same data back.
        /// This command is defined to be an uniform function for debugging, latency and performance measurements.
        /// </summary>
        public async Task<ArraySegment<byte>> Ping(ArraySegment<byte> pingData, CancellationToken cancellationToken = default(CancellationToken))
        {
            var message = new FidoU2FHidMessage(GetChannel(), U2FHidCommand.Ping, pingData);
            var response = await QueryLowLevelAsync(message, cancellationToken);
            if (!pingData.ContentEquals(response.Data))
            {
                throw new InvalidPingResponseException("The device didn't echo back our ping message.");
            }

            return response.Data;
        }