public IAsyncOperation <string> sendRequest(string device, string data) { Log.WriteLine("\n--->Send Request " + data); IBuffer mybuffer = GattConvert.ToIBufferFromHexString(data); byte[] mybyteArray = GattConvert.ToByteArray(mybuffer); Request req = (SelectedDevice != null) ? SelectedDevice.RegisterRequest(mybyteArray) : null; if (req != null) { req.index = index; index++; } return(Task.Run(() => waitSendRequest(req)) .AsAsyncOperation()); }