PDRREF:DBIDI Command Structures and Command Flow

All structures used by PrtQuery and PrtSet use offsets into the return buffer for variable-length data, instead of returning pointers. These offsets are used to make transmission of the bidirectional structures easier between processes and machines.

For example, in a structure that returns a description string, the field that references the storage location of this string is a ULONG. If zero, that string is not returned. If nonzero, the field is the offset, from the beginning of the output buffer, to the description string.

All structures with variable-length data should pack this data immediately following all the fixed-length structures. As a result, *pcbOutData contains the number of bytes to copy from the beginning of the pOutData buffer.


 * Note: All returned structure-offset fields are offsets from the beginning of the output buffer given, not offsets from the beginning of the structure.

The Query and Set command structures are listed in the following two tables. The tables show which part of the system is called for each command structure. The values indicate the following:
 * A PrCo in the "Sent To" column indicates that the protocol converter is called first.
 * A PDrv indicates that the port driver is called first.
 * If both are called, they are listed in the order called.

The numbers in the "Init Sequence #/Description" column indicate, across both the Query and the Set tables, the order in which these command structures are called.

Protocol Converters
A protocol converter is a DLL written to support printers that are capable of returning information to the host PC. A protocol converter is responsible for understanding the control language of the printer. Examples of control languages are as follows:
 * Network Printer Alliance Protocol (NPAP)
 * Printer Job Language (PJL)
 * Simple Network Management Protocol (SNMP)

The file type of a protocol converter is ".CNV". The protocol converter does not get involved in the physical transmission of commands or data to the printer. The converter will generate appropriate printer commands to send to the printer, and the converter is able to translate the data sent from the printer to the host PC.

Developers can write a protocol converter if they have a port driver that can communicate with a group of printers that does not yet have a protocol converter. See the "Bidirectional Communications" chapter in the Printer Device Driver Reference for OS/2 for more information.

The functions exported from a protocol converter are as follows:
 * SplProtSendCmd
 * SplProtXlateCmd


 * Note: SplProtWrite is an optional function that can be exported from a protocol converter.

A protocol converter is installed in a system by adding the following entry to the system .INI file:

AppName = PM_PROTOCOL_CONVERTER KeyName = ConverterName Example: "PJL", "NPAP" KeyValue = Path to converter Example: "C:\OS2\DLL\PROT.CNV"

Printer Control Panels
A printer control panel is a DLL written to display the current status of a printer. Optionally, this DLL also allows a user to change the front panel settings for a printer that can communicate bidirectionally with the OS/2 print subsystem.

This printer panel DLL is called when the user selects the "Printer Panel" menu item on a print object that is connected to a printer communicating bidirectionally with the OS/2 print subsystem.

The file type of a printer control panel is ".DLL". The printer control panels make use of the PrtQuery and PrtSet APIs to get current status of printers. See the "Bidirectional Communications" chapter in the Printer Device Driver Reference for OS/2 for more information.

The functions exported from a printer control panel are as follows:


 * SplQueryControlPanel
 * SplRegisterControlPanel

A protocol converter is installed in a system by calling SplRegisterControlPanel. This adds the following entry to the system .INI file:

AppName = PM_SPOOLER_CONTROL_PANEL KeyName = ControlPanelName Example: "NewPrinter" KeyValue = Path to DLL with ctrl panel Example: "C:\OS2\DLL\CPANEL.DLL"

The print object typically calls SplGetControlPanelList, which causes the spooler to call the API SplQueryControlPanel for each installed printer control panel, in order to determine if the printer panel DLL can display a control panel for the given printer.

The print object gives the list of printer panel names to the user and, after one is selected, the print object will call SplDisplayControlPanel.