![]() |
CAPS Universe documentation
1.0.4
All you need to know to be successful
|
Printer Driver Callback declaration. More...
Data Fields | |
| int(* | init )(struct caps_drv *, void *) |
| int(* | printer_adaptions )(struct caps_drv *, void *) |
| int(* | job_start )(struct caps_drv *, void *) |
| int(* | job_finish )(struct caps_drv *, void *) |
| int(* | page_setup )(struct caps_drv *, void *) |
| int(* | page_print )(struct caps_drv *, void *) |
| int(* | printer_monitor )(struct caps_drv *, void *) |
| int(* | exit )(struct caps_drv *, void *) |
Here you define the callback functions of your driver specific implementation.
| int(* init) (struct caps_drv *, void *) |
Everything you need for your driver's internal preparation.
It is called very early while initializing the framework.
0 everything is okay, the framework can continue-EINVAL Something really bad happened in your initialisation and the framework should terminate| int(* printer_adaptions) (struct caps_drv *, void *) |
Adapt your defaults to the user's settings.
Its called after the command line parameter parsing is done and all kind of information is available.
0 everything is okay, the framework can continue-ENODEV It isn't the expected printing device or something else is bad with this device and the framework should terminateFunctions related to this state:
| int(* job_start) (struct caps_drv *, void *) |
This callback is called when the framework has received a printing job. It already has checked if it can deal with the document data format, e.g. a corresponding rasterizer is already attached and now it is up to you to check if this job can be printed on your printer.
0 everything is okay, the framework can continue-EINVAL if the job cannot be printed.-EBUSY The printer is somehow busy (more or less a printer error condition, cover opened for example)-EBADMSG ?-ENODEV It isn't the expected printing device or something else is bad with this device and the framework should terminateFunctions related to this state:
Retrieving information about the job to print
Job status updating in case of a failure.
We need to distinguish a bad job from a bad behaviour of the software, e.g just skip the job versus terminating the driver
| int(* job_finish) (struct caps_drv *, void *) |
This callback is called once per job (even if printing has failed somehow).
Called when the job is "done" somehow, e.g.:
Printing can fail due to your own return values in Callback job_start(), or Callback page_setup(), Callback page_print() or Callback printer_monitor() or by failures detected somewhere else in the framework.
0 everything is okay, the framework can continue-ENODEV if something is really bad with your printer and the framework should terminate. | int(* page_setup) (struct caps_drv *, void *) |
Called when the framework has extracted all required information about the next page to print. It is called once per page.
0 everything is okay, the framework can continue-EINVAL if the page cannot be printed. TODO error message why!Functions related to this state:
| int(* page_print) (struct caps_drv *, void *) |
Called when the framework has rasterized the current page and this data is ready to be printed. It is called once per page. E.g. once per medium in simplex print and twice per medium when printing in duplex.
0 everything is okay, the framework can continue-EINVAL if the page cannot be processed/printed and the job should be terminated.-ENODEV if something is really bad with your printer and the framework should terminate.-ENXIO if a transaction with the printer's stream failed and the framework should terminate.-EINVAL and -ENXIO, you should use caps_drv_job_canceled() or caps_drv_job_aborted() to set a useful error message why the job was terminated (if you have one. Else the framework will set a generic one, which is most of the time less helpful).Functions related to this state:
| int(* printer_monitor) (struct caps_drv *, void *) |
Called, when the framework retrieves the status of the printer. But not always. See below.
0 everything is okay, the framework can continue-EBUSY if the printer isn't ready to print somehow-ENODEV if something is really bad with your printer and the framework should terminate.-EINVAL if something is wrong with your printer, but can be recovered. If currently a job is processed it will be canceledlibcapsdriver checks the printer status:
Whenever it checks the printer's status, it calls the callback only if it detects a ready printer device.
| int(* exit) (struct caps_drv *, void *) |
Everything you need to clean up.
0 everything is okay, the framework can continue