CAPS Universe documentation  1.0.4
All you need to know to be successful
Data Structures | Functions | Variables
ql5-series.c File Reference

QL5 label printer family specific driver adaptions. More...

Data Structures

struct  ql5_printer_name_to_id
 

Functions

static enum ql_printer ql5_driver_printer_id_get (struct ql5_drv *t1)
 
static void ql5_driver_selection_setup (struct ql5_drv *t1)
 
static int ql5_medium_type_adapt (struct ql5_drv *t1, const struct ql5_status *status)
 
static void ql5_medium_margins_adapt (struct ql5_drv *t1)
 
static __wur int ql5_driver_cassette_update (struct ql5_drv *t1)
 
static int ql5_driver_runtime_adaptions (struct caps_drv *drvi, void *d)
 
static int ql5_driver_job_finish (struct caps_drv *drvi, void *d)
 
static int ql5_driver_page_print (struct caps_drv *drvi, void *d)
 
static int ql5_driver_page_setup (struct caps_drv *drvi, void *d)
 
static int ql5_driver_job_start (struct caps_drv *drvi, void *d)
 
static int ql5_driver_module_exit (struct caps_drv *drvi, void *d)
 
static int ql5_driver_device_monitor (struct caps_drv *drvi, void *d)
 
static int ql5_driver_module_init (struct caps_drv *drvi, void *d)
 

Variables

static const struct ql5_printer_name_to_id ql5_supported_printers []
 
static const struct caps_ppd_resolution ql5_driver_supported_resolutions []
 
static struct caps_ppd_custom_medium ql5_label_medium
 
static struct caps_ppd_base ql5_printer_desc
 
const struct caps_generic_driver caps_ql_driver
 
struct caps_arg_parser_list ql_parser_list
 

Detailed Description

The reference manual suggests, the QL5 driver should also work for:

This family of printers seem to send a status report in case of a failure, which cannot be disabled.

Todo:
In case the printer signals an error (via USB status), the driver should read from the printer device's filehandle.

Function Documentation

◆ ql5_driver_printer_id_get()

static enum ql_printer ql5_driver_printer_id_get ( struct ql5_drv t1)
static

Retrieve an internal printer device ID from the INI file settings in section 'info' and key 'device'

Parameters
[in]t1Full driver description
Return values
IDPrinter ID
CAPS_BRLABEL_UNKNOWNUnsupported printer detected, or section 'info' and key 'device' is missing.

If the section 'info' and/or key 'device' is missing, it sounds like a reasonable issue with the setup

Postcondition
If CAPS_BRLABEL_UNKNOWN is returned, the driver should terminate.

◆ ql5_driver_selection_setup()

static void ql5_driver_selection_setup ( struct ql5_drv t1)
static

Setup the local selections in the printer description

Parameters
[in]t1Full driver description

Separate function to change settings on demand at run-time (cassette change for example)

◆ ql5_medium_type_adapt()

static int ql5_medium_type_adapt ( struct ql5_drv t1,
const struct ql5_status status 
)
static

Adapt some settings related to the used medium format (size and orientation)

Parameters
[in,out]t1Full job description
[in]statusThe status report from the QL5 printer
Return values
PositivePrinter description has changed
0Everything seems fine

◆ ql5_medium_margins_adapt()

static void ql5_medium_margins_adapt ( struct ql5_drv t1)
static

Adapt the margins to the used medium format

Parameters
[in,out]t1Full job description
Precondition
Must be called after ql5_medium_type_adapt() has detected a change
Continuous Label Margins

Your printable area on this label is 61 mm wide and has a length of 100 mm. The size of this label after the printer has spit it out is 62 mm wide and has a length of 106 mm.

Pre-cut labels are a bit more complicated. The printers have some annoying behaviours, which we must consider to get an expected result.

First we must create a label of the exact size of the pre-cut labels of our DK roll. Since the printer adds some margins by itself, we now need to define exact margins. We need to know, the printer will always add 3 mm at the top and the bottom of each label. So it depends on the orientation of our label, where we need to honor these margins.

If we use a pre-cut label DK roll oriented in portrait, the 3 mm margins are at the short edges.

Pre-cut Label Margins

For DK rolls oriented in landscape, the 3mm margins are at their long edges.

Pre-cut Label Margins
Note
The settings don't consider any kind of rotation. E.g. the user must use adapted margins, depending on the orientation.

◆ ql5_driver_cassette_update()

static __wur int ql5_driver_cassette_update ( struct ql5_drv t1)
static

Read a status report from the printer and analyse the result

Parameters
[in,out]t1Full job description
Return values
PositivePrinter description has changed
0Everything seems fine
-EINVALUnkown/unsupported printer, driver cannot deal with it

◆ ql5_driver_runtime_adaptions()

static int ql5_driver_runtime_adaptions ( struct caps_drv drvi,
void *  d 
)
static

Called from the libcapsdriver framework when the printer driver starts up

◆ ql5_driver_job_finish()

static int ql5_driver_job_finish ( struct caps_drv drvi,
void *  d 
)
static

Called from the libcapsdriver framework if the job is finished

◆ ql5_driver_page_print()

static int ql5_driver_page_print ( struct caps_drv drvi,
void *  d 
)
static

Called from the libcapsdriver framework if the page raster is ready to print

◆ ql5_driver_page_setup()

static int ql5_driver_page_setup ( struct caps_drv drvi,
void *  d 
)
static

