コード例 #1
0
        public static void StartDataLink()
        {
            if (dlRcvTimer == null)
            {
                dlRcvTimer           = new System.Timers.Timer(50);
                dlRcvTimer.AutoReset = true;
                dlRcvTimer.Elapsed  += DlRcvTimer_Elapsed;
            }
            dlRcvTimer.Stop();

            dataLink = new SerialDataLink(DataLinkSetting.ComPort, DataLinkSetting.LinkRate, DataLinkSetting.Parity, DataLinkSetting.StopBits);

            try
            {
                dataLink.Start();
                IsRunning = true;
                DLStatus  = "DL STARTED";
            }
            catch (Exception)
            {
                dlRcvTimer.Stop();
                IsRunning = false;
                DLStatus  = "DL FAILED";
            }
        }
コード例 #2
0
 public static void StopDataLink()
 {
     if (dlRcvTimer != null)
     {
         dlRcvTimer.Stop();
     }
     if (dataLink != null)
     {
         dataLink.Stop();
         dataLink = null;
     }
     IsRunning = false;
     DLStatus  = "DL STOPPED";
 }