コード例 #1
0
        public async Task SetConnectionSettings(DeviceConnection.ConnectionSettings connectionSettings)
        {
            await ftDevice.SetBaudRateAsync(connectionSettings.BaudRate);

            await ftDevice.SetDataCharacteristicsAsync(GetWordLength(connectionSettings.DataBits), GetStopBits(connectionSettings.StopBits), GetParity(connectionSettings.Parity));

            await ftDevice.SetFlowControlAsync(GetFlowControl(connectionSettings.Handshake), connectionSettings.XOn, connectionSettings.XOff);
        }
コード例 #2
0
ファイル: SerialDevice.cs プロジェクト: pjofon/FTDISample
        public Task SetConnectionSettings(DeviceConnection.ConnectionSettings connectionSettings)
        {
            device.BaudRate  = connectionSettings.BaudRate;
            device.Handshake = connectionSettings.Handshake;
            device.Parity    = connectionSettings.Parity;
            device.StopBits  = connectionSettings.StopBits;
            device.DataBits  = connectionSettings.DataBits;

            if (connectionSettings.XOn != 0x00 || connectionSettings.XOff != 0x00)
            {
                throw new Exception("Setting the XOn / XOff bytes is not supported for the WindowsSerialDevice.");
            }

            return(Task.CompletedTask);
        }