コード例 #1
0
ファイル: YModem.cs プロジェクト: yancyn/BumbleeBee
 /// <summary>
 /// Constructor by provide COM port name.
 /// </summary>
 /// <param name="comport"></param>
 public YModem(String comport)
 {
     sp = new SerialPort(comport);
     newLine += new NewLine(errorCheck);
     try
     {
         sp.Open();
         sp.RtsEnable = true;
         sp.StopBits = System.IO.Ports.StopBits.One;
         sp.DataBits = 8;
         sp.BaudRate = 115200;
         sp.ReceivedBytesThreshold = 1;
         sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);
         systemstatus = SYSTEMSTATUS.STARTED;
         //testSystemStatus();
     }
     catch (Exception ex)
     {
         throw new Exception("Poort con niet geopend worden.", ex);
     }
 }
コード例 #2
0
 public LegacyCommunication(SerialPort port, bool OpenOrClose)
 {
     sp = port;
     if (OpenOrClose.Equals(true))
     {
         newLine += new NewLine(errorCheck);
         try
         {
             systemstatus     = SYSTEMSTATUS.STARTED;
             sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);
         }
         catch (Exception ex)
         {
             throw new Exception("Poort con niet geopend worden.", ex);
         }
     }
     else
     {
         //sp.DataReceived -= new SerialDataReceivedEventHandler(sp_DataReceived);
     }
 }
コード例 #3
0
        public LegacyCommunication(String comport)
        {
            sp       = new SerialPort(comport);
            newLine += new NewLine(errorCheck);
            try
            {
                sp.Open();
                sp.RtsEnable = true;
                sp.StopBits  = System.IO.Ports.StopBits.One;
                sp.DataBits  = 8;
                sp.BaudRate  = 115200;
                sp.ReceivedBytesThreshold = 1;
                sp.DataReceived          += new SerialDataReceivedEventHandler(sp_DataReceived);
                systemstatus = SYSTEMSTATUS.STARTED;

                testSystemStatus();
            }
            catch (Exception ex)
            {
                throw new Exception("Poort con niet geopend worden.", ex);
            }
        }