CAPS Universe documentation
1.0.4
All you need to know to be successful
|
Library to gain access to the printing coordinator for clients. More...
Data Structures | |
struct | caps_cl_handle |
Macros | |
#define | valid_instance_assert(instance) { if (instance->conn == NULL) caps_developers_failure_report(__func__); } |
Functions | |
void | caps_libclient_version_get (unsigned *major, unsigned *minor, unsigned *micro) |
static void | print_argument_failure (struct caps_cl_handle *instance, DBusMessage *message, const DBusError *error) |
static void | print_rpc_failure (struct caps_cl_handle *instance, DBusMessage *message, const DBusError *error) |
int | caps_cl_printer_list_get (struct caps_cl_handle *instance, struct caps_cl_printer_list **list) |
int | caps_cl_printer_info_get (struct caps_cl_handle *instance, caps_identifier printer_id, struct caps_cl_printer_info **info) |
void | caps_cl_printer_info_destroy (struct caps_cl_handle *instance, struct caps_cl_printer_info *info) |
int | caps_cl_printer_state_get (struct caps_cl_handle *instance, caps_identifier printer_id, struct caps_cl_printer_state *state) |
int | caps_cl_printer_PPD_get (struct caps_cl_handle *instance, caps_identifier printer_id, int *ppdfh) |
int | caps_cl_printer_name_to_id (struct caps_cl_handle *instance, const char *name, caps_identifier *printer_id) |
int | caps_cl_job_commit (struct caps_cl_handle *instance, caps_identifier printer_id, int job_fd, const char *parameter, caps_identifier *job_id) |
int | caps_cl_job_state_get (struct caps_cl_handle *instance, caps_identifier job_id, struct caps_cl_job_state *state) |
static int | send_message_and_receive_int32 (struct caps_cl_handle *instance, DBusMessage *message) |
int | caps_cl_job_cancel (struct caps_cl_handle *instance, caps_identifier job_id) |
bool | caps_cl_job_check_if_done (struct caps_cl_handle *instance, const struct caps_cl_job_state *state) |
int | caps_cl_job_progression_get (struct caps_cl_handle *instance, caps_identifier job_id, struct caps_job_progression *prog) |
static int | client_introduction (struct caps_cl_handle *instance) |
static DBusHandlerResult | handle_provider_change_notifier (DBusMessage *message, void *data) |
static DBusHandlerResult | handle_job_change_notifier (DBusMessage *message, void *data) |
static DBusHandlerResult | client_signal_dispatch (DBusConnection *connection, DBusMessage *message, void *data) |
static int | dbus_signal_handling_register (struct caps_cl_handle *instance, const struct caps_cl_notifier *notifier, void *data) |
static DBusBusType | dbus_bus_type_detect (void) |
struct caps_cl_handle * | caps_cl_instance_create (void) |
int | caps_cl_error_messages_catch (struct caps_cl_handle *instance, char **ptr, size_t *size) |
void | caps_cl_error_messages_reset (struct caps_cl_handle *instance) |
static dbus_bool_t | caps_client_add_watch_function (DBusWatch *watch, void *data) |
static void | caps_client_remove_watch_function (DBusWatch *watch, void *data) |
static void | caps_client_watch_toggle_function (DBusWatch *watch, void *data) |
static int | setup_watches (struct caps_cl_handle *instance) |
int | caps_cl_instance_register (struct caps_cl_handle *instance, const struct caps_cl_notifier *notifier, void *data) |
void | caps_cl_instance_unregister (struct caps_cl_handle *instance) |
void | caps_cl_instance_destroy (struct caps_cl_handle *instance) |
int | caps_cl_notifiers_process (struct caps_cl_handle *instance) |
int | caps_cl_connection_fd_get (struct caps_cl_handle *instance) |
#define valid_instance_assert | ( | instance | ) | { if (instance->conn == NULL) caps_developers_failure_report(__func__); } |
Force a registered client instance
[in] | instance | Client instance |
Using an unregistered client instance violated the API for most of the functions here. Be rigorous and crash the caller in this case.
|
static |
Just print a unified error message when the RPC arguments are wrong
[in] | instance | The library instance handle |
[in] | message | Just to get the method to show where it happens |
[in] | error | The error message to print |
|
static |
Just print a unified error message when the RPC fails
[in] | instance | The library instance handle |
[in] | message | Just to get the method to show where it happens |
[in] | error | The error message to print |
|
static |
Send the given message and read back an int32_t reply
instance | The library instance handle |
message | The message to send |
positive | Returned RPC value on success (0 is positive) |
-EIO | Real communication error with the printing coordinator |
-EINVAL | Bad/unexpected reply from the Printing Coordinator (should not happen) |
|
static |
Introduce ourself at the printing coordinator
instance | The library instance handle |
positive | Returned RPC value on success (0 is positive) |
-EIO | Real communication error with the printing coordinator |
-EINVAL | Bad/unexpected reply from the Printing Coordinator (should not happen) |
-ENOSYS | Unsupported client version |
Currently an unsupported client version means, the expected and implemented DBUS interfaces do not match.
Counterpart is dbus_client_introduction_dispatch()
|
static |
Handle the "Printing Provider Change" DBUS signal, convert it to a library callback/notifier
[in] | message | The signal message itself, must be of method SEND_PROVIDER_CHANGE_NOTIFIER_METHOD |
[in] | data | Our local library handle |
This signal is sent by the printing coordinator if a printing provider becomes visible or is gone. It always carries the current run-time state information with it.
This handler must act in accordance to dbus_client_send_provider_change_notifier()
|
static |
Handle the "Job Change" DBUS signal, convert it to a library callback/notifier
[in] | message | The signal message itself, must be of SEND_JOB_CHANGE_NOTIFIER_METHOD |
[in] | data | Our local library handle |
This signal is sent by the printing coordinator if a job's state changes.
This handler must act in accordance to dbus_client_send_job_change_notifier()
|
static |
Dispatch a received DBUS signal as a notifier to a client routine
[in] | connection | DBUS connection |
[in] | message | Received signal as a regular message |
[in] | data | Out instance information as anonymous data |
DBUS_HANDLER_RESULT_HANDLED | Message has had its effect - no need to run more handlers |
DBUS_HANDLER_RESULT_NOT_YET_HANDLED | Message has not had any effect - see if other handlers want it |
message
? related to dbus_message_new_method_call()?
|
static |
If we are interested in receiving coordinator signals (about printer and/or job status changed)
[in] | instance | The library instance handle |
[in] | notifier | Notifier to call (if any) |
[in] | data | Anonymous data to be send to the notifier |
0 | On success |
-EIO | Failed to register the object path (dbus specific) |
-ENOMSG | No signals of the requested types available |
|
static |
Select the DBUS bus variant we should connect to
Default bus variant is 'DBUS_BUS_SYSTEM'. This can be changed in the DEBUG build to 'DBUS_BUS_SESSION' if the environment variable 'CAPS_DBUS_BUS' is present (its value doesn't matter). If the 'DBUS_BUS_SESSION' bus variant is in use, all CAPS components must use the same setting in the 'DBUS_SESSION_BUS_ADDRESS' environment variable, else no connection is possible.
|
static |
|
static |
|
static |
|
static |
Set a 'watch' to the DBUS connection in order to be able to wait for activity
[in] | instance | Client instance |
0 | 'Watch' added |
-EINVAL | Failed to add a watch to the connection |
If this function fails, there is no way to wait for activity on this connection.
How does it really work?
https://stackoverflow.com/questions/9378593/dbuswatch-and-dbustimeout-examples