Customizing the Printer Port Monitors
You can define new schemas for print devices that have capabilities above and beyond the standard bidi communications schema by customizing the standard TCP/IP or Web Services for Devices (WSD) port monitors that are supplied with Windows Vista. You must create a bidi extension file, an XML file that defines new schemas specific to that driver. This extension file is installed when the driver is installed. When the TCP/IP or WSD port monitor identifies this extension file, the monitor loads the file and can then use the additional bidi schemas.
The schemas in a bidi extension file are a subset of the standard print schema. Such schemas must adhere to the structure of the Tcpbidi.xsd or WsdBidi.xsd files supplied with the WDK.
You should create a bidi extension file and associate it with a printer driver if any of the following conditions apply:
The printer driver needs information from the printer that cannot be found in the standard print schema. To obtain this information, you must extend the supported schema with additional queries. Any other client that enumerates a supported schema for a specific port gets additional queries but usually cannot understand them.
You plan to include queries from the standard print schema that are not supported in the standard TCP/IP or WSD port monitors because the queries need driver-specific information. In this case, you must extend the print schema. Typically, you should extend the parts of the print schema related to input and output bins for print media. You should also provide a mapping between the names for bins defined in the bidi schema and those in the printer's management information base (MIB).
You intend to customize the way standard queries work, such as by setting a custom object identifier (OID) or changing the refresh interval. For example, the standard TCP/IP port monitor polls devices that do not support Web Services Eventing at a default interval of 600 seconds (10 minutes). You can change the polling interval by creating a bidi extension that sets the refreshInterval attribute in a Value construct associated with the device. (See the
Memoryproperty in the following code example.)
If the driver has no associated bidi extension file, the bidi communication support in the standard print schema cannot respond to queries that require driver-specific data (such as data related to input and output bins).
A bidi extension file is well-formed XML that must be valid according to the Tcpbidi.xsd or WsdBidi.xsd files supplied with the Microsoft Windows Driver Kit (WDK). Constructs defined in these .xsd files enable you to define new schemas.
The following is an incomplete example of a TCP/IP bidi extension file that shows its basic structure. The structure of a WSD bidi extension file is similar.
<?xml version="1.0" encoding="US-ASCII"?> <bidi:Schema xmlns:bidi="http://schemas.microsoft.com/windows/2005/03/printing/bidi"> <Schema> <Property name="Printer"> <Property name="Configuration"> <Property name= "Memory"> <Value name="Size" type="BIDI_INT" oid="184.108.40.206.220.127.116.11.2" refreshInterval="600" drvPrinterEvent="true" /> . . . </Property> </Property> </Property> </Schema> </bidi:Schema>
In the preceding code example, note that:
The Root element contains exactly one Schema element. The hierarchy of the schema begins with the Schema element.
The Schema element has Property elements as nodes and Value elements as leaves.
Each Value element defines a particular technique by which the data can be retrieved.
The correspondence between Simple Network Management Protocol (SNMP) types and bidi types is given in the BIDI_TYPE enumeration topic.
The remainder of this section contains the following topics to help you create your own bidi schema extensions.