Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions PhpNetworkLprPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ class PhpNetworkLprPrinter{
* @since 1.0
*/
var $_username = "PhpNetworkLprPrinter";

/**
* Queue for printer
*
* @var string
* @access protected
* @since 1.0
*/
var $_queue;

/**
* Error number if connection fails
Expand Down Expand Up @@ -78,11 +87,13 @@ class PhpNetworkLprPrinter{
*
* @param string The printer's host
* @param integer The printer's port
* @param string The printer's queue
* @since 1.0
*/
public function __construct($host, $port=515) {
public function __construct($host, $port=515, $queue="defaultQueue") {
$this->_host = $host;
$this->_port = $port;
$this->_queue = $queue;
}

/**
Expand Down Expand Up @@ -141,7 +152,7 @@ public function setTimeOut($timeout){
* @since 1.0
*/
public function getErrNo(){
return $this->_errNo;
return $this->_error_number;
}

/**
Expand All @@ -152,7 +163,7 @@ public function getErrNo(){
* @since 1.0
*/
public function getErrStr(){
return $this->_errStr;
return $this->_error_msg;
}

/**
Expand Down Expand Up @@ -188,11 +199,11 @@ private function connect(){
private function makecfA($jobid){
$this->setMessage("Setting cfA control String");

$hostname = $_SERVER['REMOTE_ADDR'];
$hostname = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR']:getHostByName(getHostName());
$cfa = "";
$cfa .= "H" . $hostname . "\n"; //hostname
$cfa .= "P" . $this->_username . "\n"; //user
$cfA .= "fdfA" + $jobid + $hostname + "\n";
$cfa .= "fdfA" + $jobid + $hostname + "\n";
//TODO: Add more parameters. See http://www.faqs.org/rfcs/rfc1179.html

return $cfa;
Expand Down Expand Up @@ -246,7 +257,7 @@ public function printWaitingJobs($queue) {
public function printText($text=""){

//Initial data
$queue="defaultQueue"; //TODO: Change default queue
$queue=$this->_queue;
$jobid=001; //TODO: Autoincrement $jobid

//Print any waiting job
Expand Down