LIBRARY
Printer Application Framework (libpappl, "pkg-config --cflags --libs pappl")

SYNOPSIS
#include <pappl/pappl.h>

typedef struct _pappl_device_s pappl_device_t;

void
papplDeviceAddScheme(const char *scheme, pappl_dtype_t dtype, pappl_devlist_cb_t list_cb, pappl_devopen_cb_t open_cb, pappl_devclose_cb_t close_cb, pappl_devread_cb_t read_cb, pappl_devwrite_cb_t write_cb, pappl_devstatus_cb_t status_cb);

void
papplDeviceClose(pappl_device_t *device);

void
papplDeviceError(pappl_device_t *device, const char *message, ...);

void
papplDeviceFlush(pappl_device_t *device);

void *
papplDeviceGetData(pappl_device_t *device);

pappl_dmetrics_t *
papplDeviceGetMetrics(pappl_device_t *device, pappl_dmetrics_t *metrics);

pappl_preason_t
papplDeviceGetStatus(pappl_device_t *device);

bool
papplDeviceList(pappl_dtype_t types, pappl_device_cb_t cb, void *data, pappl_deverror_cb_t err_cb, void *err_data);

pappl_device_t *
papplDeviceOpen(const char *device_uri, const char *name, pappl_deverror_cb_t err_cb, void *err_data);

int
papplDeviceParse1284ID(const char *device_id, cups_option_t **pairs);

ssize_t
papplDevicePrintf(pappl_device_t *device, const char *format, ...);

ssize_t
papplDevicePuts(pappl_device_t *device, const char *s);

ssize_t
papplDeviceRead(pappl_device_t *device, void *buffer, size_t bytes);

void
papplDeviceSetData(pappl_device_t *device, void *data);

ssize_t
papplDeviceWrite(pappl_device_t *device, const void *buffer, size_t bytes);

DESCRIPTION
The PAPPL device functions provide access to output device connections and to list available output devices. Output devices are accessed using Uniform Resource Identifier (URI) strings such as "file:///path/to/file-or-directory", "socket://11.22.33.44", and "usb://make/model?serial=number".

The papplDeviceList function lists available output devices, providing each available output device to the supplied callback function. The list only contains devices whose URI scheme supports discovery, at present USB printers and network printers that advertise themselves using DNS-SD/mDNS and/or SNMPv1.

The papplDeviceOpen function opens a connection to an output device using its URI. The papplDeviceClose function closes the connection.

The papplDevicePrintf, papplDevicePuts, and papplDeviceWrite functions send data to the device, while the papplDeviceRead function reads data from the device.

The papplDeviceGetMetrics function gets statistical information about all communications with the device while it has been open, while the papplDeviceGetStatus function gets the hardware status of a device and maps it to the pappl_preason_t bitfield.