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

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

Data Structures

struct  ql8_printer_name_to_id
 

Functions

static void ql8_red_detection_lower_angle (struct ql8_drv *t1)
 
static void ql8_red_detection_higher_angle (struct ql8_drv *t1)
 
static void ql8_red_detection_lower_saturation (struct ql8_drv *t1)
 
static void ql8_red_detection_lower_value (struct ql8_drv *t1)
 
static void ql8_driver_red_detection_init (struct ql8_drv *t1)
 
static enum ql_printer ql8_driver_printer_id_get (struct ql8_drv *t1)
 
static void ql8_driver_selection_setup (struct ql8_drv *t1)
 
static int ql8_medium_type_adapt (struct ql8_drv *t1, const struct ql8_status *status)
 
static void ql8_medium_margins_adapt (struct ql8_drv *t1)
 
static int ql8_driver_cassette_update (struct ql8_drv *t1)
 
static int ql8_driver_runtime_adaptions (struct caps_drv *drvi, void *d)
 
static int ql8_driver_job_finish (struct caps_drv *drvi, void *d)
 
static int ql8_driver_page_print (struct caps_drv *drvi, void *d)
 
static int ql8_driver_page_setup (struct caps_drv *drvi, void *d)
 
static int ql8_driver_job_start (struct caps_drv *drvi, void *d)
 
static int ql8_driver_module_exit (struct caps_drv *drvi, void *d)
 
static int ql8_driver_device_monitor (struct caps_drv *drvi, void *d)
 
static int ql8_driver_module_init (struct caps_drv *drvi, void *d)
 

Variables

static const struct ql8_printer_name_to_id ql8_supported_printers []
 
static const struct caps_ppd_resolution ql8_driver_supported_resolutions []
 
static struct caps_ppd_custom_medium ql8_label_medium
 
static struct caps_ppd_base ql8_printer_desc
 
const struct caps_generic_driver caps_ql_driver
 
struct caps_arg_parser_list ql_parser_list
 

Function Documentation

◆ ql8_red_detection_lower_angle()

static void ql8_red_detection_lower_angle ( struct ql8_drv t1)
static

Read in the lower angle from the INI to detect a red dot

Parameters
[in]t1Full job description

An angle above this value will be dropped

Note
Refer bi_coloured_print for details
QL8xx specifc

◆ ql8_red_detection_higher_angle()

static void ql8_red_detection_higher_angle ( struct ql8_drv t1)
static

Read in the higher angle from the INI to detect a red dot

Parameters
[in]t1Full job description

An angle below this value will be dropped

Note
Refer bi_coloured_print for details
QL8xx specifc

◆ ql8_red_detection_lower_saturation()

static void ql8_red_detection_lower_saturation ( struct ql8_drv t1)
static

Read the lower saturation from the INI to detect a red dot

Parameters
[in]t1Full job description

If the angle defines a red, a saturation below this value will be dropped.

Note
Refer bi_coloured_print for details
QL8xx specifc

◆ ql8_red_detection_lower_value()

static void ql8_red_detection_lower_value ( struct ql8_drv t1)
static

Read the lower value from the INI to detect a red dot

Parameters
[in]t1Full job description

If the angle defines a red, a saturation below this value will be dropped.

Note
Refer bi_coloured_print for details
QL8xx specifc

◆ ql8_driver_red_detection_init()

static void ql8_driver_red_detection_init ( struct ql8_drv t1)
static

Read in the required values to detect red dots in an input RGB raster

Parameters
[in]t1Full job description
Note
Refer bi_coloured_print for details
QL8xx specifc

◆ ql8_driver_printer_id_get()

