/// <summary> /// try to connect to an attached serial device with a name that contains the given string in its device name /// </summary> /// <param name="name">substring of the device name of an attached device</param> /// <returns>true if connection succeeded, else false</returns> public async Task <bool> OpenSerialConnection(string name) { serialPort = null; serialPort = await ss.GetSerialDeviceByNameAsync(name); //try to connect to serial device with given partial device name //await getSerialDeviceByName("name"); //try to connect to serial device with given partial device name ReadCancellationTokenSource = new CancellationTokenSource(); if (serialPort != null) { return(true); } else { return(false); } }