예제 #1
0
Printer::~Printer()
{
  temp_timeout.disconnect();
  Stop();
  serial_try_connect(false);
  if (device==NULL) return;
  rr_dev_free (device);
  device = NULL;
}
예제 #2
0
void Printer::SimplePrint()
{
  if (printing)
    alert (_("Already printing.\nCannot start printing"));

  if (!rr_dev_is_connected (device))
    serial_try_connect (true);
  Print();
}
예제 #3
0
void Model::SimplePrint()
{
  if (m_printing)
    alert ("Already printing.\nCannot start printing");

  if (rr_dev_fd (m_device) < 0)
      serial_try_connect (true);
  Print();
}
예제 #4
0
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
}
예제 #5
0
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;
}
예제 #6
0
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;
}