com.sewoo.jpos.command
Class ESCPOS

java.lang.Object
  extended by com.sewoo.jpos.command.ESCPOS

public class ESCPOS
extends java.lang.Object

ESC/POS Command for Mobile Printer.

Since:
1.00

Field Summary
static byte CAN
          CAN Cancel print data in page mode
static byte CR
          CR Print and carriage return
static byte DLE
          DLE Character
static byte ENQ
          ENQ Character
static byte EOT
          EOT Character
static byte ESC
          ESC Character
static byte FF
          FF Print end position label to start printing
static byte FS
          FS Character
static byte GS
          GS Character
static byte HT
          HT Horizontal tab
static byte LF
          LF Print and line feed
static int LK_STS_BATTERY_LOW
           
static int LK_STS_COVER_OPEN
           
static int LK_STS_MSR_READ
           
static int LK_STS_NORMAL
           
static int LK_STS_PAPER_EMPTY
           
static int LK_STS_PRINTEROFF
           
static byte SP
          SP Character
static int TRACK_1
           
static int TRACK_1_2
           
static int TRACK_2
           
static int TRACK_2_3
           
static int TRACK_3
           
 
Constructor Summary
ESCPOS()
           
 
Method Summary
 byte[] DLE_ENQ(int n)
          DLE ENQ .
 byte[] DLE_EOT(int n)
          DLE EOT .
 byte[] ESC_2()
          ESC 2 .
 byte[] ESC_3(int n)
          ESC 3 .
 byte[] ESC_a(int n)
          ESC a .
 byte[] ESC_AMPERSAND(int y, int c1, int c2, byte[][] buf)
          ESC & .
 byte[] ESC_ASTERISK(int m, int nL, int nH, byte[] buf)
          ESC * .
 byte[] ESC_AT()
          ESC @ .
 byte[] ESC_BACKSLASH(int nL, int nH)
          ESC \ .
 byte[] ESC_D(byte[] buf)
          ESC D .
 byte[] ESC_d(int n)
          ESC d .
 byte[] ESC_DOLLAR(int nL, int nH)
          ESC $ .
 byte[] ESC_E(int n)
          ESC E .
 byte[] ESC_EXCLAMATION(int n)
          ESC !
 byte[] ESC_FF()
          ESC FF .
 byte[] ESC_G(int n)
          ESC G .
 byte[] ESC_HYPHEN(int n)
          ESC - .
 byte[] ESC_J(int n)
          ESC J .
 byte[] ESC_L()
          ESC L .
 byte[] ESC_LEFTBRACE(int n)
          ESC { .
 byte[] ESC_M(int n)
          ESC M .
 byte[] ESC_p(int m, int t1, int t2)
          TODO ESC p .
 byte[] ESC_PERCENT(int n)
          ESC % .
 byte[] ESC_QUESTION(int n)
          ESC ?
 byte[] ESC_R(int n)
          ESC R .
 byte[] ESC_S()
          ESC S .
 byte[] ESC_SP(int n)
          ESC SP .
 byte[] ESC_t(int n)
          ESC t .
 byte[] ESC_T(int n)
          ESC T .
 byte[] ESC_V(int n)
          ESC V .
 byte[] ESC_W(int xL, int xH, int yL, int yH, int dxL, int dxH, int dyL, int dyH)
          ESC W .
 byte[] FS_M(int n)
          FS M n.
 byte[] FS_p(int n, int m)
          FS p .
 byte[] FS_q(int n, byte[][] buf)
          FS q .
 byte[] GS_a(int n)
          GS a .
 byte[] GS_ASTERISK(int x, int y, byte[] buf)
          GS * .
 byte[] GS_B(int n)
          GS B .
 byte[] GS_BACKSLASH(int nL, int nH)
          GS \ .
 byte[] GS_DOLLAR(int nL, int nH)
          GS $ .
 byte[] GS_EXCLAMATION(int n)
          GS !
 byte[] GS_f(int n)
          GS f .
 byte[] GS_h(int n)
          GS h .
 byte[] GS_H(int n)
          GS H .
 byte[] GS_I(int n)
          GS I .
 byte[] GS_k(int m, int n, byte[] data)
          GS k .
 byte[] GS_k(int m, int n, java.lang.String data)
           
 byte[] GS_L(int nL, int nH)
          GS L .
 byte[] GS_r(int n)
          GS r .
 byte[] GS_S_C(int n)
          GS S C .
 byte[] GS_SLASH(int m)
          GS / .
 byte[] GS_v(int m, int xL, int xH, int yL, int yH, byte[] buf)
          GS v 0 .
 byte[] GS_w(int n)
          GS w .
 byte[] GS_W(int nL, int nH)
          GS W .
 byte[] msrdataRequest()
          Select Printer interface in MSR Mode.
 byte[] twoDToOneD(byte[][] two)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ESC

public static final byte ESC
ESC Character

See Also:
Constant Field Values

FS

public static final byte FS
FS Character

See Also:
Constant Field Values

GS

public static final byte GS
GS Character

See Also:
Constant Field Values

DLE

public static final byte DLE
DLE Character

See Also:
Constant Field Values

EOT

public static final byte EOT
EOT Character

See Also:
Constant Field Values

ENQ

public static final byte ENQ
ENQ Character

See Also:
Constant Field Values

SP

public static final byte SP
SP Character

See Also:
Constant Field Values

HT

public static final byte HT
HT Horizontal tab

See Also:
Constant Field Values

LF

public static final byte LF
LF Print and line feed

See Also:
Constant Field Values

CR

public static final byte CR
CR Print and carriage return

See Also:
Constant Field Values

FF

public static final byte FF
FF Print end position label to start printing

See Also:
Constant Field Values

CAN

public static final byte CAN
CAN Cancel print data in page mode

See Also:
Constant Field Values

LK_STS_PRINTEROFF

public static final int LK_STS_PRINTEROFF
See Also:
Constant Field Values

LK_STS_MSR_READ

public static final int LK_STS_MSR_READ
See Also:
Constant Field Values

LK_STS_PAPER_EMPTY

public static final int LK_STS_PAPER_EMPTY
See Also:
Constant Field Values

LK_STS_COVER_OPEN

public static final int LK_STS_COVER_OPEN
See Also:
Constant Field Values

LK_STS_BATTERY_LOW

public static final int LK_STS_BATTERY_LOW
See Also:
Constant Field Values

LK_STS_NORMAL

public static final int LK_STS_NORMAL
See Also:
Constant Field Values

TRACK_1

public static final int TRACK_1
See Also:
Constant Field Values

TRACK_2

public static final int TRACK_2
See Also:
Constant Field Values

TRACK_1_2

public static final int TRACK_1_2
See Also:
Constant Field Values

TRACK_3

public static final int TRACK_3
See Also:
Constant Field Values

TRACK_2_3

public static final int TRACK_2_3
See Also:
Constant Field Values
Constructor Detail

ESCPOS

public ESCPOS()
Method Detail

DLE_EOT

public byte[] DLE_EOT(int n)
DLE EOT .

Real-time status transmission

Selects card read mode / Cancel card read mode

Parameters:
0x05 - - MSR Status request - ResponseData Bit 6(MSR Mode - 1(Select card reader mode), 0(normal mode))
0x07 - - Cancel card reader mode

DLE_ENQ

public byte[] DLE_ENQ(int n)
DLE ENQ .

Real-time request to printer


ESC_FF

public byte[] ESC_FF()
ESC FF .

Print data in page mode


ESC_SP

public byte[] ESC_SP(int n)
ESC SP .

Set character right-side spacing


ESC_EXCLAMATION

public byte[] ESC_EXCLAMATION(int n)
ESC ! .

Set print mode


ESC_DOLLAR

public byte[] ESC_DOLLAR(int nL,
                         int nH)
ESC $ .

Set absolute print position


ESC_PERCENT

public byte[] ESC_PERCENT(int n)
ESC % .

Select/cancel user-defined character set


ESC_AMPERSAND

public byte[] ESC_AMPERSAND(int y,
                            int c1,
                            int c2,
                            byte[][] buf)
ESC & .

Define user-defined characters


ESC_ASTERISK

public byte[] ESC_ASTERISK(int m,
                           int nL,
                           int nH,
                           byte[] buf)
ESC * .

Set bit image mode


ESC_HYPHEN

public byte[] ESC_HYPHEN(int n)
ESC - .

Turn underline mode on/off


ESC_2

public byte[] ESC_2()
ESC 2 .

Set 1/6 inch line spacing


ESC_3

public byte[] ESC_3(int n)
ESC 3 .

Set line spacing using minimum units


ESC_QUESTION

public byte[] ESC_QUESTION(int n)
ESC ? .

Cancel user-defined characters


ESC_AT

public byte[] ESC_AT()
ESC @ .

Initialize printer


ESC_D

public byte[] ESC_D(byte[] buf)
ESC D .

Set horizontal tab positions


ESC_E

public byte[] ESC_E(int n)
ESC E .

Select emphasized mode


ESC_G

public byte[] ESC_G(int n)
ESC G .

Select double-strike mode


ESC_J

public byte[] ESC_J(int n)
ESC J .

Print end feed paper using minimum units


ESC_L

public byte[] ESC_L()
ESC L .

Select page mode


ESC_M

public byte[] ESC_M(int n)
ESC M .

Select character font


ESC_R

public byte[] ESC_R(int n)
ESC R .

Select international character set


ESC_S

public byte[] ESC_S()
ESC S .

Select standard mode


ESC_T

public byte[] ESC_T(int n)
ESC T .

Select print direction in page mode


ESC_V

public byte[] ESC_V(int n)
ESC V .

Set/cancel 90 cw rotated character


ESC_W

public byte[] ESC_W(int xL,
                    int xH,
                    int yL,
                    int yH,
                    int dxL,
                    int dxH,
                    int dyL,
                    int dyH)
ESC W .

Set printing area in page mode


ESC_BACKSLASH

public byte[] ESC_BACKSLASH(int nL,
                            int nH)
ESC \ .

Set relative position


ESC_a

public byte[] ESC_a(int n)
ESC a .

Align position

Select justification

Left, Center, Right (0,48), (1,49), (2,50)


ESC_d

public byte[] ESC_d(int n)
ESC d .

Print and feed paper n lines


ESC_p

public byte[] ESC_p(int m,
                    int t1,
                    int t2)
TODO ESC p .

Generate Pulse. (Thermal Printer Only.)

m = PIN2(0,48), PIN5(1,49) ON Time = t1 * 2ms , OFF Time = t2 * 2ms


ESC_t

public byte[] ESC_t(int n)
ESC t .

Select character code table


ESC_LEFTBRACE

public byte[] ESC_LEFTBRACE(int n)
ESC { .

Set/cancel upside-down character printing


FS_p

public byte[] FS_p(int n,
                   int m)
FS p .

Print NV bit image


FS_q

public byte[] FS_q(int n,
                   byte[][] buf)
FS q .

Define NV bit image


GS_EXCLAMATION

public byte[] GS_EXCLAMATION(int n)
GS ! .

Select character size


GS_DOLLAR

public byte[] GS_DOLLAR(int nL,
                        int nH)
GS $ .

Set absolute vertical print position in page mode


GS_ASTERISK

public byte[] GS_ASTERISK(int x,
                          int y,
                          byte[] buf)
GS * .

Define downloaded bit image


GS_SLASH

public byte[] GS_SLASH(int m)
GS / .

Print down-loaded bit image


GS_B

public byte[] GS_B(int n)
GS B .

Turn white/black reverse printing mode on/off


GS_H

public byte[] GS_H(int n)
GS H .

Select printing position of HRI characters


GS_I

public byte[] GS_I(int n)
GS I .

Transmit printer ID


GS_L

public byte[] GS_L(int nL,
                   int nH)
GS L .

Set left margin


GS_W

public byte[] GS_W(int nL,
                   int nH)
GS W .

Set printing area width


GS_BACKSLASH

public byte[] GS_BACKSLASH(int nL,
                           int nH)
GS \ .

Set relative vertical print position in page mode


GS_a

public byte[] GS_a(int n)
GS a .

Enable/disable Automatic Status Back(ASB)


GS_f

public byte[] GS_f(int n)
GS f .

Select font for HRI characters


GS_h

public byte[] GS_h(int n)
GS h .

Set bar code height ( 1 <= n <= 255 )


GS_k

public byte[] GS_k(int m,
                   int n,
                   byte[] data)
GS k . Print bar code

GS k m n d1...dn


GS_k

public byte[] GS_k(int m,
                   int n,
                   java.lang.String data)

GS_r

public byte[] GS_r(int n)
GS r .

Transmit status


GS_v

public byte[] GS_v(int m,
                   int xL,
                   int xH,
                   int yL,
                   int yH,
                   byte[] buf)
GS v 0 .

Print raster bit image


GS_w

public byte[] GS_w(int n)
GS w .

Set bar code width ( 2 <= n <= 6 )


GS_S_C

public byte[] GS_S_C(int n)
GS S C .

Set Serial Baudrate

GS S C 01 n 0x01 0x21 0x08 0x01

Parameters:
0x30 - - 9600 bps
0x31 - - 19200 bps
0x32 - - 38400 bps
0x33 - - 57600 bps
0x34 - - 115200 bps

msrdataRequest

public byte[] msrdataRequest()
Select Printer interface in MSR Mode. (Send Data Request).

Returns:

FS_M

public byte[] FS_M(int n)
FS M n.

Parameters:
n - 1(0x31),(0x32),(0x33),(0x34),(0x36)
Returns:

twoDToOneD

public byte[] twoDToOneD(byte[][] two)