protected void InitDisplay () { if (dictSerialPorts [DISPLAY].portName != "") { displayComm = new SerialPortLib (dictSerialPorts [DISPLAY].portName, dictSerialPorts [DISPLAY].baudRate); if (!displayComm.Open ()) { MessageBox.Show ("Failed to open Display port " + dictSerialPorts [DISPLAY].portName); return; } } if (displayComm != null && displayComm.IsOpen ()) { display = new MPFQA.Display(displayComm); display.Add(" RTA M-PFQA", true); display.Add("Initializing", true); /* // Clear the display displayComm.Write (new byte[]{0xFE, 0x58}); displayComm.Write ("RTA M-PFQA\nReady"); */ displayComm.GetReadHandler += new SerialPortLib.ReadHandler (DisplayKeypadHandler); } }
protected void ShutdownConnections () { foreach (SerialPortInfo spi in dictSerialPorts.Values) { if (spi.comm != null) { spi.comm.Close (); } } if (specComm != null) { specComm.Close (); } if (display != null) { display.Close (); display = null; } if (displayComm != null) { displayComm.Close (); } if (tecComm != null) { tecComm.Close (); } }