/* * /// <summary> * /// try to connect to an attached serial device with a name that contains the given string in its device name * /// modifies the serialPort field (either succeeds or sets the field to null) * /// </summary> * /// <param name="name">substring of the device name of an attached device</param> * private async Task getSerialDeviceByName(string name) * { * * try * { * //find the/a usb serial device * string aqs = SerialDevice.GetDeviceSelector(); * var devices = await DeviceInformation.FindAllAsync(aqs); //get array of attached serial devices * var usbDevice = devices.FirstOrDefault(device => device.Name.ContainsIgnoringCase(name ?? "usb"));//search for device with given name * this.serialPort = await SerialDevice.FromIdAsync(usbDevice.Id); //connect to device * * } * catch (Exception ex) * { * //status.Text = ex.Message; * serialPort = null; * } * * } */ /// <summary> /// update/refresh ListOfAttachedSerialDevices /// </summary> public async Task UpdateAttachedDevicesList() { ListOfAttachedSerialDevices = await ss.GetListOfAvailableSerialDevicesAsync(); //await getListOfAvailableSerialDevices(); }