Skip to content

DirectSendRead

Description

Sends transmission data corresponding to the command name specified in the command definition file that has been registered by SendDataFile.

Syntax

  
    INT DirectSendRead( INT i_hdl, LPCTSTR i_cname, LPCTSTR i_rtype, LPDWORD io_rlen, LPBYTE o_rbuf, DWORD i_timeout, BOOl i_flag )
  

Parameter

i_hdl

API handle
Specify the API handle retrieved by OpenMonPrinter.

i_cname

Command name
Specify the command name registered by SendDataFile.

i_rtype

Receive data type name
Specify the type of data to receive from the followings.
ASB: Stores only the response of the ASB setting command in the receive data.
Other: Stores responses other than the above from the printer in the receive data.

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 retrieved receive 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.br /> 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 followings.
TRUE: Continues receiving until any data is received or timeout occurs.
FALSE: Continues receiving until the receive data size is received or timeout occurs.

Return value

On success: Returns 0.
On failure: Returns an error code. See "Error Code List" for details of the error code.

Remarks

    • 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.