static enum ql_printer ql8_driver_printer_id_get ( struct ql8_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.

◆ ql8_driver_selection_setup()

static void ql8_driver_selection_setup ( struct ql8_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)

◆ ql8_medium_type_adapt()

static int ql8_medium_type_adapt ( struct ql8_drv t1,
const struct ql8_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

◆ ql8_medium_margins_adapt()

static void ql8_medium_margins_adapt ( struct ql8_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.

◆ ql8_driver_cassette_update()

static int ql8_driver_cassette_update ( struct ql8_drv t1)
static

Called, whenever an update of the label cassette is detected

Parameters
[in]t1Full driver description
Return values
PositivePrinter description has changed
0Everything seems fine
-EINVALUnkown/unsupported printer, driver cannot deal with it
Note
The special bi-colour cassette cannot be autodetected

◆ ql8_driver_runtime_adaptions()

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

Called from the libcapsdriver framework when the printer driver starts up

◆ ql8_driver_job_finish()

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

Called from the libcapsdriver framework if the job is finished

◆ ql8_driver_page_print()

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

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

◆ ql8_driver_page_setup()

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

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

◆ ql8_driver_job_start()

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

Called from the libcapsdriver framework if a new print job starts

◆ ql8_driver_module_exit()

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

◆ ql8_driver_device_monitor()

static int ql8_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 ql8_drv::probe_done. When the cover is closed again, we can re-configure the driver to the real used cassette.

◆ ql8_driver_module_init()

static int ql8_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

◆ ql8_supported_printers

const struct ql8_printer_name_to_id ql8_supported_printers[]
static
Initial value:
= {
{ .printer_name = "QL800", .id = CAPS_BRLABEL_QL800, },
{ .printer_name = "QL810", .id = CAPS_BRLABEL_QL810W, },
{ .printer_name = "QL820", .id = CAPS_BRLABEL_QL820NWB, },
{ .printer_name = NULL, },
}
@ CAPS_BRLABEL_QL820NWB
Definition: ql-printer-series.h:33
@ CAPS_BRLABEL_QL810W
Definition: ql-printer-series.h:32
@ CAPS_BRLABEL_QL800
Definition: ql-printer-series.h:31

The list of printers this driver supports for Brother QL8 label printers

Note
All of the printers here are untested (as of November 2022)

◆ ql8_driver_supported_resolutions

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

The QL8xx familiy of printers supports two resolutions in vertical direction

Attention
Keep in mind, the resolution is limited to 300x300 DPI when printing in bi-colour mode.

◆ ql8_label_medium

struct caps_ppd_custom_medium ql8_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.

◆ ql8_printer_desc

struct caps_ppd_base ql8_printer_desc
static
Initial value:
= {
.domain_name = PACKAGE,
.paper_type = LIBCAPS_PT_ENDLESS,
.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 = &ql8_label_medium,
.default_paper_name = "LABEL",
}
@ LIBCAPS_CT_GRAY
Definition: libcapsppd.h:203
@ LIBCAPS_GA_CUTTER
Definition: libcapsppd.h:218
@ 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 ql8_label_medium
Definition: ql8-series.c:268
static const struct caps_ppd_resolution ql8_driver_supported_resolutions[]
Definition: ql8-series.c:257

◆ caps_ql_driver

const struct caps_generic_driver caps_ql_driver
Initial value:
= {
.printer_adaptions = ql8_driver_runtime_adaptions,
.job_start = ql8_driver_job_start,
.job_finish = ql8_driver_job_finish,
.page_setup = ql8_driver_page_setup,
.page_print = ql8_driver_page_print,
.printer_monitor = ql8_driver_device_monitor,
}
static int ql8_driver_page_setup(struct caps_drv *drvi, void *d)
Definition: ql8-series.c:665
static int ql8_driver_job_finish(struct caps_drv *drvi, void *d)
Definition: ql8-series.c:597
static int ql8_driver_device_monitor(struct caps_drv *drvi, void *d)
Definition: ql8-series.c:888
static int ql8_driver_job_start(struct caps_drv *drvi, void *d)
Definition: ql8-series.c:754
static int ql8_driver_runtime_adaptions(struct caps_drv *drvi, void *d)
Definition: ql8-series.c:539
static int ql8_driver_page_print(struct caps_drv *drvi, void *d)
Definition: ql8-series.c:613
static int ql8_driver_module_exit(struct caps_drv *drvi, void *d)
Definition: ql8-series.c:871
static int ql8_driver_module_init(struct caps_drv *drvi, void *d)
Definition: ql8-series.c:930

◆ ql_parser_list

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