Пример #1
0
            internal static DCB Create(IntPtr hPort, Parity parity, bool txFlowCTS, bool txFlowDSR,
                                       HSOutput useDTR, bool rxGateDSR, bool txWhenRxXoff, bool txFlowX,
                                       bool rxFlowX, HSOutput useRTS,
                                       int baudRate, int dataBits, StopBits stopBits, ASCII xoffChar, ASCII xonChar)
            {
                NativeMethods.DCB portDCB = new NativeMethods.DCB();

                portDCB.init(hPort, ((parity == Ports.Parity.Odd) || (parity == Ports.Parity.Even)),
                             txFlowCTS, txFlowDSR,
                             (int)useDTR, rxGateDSR, !txWhenRxXoff, txFlowX, rxFlowX, (int)useRTS);
                portDCB.BaudRate = baudRate;
                portDCB.ByteSize = (byte)dataBits;
                portDCB.Parity   = (byte)parity;
                portDCB.StopBits = (byte)stopBits;
                portDCB.XoffChar = (byte)xoffChar;
                portDCB.XonChar  = (byte)xonChar;

                return(portDCB);
            }
Пример #2
0
 internal static DCB Create(IntPtr hPort)
 {
     NativeMethods.DCB portDCB = new NativeMethods.DCB();
     portDCB.getComm(hPort);
     return(portDCB);
 }