示例#1
0
 private void WriteDisplayOne(ISerialPortService pObjDisplay, string pStrPrint)
 {
     if (pObjDisplay.IsOpen())
     {
         pObjDisplay.Write(pStrPrint);
     }
     else
     {
         pObjDisplay.Open();
     }
 }
示例#2
0
 private void ConnectDisplay(ISerialPortService pObjSerialPort)
 {
     if (pObjSerialPort != null)
     {
         LogService.WriteInfo("Puerto serial valido.");
         lock (pObjSerialPort)
         {
             if (!pObjSerialPort.IsOpen())
             {
                 LogService.WriteInfo(string.Format("Conectando puerto serial {0}...", pObjSerialPort.GetName()));
                 pObjSerialPort.Open();
                 LogService.WriteInfo(string.Format("Puerto serial {0} conectado.", pObjSerialPort.GetName()));
             }
         }
     }
 }
        private void Connect(string portName)
        {
            if (string.IsNullOrEmpty(portName))
            {
                return;
            }

            try
            {
                if (m_serialPort.IsOpen)
                {
                    m_serialPort.Close();
                }
                m_serialPort.PortName = portName;
                m_serialPort.Open();
            }
            catch (IOException)
            {
            }
        }