Open IntelliSenseIoT opened 4 years ago
Property of the parity (none, even, odd) is not changing. We tried with the Baudrate also, it is working.
private async Task<CommonFunctions.Result> opencomport(string DeviceId) { CommonFunctions.Result res = new CommonFunctions.Result(); try { foreach (var oneport in ComDeviceList) { if (oneport.ComDeviceId == DeviceId && oneport.PortOpen == false) { oneport.serialPort = await SerialDevice.FromIdAsync(DeviceId); if (oneport.serialPort == null) { res.Success = false; res.ErrorMessage = "SerialPort object is null!"; return res; } else { oneport.serialPort.WriteTimeout = TimeSpan.FromMilliseconds(oneport.WriteTimeout); oneport.serialPort.ReadTimeout = TimeSpan.FromMilliseconds(oneport.ReadTimeout); oneport.serialPort.BaudRate = 9600; oneport.DataBits = 8; oneport.StopBits = CommonFunctions.SerialStopBitCount.One; oneport.serialPort.Parity = Windows.Devices.SerialCommunication.SerialParity.Even; oneport.serialPort.Handshake = Windows.Devices.SerialCommunication.SerialHandshake.None; oneport.ReadCancellationTokenSource = new CancellationTokenSource(); Listen(oneport); oneport.PortOpen = true; res.Success = true; return res; } } } } catch (Exception ex) { res.Success = false; res.ExceptionError = true; res.ErrorMessage = ex.Message; return res; } res.Success = false; return res; }
Additional information to the previous one:
In Program I change the parity (serial communication), but always remains none. What is the problem?
Problem:
Property of the parity (none, even, odd) is not changing. We tried with the Baudrate also, it is working.
Information about environment and app:
Code: