Beispiel #1
0
		/// <summary>
		/// Default constructor. Create port and setup delegates.
		/// </summary>
		/// <param name="ev">Event handler delegates.</param>
		public SerialPort(WithEvents ev, int idx=1)
		{
            this.ev = ev;
            this.path = "";
            this.file = "Port";
            this.extn = ".cfg";
            this.index = idx;
            this.SetName();
            this.cnfg = new SerialCnfg(this.index, this.name);
            return;
		}
Beispiel #2
0
 /// <summary>
 /// Default constructor. Create port and setup delegates.
 /// </summary>
 /// <param name="ev">Event handler delegates.</param>
 public SerialPort(WithEvents ev, int idx = 1)
 {
     this.ev    = ev;
     this.path  = "";
     this.file  = "Port";
     this.extn  = ".cfg";
     this.index = idx;
     this.SetName();
     this.cnfg = new SerialCnfg(this.index, this.name);
     return;
 }
Beispiel #3
0
        public SerialPort(WithEvents ev, string port)
        {
            this.ev    = ev;
            this.path  = "";
            this.file  = "Port";
            this.extn  = ".cfg";
            this.index = Convert.ToInt32(port.Substring(3, port.Length - 4), 10);
            this.SetName();
            this.cnfg = new SerialCnfg(this.index, this.name);

            return;
        }
Beispiel #4
0
        public SerialPort(WithEvents ev, string port)
        {
            this.ev = ev;
            this.path = "";
            this.file = "Port";
            this.extn = ".cfg";
            this.index = Convert.ToInt32(port.Substring(3, port.Length - 4), 10);
            this.SetName();
            this.cnfg = new SerialCnfg(this.index, this.name);

            return;
        }
Beispiel #5
0
		/// <summary>
		/// Terminal constructor. Initialization.
		/// </summary>
		public Terminal()
        {
            InitializeComponent();
            
			TxBytes = 0;
			this.TxString = "";
			this.TxCount.Text = "0";
			this.TxRxData.Text = "";
			this.TxStr.Text = "";

			RxBytes = 0;
			this.RxString = "";
			this.RxCount.Text = "0";

			this.Status.Text = "";
			this.RecvRate.Text = this.RecvTimer.Interval.ToString();
            this.PortCBs = new CheckBox[] {
            this.PortCB1, this.PortCB2, this.PortCB3, this.PortCB4, this.PortCB5,
            this.PortCB6, this.PortCB7, this.PortCB8, this.PortCB9, this.PortCB10,
            this.PortCB11, this.PortCB12, this.PortCB13, this.PortCB14, this.PortCB15,
            this.PortCB16, this.PortCB17, this.PortCB18, this.PortCB19, this.PortCB20};
            for (int i = 0; i < PortCBs.Length; i++)
            {
                this.PortCBs[i].Click += new System.EventHandler(this.PortCB_Click);
            }

            // wade
            this.startcnfg = new StartCnfg("iMobileComPort.cfg"); // load iMobileComPort.cfg
            if (this.startcnfg.Startup == 1)
            {
                this.WindowState = FormWindowState.Minimized;
                this.Show();
            }
            else if (this.startcnfg.Startup == 2) this.Hide();
            else
                this.Show();

            // Instantiate base class event handlers.
            this.Func = new WithEvents();
            this.Func.Error = new StrnFunc(this.OnError);
            this.Func.RxChar = new ByteFunc(this.OnRecvI);
            this.Func.CtsSig = new BoolFunc(this.OnCts);
            this.Func.DsrSig = new BoolFunc(this.OnDsr);
            this.Func.RlsdSig = new BoolFunc(this.OnRlsd);
            this.Func.RingSig = new BoolFunc(this.OnRing);
            this.FillAvailable();
            if (this.ComPort.Items.Count > 0) this.RecvTimer.Enabled = true;
            return;
		}
Beispiel #6
0
 public ComPort(WithEvents ev, string PortName, Terminal term)
 {
     this.Port = new SerialPort(ev, PortName);
     this.term = term;
 }
Beispiel #7
0
 public ComPort(WithEvents ev, string PortName, Terminal term) 
 {
     this.Port = new SerialPort(ev, PortName);
     this.term = term;
 }