]> git.sur5r.net Git - ptouch-print/blob - include/ptouch.h
Fix PT-2024PC support and some minor cleanup
[ptouch-print] / include / ptouch.h
1 /*
2         ptouch-print - Print labels with images or text on a Brother P-Touch
3         
4         Copyright (C) 2015-2017 Dominic Radermacher <blip@mockmoon-cybernetics.ch>
5
6         This program is free software; you can redistribute it and/or modify it
7         under the terms of the GNU General Public License version 3 as
8         published by the Free Software Foundation
9         
10         This program is distributed in the hope that it will be useful, but
11         WITHOUT ANY WARRANTY; without even the implied warranty of
12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13         See the GNU General Public License for more details.
14         
15         You should have received a copy of the GNU General Public License
16         along with this program; if not, write to the Free Software Foundation,
17         Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 #include <stdint.h>
21 #include <libusb-1.0/libusb.h>
22
23 struct _pt_tape_info {
24         uint8_t mm;             /* Tape width in mm */
25         uint8_t px;             /* Printing area in px */
26 };
27
28 #define FLAG_NONE               0
29 #define FLAG_UNSUP_RASTER       1
30 #define FLAG_FORCE_TIFF         2
31
32 struct _pt_dev_info {
33         int vid;                /* USB vendor ID */
34         int pid;                /* USB product ID */
35         char *name;
36         int max_px;             /* Maximum pixel width that can be printed */
37         int flags;
38 };
39 typedef struct _pt_dev_info *pt_dev_info;
40
41 struct _ptouch_dev {
42         libusb_device_handle *h;
43         uint8_t raw[32];
44         uint8_t tape_width_mm;
45         uint8_t tape_width_px;
46         uint8_t status;
47         uint8_t media_type;
48         pt_dev_info devinfo;
49 };
50 typedef struct _ptouch_dev *ptouch_dev;
51
52 int ptouch_open(ptouch_dev *ptdev);
53 int ptouch_close(ptouch_dev ptdev);
54 int ptouch_send(ptouch_dev ptdev, uint8_t *data, int len);
55 int ptouch_init(ptouch_dev ptdev);
56 int ptouch_lf(ptouch_dev ptdev);
57 int ptouch_ff(ptouch_dev ptdev);
58 int ptouch_cutmark(ptouch_dev ptdev);
59 int ptouch_eject(ptouch_dev ptdev);
60 int ptouch_getstatus(ptouch_dev ptdev);
61 int ptouch_getmaxwidth(ptouch_dev ptdev);
62 int ptouch_rasterstart(ptouch_dev ptdev);
63 int ptouch_sendraster(ptouch_dev ptdev, uint8_t *data, int len);