private void WriteDisplayOne(ISerialPortService pObjDisplay, string pStrPrint) { if (pObjDisplay.IsOpen()) { pObjDisplay.Write(pStrPrint); } else { pObjDisplay.Open(); } }
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())); } } } }
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())); } } } }