![]() |
CAPS Universe documentation
1.0.4
All you need to know to be successful
|
Retrieve job to print or report a printing is done. More...
Functions | |
| int | caps_pp_job_get (struct caps_pp_handle *instance, struct caps_pp_document_desc **job, volatile sig_atomic_t *terminate) |
| int | caps_pp_job_check (struct caps_pp_handle *instance, struct caps_pp_document_desc **job) |
| caps_identifier | caps_pp_job_id_get (struct caps_pp_document_desc *job) |
| void | caps_pp_job_done (struct caps_pp_document_desc *job) |
| int | caps_pp_job_fh_get (struct caps_pp_document_desc *job) |
| const char * | caps_pp_job_parameter_get (struct caps_pp_document_desc *job) |
| void | caps_pp_job_progression_report (struct caps_pp_document_desc *job, const struct caps_job_progression *prog) |
| int | caps_pp_job_state_update (struct caps_pp_document_desc *job, enum caps_printing_job_state state, enum caps_printing_job_reason reason, const char *message) |
And gain access to some internal job information.
Usage:
Or:
| int caps_pp_job_get | ( | struct caps_pp_handle * | instance, |
| struct caps_pp_document_desc ** | job, | ||
| volatile sig_atomic_t * | terminate | ||
| ) |
Wait for a printing job and get it if one is present
| [in] | instance | Provider instance |
| [out] | job | Where to store the pointer to the document description (transparent content) |
| [in] | terminate | Where to look for a termination request (can be NULL) |
| '0' | On success, *job is then valid |
| -ENODATA | No job available |
| -ENODEV | Used printer ID is invalid (should not happen, because the caller is the dev) |
| -EPERM | No permission to this printer and its jobs (should not happen, because the caller is the dev) |
| -EIO | Real communication error with the Printing Coordinator (should not happen) |
| -EINVAL | Bad/unexpected reply from the Printing Coordinator (should not happen) |
If *terminate changes to something different than '0' this functions returns with a -EIO
The communication with the printing coordinator:
The full call stack:
| int caps_pp_job_check | ( | struct caps_pp_handle * | instance, |
| struct caps_pp_document_desc ** | job | ||
| ) |
Same as caps_pp_job_get() but returns after a timeout of 500 ms if no job is available
| [in] | instance | Provider instance |
| [out] | job | Where to store the pointer to the new document description (transparent content) |
| '0' | if a new job is available, *job is then valid |
| -EAGAIN | No job available, try again later (e.g. timeout) |
| -ENODATA | No job available (should not happen) |
| -ENODEV | Used printer ID is invalid (should not happen, because the caller is the dev) |
| -EPERM | No permission to this printer and its jobs (should not happen, because the caller is the dev) |
| -EIO | Real communication error with the Printing Coordinator (should not happen) |
| -EINVAL | Bad/unexpected reply from the Printing Coordinator (should not happen) |
The communication with the printing coordinator:
| caps_identifier caps_pp_job_id_get | ( | struct caps_pp_document_desc * | job | ) |
Get the job's ID
| [in] | job | The job of interest (from a caps_pp_job_get() call) |
| void caps_pp_job_done | ( | struct caps_pp_document_desc * | job | ) |
Mark the job as done and free related resources
| [in] | job | The job which is done (from a caps_pp_job_get() call) |
This call will free all local resources and thus, is very important.
This call also does the required communication with the printing coordinator to spread the information around this job is finaly done.
job retrieved via caps_pp_job_check() or caps_pp_job_get()The communication with the printing coordinator:
The full call stack:
| int caps_pp_job_fh_get | ( | struct caps_pp_document_desc * | job | ) |
Get the raw filehandle of the document's file
| [in] | job | The job of interest (from a caps_pp_job_get() call) |
| positive | The raw file handle |
| negative | Errno, e.g. no filehandle available (should not happen) |
| const char * caps_pp_job_parameter_get | ( | struct caps_pp_document_desc * | job | ) |
Get the printing parameters (if any) for this job
| [in] | job | The job of interest (from a caps_pp_job_get() call) |
| Pointer | String of key values pairs |
| NULL | No parameters available |
The returned string can be something like:
"sides=two-sided-long-edge copies=2 ColorModel=Mono Duplex=DuplexNoTumble"
| void caps_pp_job_progression_report | ( | struct caps_pp_document_desc * | job, |
| const struct caps_job_progression * | prog | ||
| ) |
Report progression while processing the job
| [in] | job | The job which has made progression (from a caps_pp_job_get() call) |
| [in] | prog | The progression information |
According to caps_job_progression, all members except caps_job_progression::flags must not '0'.
This call also does the required communication with the printing coordinator to spread the information around.
prog is invalid The communication with the printing coordinator:
The full call stack:
| int caps_pp_job_state_update | ( | struct caps_pp_document_desc * | job, |
| enum caps_printing_job_state | state, | ||
| enum caps_printing_job_reason | reason, | ||
| const char * | message | ||
| ) |
Update a job's state
| [in] | job | The job which has made progression (from a caps_pp_job_get() call) |
| [in] | state | The job's new state |
| [in] | reason | The new reason for this state (must be valid!) |
| [in] | message | An optional message (can be NULL or an empty string, e.g. "") |
| -ENODEV | Printer is already gone (should not happen, maybe related to -EPERM) |
| -EPERM | Calling provider isn't the owner of this printer or print job |
| -EINVAL | job_id seems invalid or state is invalid |
message should be in plain english, but you should mark it as a translateable string if it is very special. This function tries to translate this message into the local language first by using the printing provider's NLS domain and then by it's own NLS domain (if it is a common sentence shared by all printing providers for example).This call also does the required communication with the printing coordinator to spread the information around.
reason must be one of the available caps_printing_job_reason enums The communication with the printing coordinator:
The full call stack: