]> git.sur5r.net Git - ptouch-print/blob - include/ptouch.h
added support for pt2420
[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 struct _pt_dev_info {
31         int vid;                /* USB vendor ID */
32         int pid;                /* USB product ID */
33         char *name;
34         int max_px;             /* Maximum pixel width that can be printed */
35         int flags;
36 };
37 typedef struct _pt_dev_info *pt_dev_info;
38
39 struct _ptouch_dev {
40         libusb_device_handle *h;
41         uint8_t raw[32];
42         uint8_t tape_width_mm;
43         uint8_t tape_width_px;
44         uint8_t status;
45         uint8_t media_type;
46         pt_dev_info devinfo;
47 };
48 typedef struct _ptouch_dev *ptouch_dev;
49
50 int ptouch_open(ptouch_dev *ptdev);
51 int ptouch_close(ptouch_dev ptdev);
52 int ptouch_send(ptouch_dev ptdev, uint8_t *data, int len);
53 int ptouch_init(ptouch_dev ptdev);
54 int ptouch_lf(ptouch_dev ptdev);
55 int ptouch_ff(ptouch_dev ptdev);
56 int ptouch_cutmark(ptouch_dev ptdev);
57 int ptouch_eject(ptouch_dev ptdev);
58 int ptouch_getstatus(ptouch_dev ptdev);
59 int ptouch_getmaxwidth(ptouch_dev ptdev);
60 int ptouch_rasterstart(ptouch_dev ptdev);
61 int ptouch_sendraster(ptouch_dev ptdev, uint8_t *data, int len);