EasyManua.ls Logo

ABLE Ap1400 - Page 40

ABLE Ap1400
42 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Ref: "Ap1400ProgGuide1_2.docx" Page 40 of 42
Document Revision: “1.2”
Document Date: “9 Apr. 2013”
SendCtrl (Continued)
Example
The following example shows a ctrl call to retrieve the print
buffer status
TCHAR cReturn;
int iRetLen=sizeof(TCHAR);
//Check the buffer state
DWORD dwStatusCode=SendCtrl(iHandle,
USB_TYPE_CLASS|USB_RECIP_DEVICE|USB_ENDPOINT_IN,
USB_BUFFERSTATE,
0,
0,
&iRetLen,
&cReturn);
if(dwStatusCode!=ERROR_SUCCESS)
{
TRACE(_T("Buffer state get Failed...\n"));
CString csError;
csError.Format(_T("GetBufferState failed - Reason=%d."),
dwStatusCode);
AfxMessageBox(csError,MB_ICONSTOP|MB_OK);
bError=TRUE;
continue;
}
//if the error code is OK the check the return
if(cReturn==BUFFER_BUSY)
{
TRACE(_T("Buffer state reports BUFFER_BUSY...\n"));
//Wait for a small period and retry
iMaxTime+=BUFFER_WAIT_PERIOD;
Sleep(BUFFER_WAIT_PERIOD);
continue;
}
else if(cReturn==BUFFER_CLEAR)
{
iMaxTime=0;
TRACE(_T("Buffer state reports BUFFER_CLEAR...\n"));
//Continue printing
//……
}

Related product manuals