DirectIOEx¶
Description
Sends and receives binary data.
Syntax
INT DirectIOEx( INT i_hdl, DWORD i_wlen, LPBYTE i_wcmd, LPDWORD io_rlen, LPBYTE o_rbuf, DWORD i_timeout, BOOL i_flag, BYTE i_op )
Parameter
i_hdl
API handle
Specify the API handle retrieved by OpenMonPrinter.
i_wlen
Size of data to send
Specify the size of the data to send.
i_wcmd
Buffer of data to send
Specify the buffer in which the data to send is stored.
io_rlen
Size of data to receive
Specify the maximum length of data to be received from the printer.
The maximum receive data size is 4096 bytes.
When the value is specified more than 4096, the size is set to 4096 bytes.
Specify 0 when data retrieving is not necessary.
When the control returns from the API, the received data size is stored.
o_rbuf
Buffer of data to receive
Specify the buffer that stores the data to get.
i_timeout
Timeout period
Specify the time to wait for success of this API in milliseconds (ms).
The valid range is from 3000 to 90000.
When the value is specified less than 3000, the time is set to 3000 ms.
When the value is specified more than 90000, the time is set to 90000 ms.
i_flag
Receive operation flag
Specify the flag to specify the receive operation from the following:
TRUE: Continues receiving until any data is received or timeout occurs.
FALSE: Continues receiving until the receive data size is received or timeout occurs.
i_op
Receive target option
Specify the data to receive from the following:
0: Gets the data excluding the response of the ASB setting command.
1: Gets the data including the response of the ASB setting command.
Return value
On success: Returns 0. On failure: Returns an error code. See "Error Code List" for details of the error code.
Remarks
- In the case of sending commands, data, and image data that do not allow interrupt of other data, call this API after calling LockPrinter. When LockPrinter is not called, data from other processes may interrupt.
- This API can be aborted by Reset.
- When LockPrinter is being called by another process, calling this API fails.
- When the printer is not connected or in a communication disabled state, this API fails.