示例#1
0
        bool ISerialDriver.Initialize(int serialPortNum, int BaudRate, int Parity, int DataBits, int StopBits, int FlowValue)
        {
            ComPort serial = null;

            try
            {
                serial = GetComPort(serialPortNum);
            }
            catch
            {
                return(false);
            }


            if (!(serial is ISerialPortToStream))
            {
                return(false);
            }

            return(((ISerialPortToStream)serial).Initialize(BaudRate, Parity, DataBits, StopBits, FlowValue) && serial.DeviceInitialize());
        }