Jump to content

SplProtXlateCmd

From EDM2

SplProtXlateCmd is an API exported by protocol converters. It is called only by port drivers when processing the BIDI_WAIT_ALERT(8016h) command in the port driver SplPdQuery API. The purpose is to convert a protocol-specific message received from the printer into a generic command structure that can be used by the port driver and spooler.

Syntax

SplProtXlateCmd(pszPortName, pfnBaseProtXlateCmd,
      pInData, cbInData, pAlertInfo, pOutData,
      pcbOutData);

Parameters

pszPortName (PSZ) - input
Port name.
Following is an example of a port name: LPT1
This will be a locally defined port name.
pfnBaseProtXlateCmd (PFN) - input
Base protocol converter address for ProtXlateCmd routine.
This is NULL unless the protocol converter is an extension to the base protocol converter. If not NULL, the extension protocol converter can call the base converter at this address to let the base converter process the command.
pInData (PVOID) - input
Command sequence for printer.
On entry, this field contains the BIDI software protocol-specific command sequence received from the printer.
cbInData (ULONG) - input
Length of information in pInData, in bytes.
pAlertInfo (PVOID) - in/out
Alert information buffer.
This field receives a PDALERTINFO data structure. See Data Types for details on this data structure.
pOutData (PVOID) - output
Return buffer.
If PD_ALERT is set, this returns a PRTALERT structure. See BIDI_WAIT_ALERT(8016h) in BIDI Command Structures and Command Flow for more information and Data Types for details on this data structure.
If PD_ALERT is not set, nothing is returned in this buffer.
pcbOutData (PULONG) - output
Points to the length of the output buffer.
On entry, this is set to the length of the output buffer passed in. On exit, it is updated with the length of the PRTALERT structure data copied into pOutData.

Returns

rc (ULONG) - returns
Return codes.
  • 0 Success
  • 8(ERROR_NOT_ENOUGH_MEMORY) :Not enough memory to satisfy request.
  • 87(ERROR_INVALID_PARAMETER) :An invalid parameter was specified; most likely an invalid buffer pointer was given.
  • 211(ERROR_INFO_NOT_AVAIL) :The caller set PD_NEXTALERT. However, the protocol converter does not have any more alerts to return for the previous data passed to SplProtXlateCmd for the port.
  • 234(ERROR_MORE_DATA) :Part of the information requested was returned, but there was not enough room for all the data. *pcbOutData contains the size of buffer needed to retrieve all the query response data.
  • 2123(NERR_BufTooSmall) :No information was returned because the output buffer was too small. *pcbOutData contains the size of buffer needed to retrieve all the query response data.

Sample

#define INCL_SPL
#define INCL_SPLBIDI
#include <os2.h>

PSZ       pszPortName;          /*  Port name. */
PFN       pfnBaseProtXlateCmd;  /*  Base protocol converter address for ProtXlateCmd routine. */
PVOID     pInData;              /*  Command sequence for printer. */
ULONG     cbInData;             /*  Length of information in pInData, in bytes. */
PVOID     pAlertInfo;           /*  Alert information buffer. */
PVOID     pOutData;             /*  Return buffer. */
PULONG    pcbOutData;           /*  Points to the length of the output buffer. */
ULONG     rc;                   /*  Return codes. */

rc = SplProtXlateCmd(pszPortName, pfnBaseProtXlateCmd,
       pInData, cbInData, pAlertInfo, pOutData,
       pcbOutData);