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