예제 #1
0
        public void Dispose()
        {
            var s = serial;

            serial = null;
            datec  = null;
            if (s.IsOpen)
            {
                s.Close();
            }
            s.Dispose();
        }
예제 #2
0
 public string[] InitDp25(string portName)
 {
     try
     {
         serial = new SerialPort(portName, 115200, Parity.None, 8, StopBits.One)
         {
             ReadTimeout  = 1500,
             WriteTimeout = 1500
         };
         serial.Open();
         datec = new DatecProtocol(serial.Write, serial.Read);
         return(datec.Exec(74));
     }
     catch (Exception ex)
     {
         Dispose();
         return(new string[] { ex.Message, "" });
     }
 }