Called from the libcapsdriver framework if the next page should be rasterized

◆ ql5_driver_job_start()

static int ql5_driver_job_start ( struct caps_drv drvi,
void *  d 
)
static

Called from the libcapsdriver framework if a new print job starts

◆ ql5_driver_module_exit()

static int ql5_driver_module_exit ( struct caps_drv drvi,
void *  d 
)
static
Note
Called before termination to clean up memory use

◆ ql5_driver_device_monitor()

static int ql5_driver_device_monitor ( struct caps_drv drvi,
void *  d 
)
static

Called from libcapsdriver if there is a correct point of time to check the printer's status

The printer signals an "out of paper" if the cover is opened. In this case we should mark the driver as outdated, e.g. invalidate ql5_drv::probe_done. When the cover is closed again, we can re-configure the driver to the real used cassette.

◆ ql5_driver_module_init()

static int ql5_driver_module_init ( struct caps_drv drvi,
void *  d 
)
static
Parameters
[in]drviThe libcapsdriver handle
[in]dThe private parameter from the caps_drv_run() call

Used to allocate some driver specific memory.

Variable Documentation

◆ ql5_supported_printers

const struct ql5_printer_name_to_id ql5_supported_printers[]
static
Initial value:
= {
{ .printer_name = "QL500", .id = CAPS_BRLABEL_QL500, },
{ .printer_name = "QL550", .id = CAPS_BRLABEL_QL550, },
{ .printer_name = "QL570", .id = CAPS_BRLABEL_QL570, },
{ .printer_name = NULL, },
}
@ CAPS_BRLABEL_QL500
Definition: ql-printer-series.h:22
@ CAPS_BRLABEL_QL570
Definition: ql-printer-series.h:24
@ CAPS_BRLABEL_QL550
Definition: ql-printer-series.h:23

The list of printers this driver supports

◆ ql5_driver_supported_resolutions

const struct caps_ppd_resolution ql5_driver_supported_resolutions[]
static
Initial value:
= {
{ .horizontal = 300, .vertical = 300, },
{ .horizontal = 300, .vertical = 600, },
}

◆ ql5_label_medium

struct caps_ppd_custom_medium ql5_label_medium
static
Initial value:
= {
.name = "LABEL",
}

The custom medium description for the autodetected labels

Since the printer reports the values of its loaded cassette, we can adapt this structure at run-time.

◆ ql5_printer_desc

struct caps_ppd_base ql5_printer_desc
static
Initial value:
= {
.domain_name = PACKAGE,
.paper_type = LIBCAPS_PT_ENDLESS,
.default_leading_edges = 0,
.supported_color_formats = LIBCAPS_CT_GRAY,
.default_color_format = LIBCAPS_CT_GRAY,
.resolution_count = 0,
.default_resolution = 0,
.options_count = 0,
.options = NULL,
.selection_count = 0,
.selections = NULL,
.custom_media_count = 1,
.custom_media = &ql5_label_medium,
.default_paper_name = "LABEL",
}
@ LIBCAPS_CT_GRAY
Definition: libcapsppd.h:203
@ LIBCAPS_GA_CUSTOM_MEDIA
Definition: libcapsppd.h:217
@ LIBCAPS_GA_SINGLE_TRAY
Definition: libcapsppd.h:215
@ LIBCAPS_PT_ENDLESS
Definition: libcapsppd.h:38
static struct caps_ppd_custom_medium ql5_label_medium
Definition: ql5-series.c:185
static const struct caps_ppd_resolution ql5_driver_supported_resolutions[]
Definition: ql5-series.c:174

◆ caps_ql_driver

const struct caps_generic_driver caps_ql_driver
Initial value:
= {
.printer_adaptions = ql5_driver_runtime_adaptions,
.job_start = ql5_driver_job_start,
.job_finish = ql5_driver_job_finish,
.page_setup = ql5_driver_page_setup,
.page_print = ql5_driver_page_print,
.printer_monitor = ql5_driver_device_monitor,
}
static int ql5_driver_job_start(struct caps_drv *drvi, void *d)
Definition: ql5-series.c:672
static int ql5_driver_module_exit(struct caps_drv *drvi, void *d)
Definition: ql5-series.c:753
static int ql5_driver_device_monitor(struct caps_drv *drvi, void *d)
Definition: ql5-series.c:770
static int ql5_driver_page_setup(struct caps_drv *drvi, void *d)
Definition: ql5-series.c:589
static int ql5_driver_runtime_adaptions(struct caps_drv *drvi, void *d)
Definition: ql5-series.c:467
static int ql5_driver_module_init(struct caps_drv *drvi, void *d)
Definition: ql5-series.c:812
static int ql5_driver_job_finish(struct caps_drv *drvi, void *d)
Definition: ql5-series.c:521
static int ql5_driver_page_print(struct caps_drv *drvi, void *d)
Definition: ql5-series.c:537

◆ ql_parser_list

struct caps_arg_parser_list ql_parser_list
Initial value:
= {
.version = "caps-brother-ql5xx (CAPS universe) " PACKAGE_VERSION,
.bugreport = PACKAGE_BUGREPORT,
.progname = "caps-brother-ql5xx",
.feature = NLS_("CAPS universe printer driver for Brother QL5xx monochrome label printer series"),
.domain = PACKAGE,
}
#define NLS_(string)
National Language Support related.
Definition: libcapsbase-local.h:61