/** Shut down communication with the autosampler. */ public void disconnect() { if (m_reader != null) { m_reader.quit(); m_reader.interrupt(); } if (m_sender != null) { m_sender.quit(); m_sender.interrupt(); } if (m_statusPoller != null) { m_statusPoller.quit(); m_statusPoller.interrupt(); } if (m_CryoSocket != null) { m_CryoSocket.disconnect(); m_CryoSocket = null; } }
/** * Send the byte array to the autosampler. * * @param par as byte array. * @return true if successful. */ public boolean send(byte[] par) { if (this.isConnected()) { m_CryoSocket.write(par); // Messages.postDebug("cryocmd", // "Sent to CryoBay: " + arrayToHexString(par)); return true; } else { return false; } }
/** * send String directly to the cryobay * * @param cmd as a string * @return boolean if sent correctly */ public boolean send(String cmd) { if (this.isConnected()) { if (debug) System.out.println("CryoSocketControl.send: " + cmd); // Messages.postDebug("cryocmd", // "CryoSocketControl.send(\"" + cmd + "\")"); m_CryoSocket.write(cmd.getBytes()); return true; } else { return false; } }
public boolean isConnected() { return m_CryoSocket != null && m_CryoSocket.isConnected(); }