Exemple #1
0
		/// <summary>
		/// Default constructor. Create port and setup delegates.
		/// </summary>
		/// <param name="ev">Event handler delegates.</param>
		public SerialPort(WithEvents ev, bool loadCfg=false)
		{
            this.ev = ev;
            this.path = "";
            this.file = "Port";
            this.extn = ".cfg";
            this.index = 1;
            if (loadCfg)
            {
                this.name = "iMobileBarcode" + this.extn;
                this.cnfg = new SerialCnfg(this.index, this.name);
            }
            else 
                this.SetName();
            return;
		}
Exemple #2
0
 /// <summary>
 /// Default constructor. Create port and setup delegates.
 /// </summary>
 /// <param name="ev">Event handler delegates.</param>
 public SerialPort(WithEvents ev, bool loadCfg = false)
 {
     this.ev    = ev;
     this.path  = "";
     this.file  = "Port";
     this.extn  = ".cfg";
     this.index = 1;
     if (loadCfg)
     {
         this.name = "iMobileBarcode" + this.extn;
         this.cnfg = new SerialCnfg(this.index, this.name);
     }
     else
     {
         this.SetName();
     }
     return;
 }
		/// <summary>
		/// Terminal constructor. Initialization.
		/// </summary>
		public Terminal()
		{
			InitializeComponent();
            
			TxBytes = 0;
			this.TxString = "";
			this.TxCount.Text = "0";
			this.TxData.Text = "";
			this.TxStr.Text = "";

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

			this.Status.Text = "";
			this.Settings.Text = "";
			this.HndShake.Text = "";
			this.RecvRate.Text = this.RecvTimer.Interval.ToString();
            
			// Fill com port list.
            this.FillAvailable();

			// 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);

			// Instantiate the terminal port.
            // wade
			this.Port = new SerialPort(this.Func, true); // load iMobileBarcode.cfg
            connectMOTO();
            if (this.Port.cnfg.startup == 1)
            {
                this.WindowState = FormWindowState.Minimized;
                this.Show();
            }
            else if (this.Port.cnfg.startup == 2) this.Hide();
            else
                this.Show();
            return;
		}