Exemplo n.º 1
0
        void Mnu_startClick(object sender, EventArgs e)
        {
            string readPort;
            // TODO: Auswahl TCP-Client oder USB

            form_cps selector = new form_cps();

            if (selector.ShowDialog() == DialogResult.OK)
            {
                readPort = selector.SelectedPort;
            }
            else
            {
                return;
            }

            string readBaudrate = TBL.Routines.InputBox("Specify Baudrate (bps): ", "Baudrate", devComSerialInterface.DefaultBaudrate.ToString());


            if (readBaudrate == string.Empty)
            {
                return;
            }

            int baudrate;

            if (!int.TryParse(readBaudrate, out baudrate))
            {
                stdOut.Error("Could not parse Baudrate. Only integer values allowed. Please try again");
                return;
            }



            devComSerialInterface client = new devComSerialInterface(readPort, 38400);

            busListener = new DevComMaster(client);

            if (busListener.ConnectWithoutReset())
            {
                this.Controls.Add(log.Visualisation);
                log.VisualizationFitWindowSize(this);
                log.Location              = frameLogTopLeft;
                busListener.ByteReceived += new ByteReceivedEventHandler(bufferAdded);
                mnu_start.Enabled         = false;
                mnu_stop.Enabled          = true;
            }
            else
            {
                stdOut.Error(EDOLLHandler.GetLastError(), busListener.InfoString);
            }
        }
Exemplo n.º 2
0
        void Mnu_startClick(object sender, EventArgs e)
        {
            string readPort;
            // TODO: Auswahl TCP-Client oder USB

            form_cps selector = new form_cps();

            if(selector.ShowDialog() == DialogResult.OK)
            {
             	readPort = selector.SelectedPort;
            }
            else
            {
                return;
            }

            string readBaudrate =  TBL.Routines.InputBox("Specify Baudrate (bps): ","Baudrate", devComSerialInterface.DefaultBaudrate.ToString());

            if(readBaudrate == string.Empty)
            {
                return;
            }

            int baudrate;

            if(!int.TryParse(readBaudrate,out baudrate))
            {
                stdOut.Error("Could not parse Baudrate. Only integer values allowed. Please try again");
                return;
            }

            devComSerialInterface client = new devComSerialInterface(readPort, 38400);
            busListener = new DevComMaster(client);

            if(busListener.ConnectWithoutReset())
            {
                this.Controls.Add(log.Visualisation);
                log.VisualizationFitWindowSize(this);
                log.Location = frameLogTopLeft;
                busListener.ByteReceived += new ByteReceivedEventHandler(bufferAdded);
                mnu_start.Enabled = false;
                mnu_stop.Enabled = true;
            }
            else
            {
                stdOut.Error(EDOLLHandler.GetLastError(), busListener.InfoString);
            }
        }