• 沒有找到結果。

T HEORY OF O PERATION

2. SERVICE MODELING DEFINITIONS

2.9. T HEORY OF O PERATION

811 812 813 814 815 816 817 818 819

The UPnP Printer device (‘printer’) has one REQUIRED service called PrintBasic Service. Optional services MAY include the PrintEnhancedLayout Service or basic power functions as illustrated below.

The model presented is very simple, it is intended to allow a user to send a job to a printer, be informed when it has started printing and when it has finished printing. In addition, a user can cancel a previously submitted job. Also a client (UCP) can determine which CreateJob action parameter values a Print Service implementation supports using the values returned in the <allowedValueList> element of the Service Description.

No optional SST variables or actions are specified. The standard UPnP print service MUST support all the variables and actions defined.

© 2002 Contributing Members of the UPnP™ Forum. All Rights Reserved.

820 821 822 823 824 825 826 827 828 829 830 831

832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850

851 852 853

Power Service

PrintEnhance

dLayout Service PrintBasic

Service

Printer Device

Figure 1 - Printer Device and Services

2.9.1. Jobs

The print service’s main task is to accept print jobs from clients, queue them up (if the printer is capable of handling more than one job at a time) and then print them. A job is identified by an integer, the JobId, which is allocated by the device. The [MODEL] describes the rules for JobId production (1 to 2**31-1). The JobId is returned by the CreateJob action.

The set of jobs that a printer has in its queue is exposed in a very simple way.

o The complete list of known jobs is made available as a state variable represented as CSV list (see section 2.5.1.1) called JobIdList.

o All waiting jobs appear in the JobIdList variable even those that the device has decided not to print for some reason (they are in the IPP ‘pending’ or ‘pending-held’ job state).

o The order of jobs in the JobIdList variable indicates the order in which the jobs will be initiated.

o The job that is actually printing at the moment (or for which the Print Service is stopped) is called the current job. If the current job is “Tracked” (see 2.2.2g), its job identifier is stored in the JobId Print Service state variableand that same JobId value is also the first JobId in the JobIdList. If there is no current job, i.e., there are no jobs, or all jobs are pending or held, or an Untracked Job (2.2.2h) is printing, the JobId is 0.

o Once a job has been printed (or cancelled or aborted) it no longer appears in the JobIdList, whether or not the Printer has any other jobs to print.

o When the Print Service has no tracked jobs to print, the JobIdList state variable is an empty string.

2.9.2. Actions

The following four actions are defined and MUST be supported by conforming PrintBasic Service implementations:

o CreateJob. This action is used to submit a job to the printer. The allocated JobId is returned.

© 2002 Contributing Members of the UPnP™ Forum. All Rights Reserved.

854 855 856

857 858 859 860 861 862 863 864 865 866 867 868

869 870 871 872

873 874 875 876 877

878 879 880

o CancelJob. This can be used to cancel a job using the JobId.

o GetPrinterAttributes. This action can be used to query some of the printer attributes.

o GetJobAttributes. This action can be used to query some of the job attributes of a specified job.

2.9.3. Events

One of the primary goals of this specification is to allow a user to know when their print job has started and when it has finished. The UPnP eventing mechanism can be used for this purpose. There are five evented state variables, JobIdList, JobEndState, PrinterState, PrinterStateReasons, and JobMediaSheetsCompleted that MAY change whenever a job stops or starts. A client implementation SHOULD therefore subscribe to UPnP events from the print service in order to monitor the progress of a job. A UCP can determine when a particular job that it submitted has started printing by matching the first entry of the evented JobIdList variable with the JobId value returned to it by the CreateJob action. Similarly a UCP can determine that a job has completed, whether successful of not, by matching the JobId for that job with the first element of the evented JobEndState variable.

Four of the five evented variables are also available as OUT parameters of either GetPrinterAttributes or

GetJobAttributes, so a UCP can obtain their values by polling. However, the JobEndState is not an OUT parameter of any action, so it is only available to a client by eventing, not by polling.

2.9.4. Security

In keeping with the lightweight approach to security taken by UPnP no security is defined by this specification.

If a vendor decides to include some form of security they are strongly encouraged to adopt the model that IPP uses – which is in fact fairly simple.

2.9.5. Localization

A UPnP printer is assumed to be operating within the locale of the user. No other localization mechanism is defined for the Print Service. The UCP (client) is expected to localize the well-known string values (that correspond to IPP keyword values) to the locale of its user. The UCP (client) is expected to convert the enum integer values to human readable string values in the locale of the user.

2.9.6. IPP Data Type mapping to UPnP Data Types

Basic IPP data types are transformed as follows.

Table 12: Basic IPP data type mappings IPP Type (see [MODEL] for

details)

UPnP Variable Type

Text string OctetString bin.base64 Boolean boolean Integer int integer (0..2**31 -1) i4 qualified by an

<allowedValueRange>

dateTime dateTime.tz 881

882

The derived types in IPP are mapped onto the following UPnP data types.

Table 13: Derived data type mappings

IPP Type UPnP Type Notes (see [MODEL] for details)

name string A Name is a string with limited length. It is intended to have machine-readable meaning (as opposed to a simple text string).

keyword string A keyword is a name that has a limited set of allowed values in US-English represented as lowercase letters ("a" - "z"), digits ("0" -

"9"), hyphen ("-"), dot ("."), and underscore ("_").

enum string An equivalent keyword string is used for each value using the symbol in IPP for each enum value, since the representation is XML.

uri uri A URI.

uriScheme string A string that specifies a URI scheme (http, ipp, etc.).

naturalLanguage - Not supported.

charset - Not supported.

mimeMediaType string A MIME type (‘text/plain’ for example).

883

884 Table 14: Structured Data Type mapping

IPP Type UPnP equivalent

resolution This is represented as a pair of integers <Attribute Name>X and <attribute Name>Y

1setOf X See the earlier discussion on arrays in section 2.5.1.1.

885

© 2002 Contributing Members of the UPnP™ Forum. All Rights Reserved.

© 2002 Contributing Members of the UPnP™ Forum. All Rights Reserved.

886 887

相關文件