示例#1
0
 private void WriteDisplayOne(ISerialPortService pObjDisplay, string pStrPrint)
 {
     if (pObjDisplay.IsOpen())
     {
         pObjDisplay.Write(pStrPrint);
     }
     else
     {
         pObjDisplay.Open();
     }
 }
示例#2
0
 private void DisconnectDisplay(ISerialPortService pObjSerialPort)
 {
     if (pObjSerialPort != null)
     {
         lock (pObjSerialPort)
         {
             if (Connections.Count == 0 && pObjSerialPort.IsOpen())
             {
                 LogService.WriteInfo(string.Format("Desconectando puerto serial {0}...", pObjSerialPort.GetName()));
                 pObjSerialPort.Close();
                 LogService.WriteInfo(string.Format("Puerto serial {0} desconectado.", pObjSerialPort.GetName()));
             }
         }
     }
 }
示例#3
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()));
             }
         }
     }
 }