-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathepl_job.h
151 lines (119 loc) · 4.14 KB
/
epl_job.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
* Copyright (c) 2003 Hin-Tak Leung
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
**/
#define EPL_VERSION "0.4.0cvs"
#include <stdio.h>
#include <sys/time.h>
#include "epl_config.h"
#include "epl_compress.h"
/* job_info is created as a simplier version of
ParamList which can be used by the header/etc routes
without passing along string parameters */
typedef struct _EPL_job_info EPL_job_info;
struct _EPL_job_info {
FILE *outfile;
int model;
int paper_size_mm_h;
int paper_size_mm_v;
int dpi_h;
int dpi_v;
int ritech;
int toner_save;
int density;
int pixel_h;
int pixel_v;
int connectivity;
int papertype;
int copies;
#if defined(HAVE_KERNEL_USB_DEVICE) || defined(HAVE_KERNEL_1284)
int kernel_fd;
#endif
#ifdef HAVE_LIBUSB
usb_dev_handle *usb_dev_hd;
int usb_out_ep;
int usb_in_ep;
#endif
#ifdef HAVE_LIBIEEE1284
struct parport *port;
struct parport_list *port_list;
#endif
#ifdef USE_FLOW_CONTROL
double time_last_write_stripe;
int printer_total_mem;
int free_mem_last_update;
int bytes_sent_after_last_update;
int stripes_sent_after_last_update;
int paused_mid_page; /* 0 = start of page, 1 = already paused once */
int bytes_sent_this_page;
int stripes_sent_this_page;
#define TOTAL_MEM_DEFAULT_VALUE (2*1048576)
#define FREE_MEM_LOW_LEVEL 0x20000
#endif
};
#define MODEL_UNKNOWN 0
#define MODEL_5700L 1
#define MODEL_5800L 2
#define MODEL_5900L 3
/* Just in case there is a 6000L. Probably not important. */
#define MODEL_6100L 5
#define MODEL_6200L 6
#define MODEL_USEDSLOTS 7 /* this is the number of the first not used slot */
#define PRE_INIT -1
#define VIA_STDOUT_PIPE 0
#define VIA_LIBUSB 1
#define VIA_KERNEL_USB 2
#define VIA_LIBIEEE1284 3
#define VIA_KERNEL_1284 4
#define VIA_NOWHERE 5
#define EPL_JOB_STARTED_YES 1
#define EPL_JOB_STARTED_NO 2
int epl_job_header(EPL_job_info *epl_job_info);
int epl_page_header(EPL_job_info *epl_job_info);
int epl_poll(EPL_job_info *epl_job_info, int type);
int epl_print_stripe(EPL_job_info *epl_job_info, typ_stream *stream, int stripe_number);
int epl_page_footer(EPL_job_info *epl_job_info);
int epl_job_footer(EPL_job_info *epl_job_info);
int epl_write_bid(EPL_job_info *epl_job_info, char *buffer, int length);
int epl_write_uni(EPL_job_info *epl_job_info, char *buffer, int length);
int epl_read_uni(EPL_job_info *epl_job_info, char *in_buf, int reply_size);
void epl_permission_to_write_stripe(EPL_job_info *epl_job_info);
int epl_status(int argc, char **argv);
int epl_usb_reply_len(int model, unsigned char code);
int epl_identify(char *string);
void epl_57interpret(EPL_job_info *epl_job_info, unsigned char *buffer, int len);
void epl_59interpret(EPL_job_info *epl_job_info, unsigned char *p, int len);
void epl_62interpret(EPL_job_info *epl_job_info, unsigned char *p, int len);
#ifdef EPL_DEBUG
static char *printername[]={
"<unknown>",
"EPL-5700L",
"EPL-5800L",
"EPL-5900L",
"<ghost>", /* placeholder for future 6000L */
"EPL-6100L",
"EPL-6200L"
};
#define VERBOSE
#endif
#define epl_sprintf_wrap(str,length) \
sprintf((str), "%c%deps{I",0x1d, (length))