Ref: "Ap1400ProgGuide1_2.docx" Page 41 of 42
Document Revision: “1.2”
Document Date: “9 Apr. 2013”
SendStatusReq
Get the current device status byte
UCHAR WINAPI SendStatusReq(LPINT pHandle);
SendStatusReq provides a simple, easy to use method of receiving the printer
status byte. The function sends a control request (refer to SendCtrl for a fuller
description).
The function is a ‘real time’ request so constantly calling this function will have an
impact on the printers performance
phandle – Pointer to the handle of an open device. This handle must have been
issued by a previous call to OpenDevice.
An unsigned character representing either the printer status byte, or 0xFF if an error
occurs. If the value returned is 0xFF then the system error code will be set to
indicate the error. This can be retrieved via a call to GetLastError.
If the value returned is not 0xFF then the byte represents the printer statuis byte
and is formatted as follows.
Bit 0 Head Up sensor (if fitted) 0=Head down 1=Head up
Bit 1 Mech running 0=Stopped 1=Running
Bit 2 Data buffer empty 0=No 1=Empty
Bit 3 Paper out 0=No 1=Paper out
Bit 4 Reserved Always 0
Bit 5 Spool Mode 0=Normal 1=Spool
Bit 6 Error bit 0=No error 1=Error
Bit 7 Reserved Always 1
//Get the status byte
UCHAR cStatus=SendStatusReq(&m_iPrinterHandle);
if(cStatus&0x08)
{
TRACE(_T(“Paper is out….\n”));
//Do paper out processing…
}