public function prime() { $cr = 0; $abb_cartridge = $this->input->get('v'); $type = $this->input->get('t'); $this->load->helper('printer'); if ($abb_cartridge && $type) { $first_run = TRUE; switch ($abb_cartridge) { case 'l': case 'r': switch ($type) { case 's': $first_run = FALSE; case 'f': $cr = ERROR_OK; break; default: $cr = ERROR_WRONG_PRM; break; } break; default: $cr = ERROR_WRONG_PRM; break; } if ($cr == ERROR_OK) { $cr = Printer_printFromPrime($abb_cartridge, $first_run); } } $this->_return_cr($cr); return; }
public function printprime() { //TODO it's better to stock callback model in json file $abb_cartridge = NULL; $first_run = FALSE; $cr = 0; // check model id, and then send it to print command $this->load->helper('printer'); $abb_cartridge = $this->input->get('v'); $first_run = $this->input->get('r'); $callback = $this->input->get('cb'); if ($abb_cartridge) { $first_run = $first_run === FALSE ? TRUE : FALSE; $this->set_led(); $cr = Printer_printFromPrime($abb_cartridge, $first_run); // $cr = Printer_startPrintingStatusFromModel($mid); if ($cr != ERROR_OK) { $this->output->set_header('Location: /printmodel/listmodel'); return; } } else { $this->output->set_header('Location: /printmodel/listmodel'); return; } if ($callback) { $this->output->set_header('Location: /printdetail/status?v=' . $abb_cartridge . '&cb=' . $callback); } else { $this->output->set_header('Location: /printdetail/status?v=' . $abb_cartridge); } return; }