Exemple #1
0
        public SerialChannel()
        {
            SerialPortAPI sp = new SerialPortAPI();

            sp.StopBits = Convert.ToByte(Parameters.iniOper.ReadIniData("SPService", "StopBits", ""));
            sp.PortNum  = Convert.ToInt32(Parameters.iniOper.ReadIniData("SPService", "PortNum", ""));
            sp.ByteSize = Convert.ToByte(Parameters.iniOper.ReadIniData("SPService", "ByteSize", ""));
            sp.BaudRate = Convert.ToInt32(Parameters.iniOper.ReadIniData("SPService", "BaudRate", ""));
            sp.Parity   = Convert.ToByte(Parameters.iniOper.ReadIniData("SPService", "Parity", ""));
            SPapi       = sp;
        }
        public SerialChannel(byte stopBits, int portNum, byte byteSize, int baudRate, byte Parity, int readTimeOut, int writeTimeOut)
        {
            SerialPortAPI sp = new SerialPortAPI();

            sp.StopBits     = stopBits;
            sp.PortNum      = portNum;
            sp.ByteSize     = byteSize;
            sp.BaudRate     = baudRate;
            sp.Parity       = Parity;
            sp.ReadTimeout  = readTimeOut;
            sp.WriteTimeout = writeTimeOut;
            SPapi           = sp;
        }