Printer::~Printer() { temp_timeout.disconnect(); Stop(); serial_try_connect(false); if (device==NULL) return; rr_dev_free (device); device = NULL; }
void Printer::SimplePrint() { if (printing) alert (_("Already printing.\nCannot start printing")); if (!rr_dev_is_connected (device)) serial_try_connect (true); Print(); }
void Model::SimplePrint() { if (m_printing) alert ("Already printing.\nCannot start printing"); if (rr_dev_fd (m_device) < 0) serial_try_connect (true); Print(); }
Printer::~Printer() { temp_timeout.disconnect(); Stop(); serial_try_connect(false); #if IOCHANNEL delete rr_serial; #else if (device==NULL) return; rr_dev_free (device); device = NULL; #endif }
bool Model::handle_dev_fd (Glib::IOCondition cond) { int result; if (cond & Glib::IO_IN) { result = rr_dev_handle_readable (m_device); if (result < 0) error ("Error reading from device!", strerror (errno)); } if (cond & Glib::IO_OUT) { result = rr_dev_handle_writable (m_device); if (result < 0) error ("Error writing to device!", strerror (errno)); } if (cond & (Glib::IO_ERR | Glib::IO_HUP)) serial_try_connect (false); return true; }
bool Printer::handle_dev_fd (Glib::IOCondition cond) { if (device==NULL) return false; int result; if (cond & Glib::IO_IN) { result = rr_dev_handle_readable (device); if (result < 0) error (_("Error reading from device!"), std::strerror (errno)); } // try to avoid reading and writing at exactly the same time else if (cond & Glib::IO_OUT) { result = rr_dev_handle_writable (device); if (result < 0) error (_("Error writing to device!"), std::strerror (errno)); } if (cond & (Glib::IO_ERR | Glib::IO_HUP)) serial_try_connect (false); return true; }