Example #1
0
        public bool UpdateSerialInfo(SerialInfo info)
        {
            string strSql = string.Format("update serialInfo set portName='{0}',baudRate={1},parity={2},databits={3},stopbits={4},timeOut={5}",
                                          info.PortName, info.BaudRate, info.Parity, info.DataBits, info.StopBits, info.TimeOut);

            return(SQLiteHelper.ExecuteNonQuery(STR_CONNECTION, strSql) > 0);
        }
Example #2
0
        public void InsertSerialInfo(SerialInfo info)
        {
            string strSql = string.Format("insert into serialInfo (portName,baudRate,parity,databits,stopbits,timeOut) values ('{0}',{1},{2},{3},{4},{5})",
                                          info.PortName, info.BaudRate, info.Parity, info.DataBits, info.StopBits, info.TimeOut);

            SQLiteHelper.ExecuteNonQuery(STR_CONNECTION, strSql);
        }
Example #3
0
        public SerialInfo DecodeSerialInfo(DataSet ds)
        {
            DataRow    dr   = ds.Tables[0].Rows[0];
            SerialInfo info = new SerialInfo()
            {
                PortName = dr["portName"].ToString(),
                BaudRate = Convert.ToInt32(dr["baudRate"]),
                DataBits = Convert.ToInt32(dr["databits"]),
                Parity   = Convert.ToInt32(dr["parity"]),
                StopBits = Convert.ToInt32(dr["stopbits"]),
                TimeOut  = Convert.ToInt32(dr["timeOut"])
            };

            return(info);
        }
Example #4
0
        public FormSetSerial(SerialCom com)
        {
            this.serial = com;

            InitializeComponent();
            this.serialInfo = dbhandler.GetSerialInfo();

            //用配置中的连接信息初始化界面展示
            this.cbPorts.Text             = this.serialInfo.PortName;
            this.tbDatabits.Text          = this.serialInfo.DataBits.ToString();
            this.cbParity.SelectedIndex   = this.serialInfo.Parity;;
            this.cbStopbits.SelectedIndex = this.serialInfo.StopBits;
            this.tbTimeout.Text           = this.serialInfo.TimeOut.ToString();
            for (int i = 0; i < this.cbBaudrate.Items.Count; i++)
            {
                if (this.serialInfo.BaudRate != Convert.ToInt32(this.cbBaudrate.Items[i]))
                {
                    continue;
                }
                this.cbBaudrate.SelectedIndex = i; break;
            }
            this.btnFresh_Click(null, null);
        }
Example #5
0
        private void InitialSeiralInfo()
        {
            this.serialInfo = new DBUtility(true).GetSerialInfo();
            this.btnFresh_Click(null, null);

            //用配置中的连接信息初始化界面展示
            this.cbPorts.Text             = this.serialInfo.PortName;
            this.tbDatabits.Text          = this.serialInfo.DataBits.ToString();
            this.cbParity.SelectedIndex   = this.serialInfo.Parity;;
            this.cbStopbits.SelectedIndex = this.serialInfo.StopBits;
            this.tbTimeout.Text           = this.serialInfo.TimeOut.ToString();
            for (int i = 0; i < this.cbBaudrate.Items.Count; i++)
            {
                if (this.serialInfo.BaudRate != Convert.ToInt32(this.cbBaudrate.Items[i]))
                {
                    continue;
                }
                this.cbBaudrate.SelectedIndex = i; break;
            }

            this.serial = new SerialCom();
            this.DisableSendComponent(true);
        }