java.lang.Objectcom.epson.EpsonCom.EpsonComDevice
public class EpsonComDevice
EpsonComDevice Class
Constructor Summary | |
---|---|
EpsonComDevice()
Constructor |
Method Summary | |
---|---|
EpsonCom.ERROR_CODE |
activateASB(java.lang.Boolean drawer,
java.lang.Boolean onoffline,
java.lang.Boolean error,
java.lang.Boolean paper,
java.lang.Boolean slip,
java.lang.Boolean panelbutton)
activateASB activates the automatic status transmission. |
EpsonCom.ERROR_CODE |
cancelWaitForSlip()
cancelWaitForSlip Closes and releases the port object |
EpsonCom.ERROR_CODE |
checkAndSetImageParameters(int checkOrCard)
checkAndSetImageParameters checks the image parameters and if ok, sets them |
EpsonCom.ERROR_CODE |
closeDevice()
closeDevice closes and releases the port object |
EpsonCom.ERROR_CODE |
cutPaper()
cutPaper cuts the paper at the current position |
EpsonCom.ERROR_CODE |
deleteCropArea(int num)
deleteCropArea deletes one crop area |
EpsonCom.ERROR_CODE |
ejectCheck()
ejectCheck Ejects the check. |
EpsonCom.ERROR_CODE |
feedSlipToPrintStartPosition()
feedSlipToPrintStartPosition feeds the slip to the print starting position according to the selected side |
EpsonComASBStatus |
getASB()
getASB returns the most recently received ASB (Automatic Status Back) |
byte |
getDeviceStatus()
getDeviceStatus Returns the previously requested real-time status |
java.util.Vector<java.lang.Byte> |
getImageData()
getImageData returns the previously scanned image data from the image buffer |
byte[] |
getImageDataBytes()
getImageDataBytes returns the previously scanned image data from the image buffer as a byte[] |
java.lang.String |
getMICRString()
getMICRString returns the previously read MICR string from the MICR buffer |
java.util.Vector<java.lang.Byte> |
getReceivedData()
getReceivedData Reads available data out of the receive buffer |
java.lang.Boolean |
isDeviceOpen()
isDeviceOpen checks if the device is currently open and ready to receive data |
EpsonCom.ERROR_CODE |
openDevice()
openDevice Creates and opens the port object. |
EpsonCom.ERROR_CODE |
printPage(int mode)
printPage Finishes a page-mode page and prints it It also ejects any slip that was printed on even when this was not in page mode |
EpsonCom.ERROR_CODE |
printString(java.lang.String string,
EpsonCom.FONT font,
java.lang.Boolean bold,
java.lang.Boolean underlined,
java.lang.Boolean doubleHeight,
java.lang.Boolean doubleWidth)
printString Prints a one-line string with specific formatting |
EpsonCom.ERROR_CODE |
readMICR(EpsonCom.MICR_FONT font,
java.lang.Boolean waitforanswer,
int timeout)
readMICR initiates the check (MICR) reading the result can be obtained by using the getMICR command |
EpsonCom.ERROR_CODE |
readMICRScanCheck(EpsonCom.MICR_FONT font,
java.lang.Boolean waitforanswer,
int timeout)
readMICRScanCheck initiates check (MICR) reading followed by a check image scan if callback is registered, it will result in getting two callbacks, one for MICR and one for the image |
EpsonCom.ERROR_CODE |
registerCallback(CallbackInterface callback)
registerCallback registers a callback function to be called when data arrives at the port |
EpsonCom.ERROR_CODE |
requestDeviceStatus(int type,
java.lang.Boolean waitforanswer,
int timeout)
requestDeviceStatus requests the current real-time device status from the device the result can be obtained by using the command getDeviceStatus |
EpsonCom.ERROR_CODE |
resetDevice()
resetDevice resets the printer |
EpsonCom.ERROR_CODE |
scanCheck(java.lang.Boolean waitforanswer,
int timeout)
scanCheck Initiates the check scanning (callback must be registered in order to receive the actual image data) |
EpsonCom.ERROR_CODE |
scanIDCard(java.lang.Boolean waitforanswer,
int timeout)
scanIDCard initiates the ID card scanning (callback must be registered in order to receive the actual image data) |
EpsonCom.ERROR_CODE |
selectAlignment(EpsonCom.ALIGNMENT alignment)
selectAlignment selects the print alignment |
EpsonCom.ERROR_CODE |
selectImageFormat(EpsonCom.IMAGEFORMAT format)
selectImageFormat selects the image format which will be used to return the image data after the next scan |
EpsonCom.ERROR_CODE |
selectPageMode()
selectPageMode switches the printer into page mode. |
EpsonCom.ERROR_CODE |
selectPrintDirection(EpsonCom.PRINTDIRECTION direction)
selectPrintDirection selects the print direction (for page mode only!) |
EpsonCom.ERROR_CODE |
selectReceiptPaper()
selectReceiptPaper selects the paper type to print on |
EpsonCom.ERROR_CODE |
selectSlipPaper(EpsonCom.PAPERSIDE side)
selectSlipPaper selects the slip as active paper and sets on which side to print on |
EpsonCom.ERROR_CODE |
sendCommand(java.lang.String command)
sendCommand sends an ESC/POS command to the printer |
EpsonCom.ERROR_CODE |
sendData(java.util.Vector<java.lang.Byte> data)
sendData sends binary data to the port |
EpsonCom.ERROR_CODE |
setCropArea(int num,
int x1,
int y1,
int x2,
int y2)
setCropArea sets one crop area, defined by two diagonal coordinates |
EpsonCom.ERROR_CODE |
setDeviceParameters(EpsonComDeviceParameters params)
setDeviceParameters Sets the device parameters. |
EpsonCom.ERROR_CODE |
setImageParameters(EpsonCom.BITDEPTH bitdepth,
EpsonCom.IMAGEPROCESSING imageprocessing,
int threshold)
setImageParameters sets the parameters data tone, image processing and threshold |
EpsonCom.ERROR_CODE |
setScanArea(int x1,
int y1,
int x2,
int y2)
setScanArea sets the scan area, defined by two diagonal coordinates |
EpsonCom.ERROR_CODE |
unregisterCallback()
unregisterCallback unregisters the callback function. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EpsonComDevice()
Method Detail |
---|
public EpsonCom.ERROR_CODE setDeviceParameters(EpsonComDeviceParameters params)
params
- DeviceParameters object
public EpsonCom.ERROR_CODE openDevice()
public EpsonCom.ERROR_CODE closeDevice()
public java.lang.Boolean isDeviceOpen()
public EpsonCom.ERROR_CODE sendData(java.util.Vector<java.lang.Byte> data)
data
- the binary data to be sent
public EpsonCom.ERROR_CODE sendCommand(java.lang.String command)
command
- String with the command, this can be any ESC/POS command, consisting
of values separated by a space. Values can be single characters,
strings in quotes, decimal or hex numbers. Examples:
"Hello Printer" LF
GS I 67
public java.util.Vector<java.lang.Byte> getReceivedData()
public EpsonCom.ERROR_CODE requestDeviceStatus(int type, java.lang.Boolean waitforanswer, int timeout)
type
- type of status:
- 0=cut sheet,
- 1=printer,
- 2=offline cause,
- 3=error cause,
- 4=roll paper sensor,
- 5=slip,
- 6=MICR,
- 7=card image scannerwaitforanswer
- true if this function shall wait until the device status has arrived from the printertimeout
- if waitForAnswer==true, this specifies the timeout period in seconds
public byte getDeviceStatus()
public EpsonCom.ERROR_CODE activateASB(java.lang.Boolean drawer, java.lang.Boolean onoffline, java.lang.Boolean error, java.lang.Boolean paper, java.lang.Boolean slip, java.lang.Boolean panelbutton)
drawer
- true to activate ASB for this statusonoffline
- true to activate ASB for this statuserror
- true to activate ASB for this statuspaper
- true to activate ASB for this statusslip
- true to activate ASB for this statuspanelbutton
- true to activate ASB for this status
public EpsonCom.ERROR_CODE readMICR(EpsonCom.MICR_FONT font, java.lang.Boolean waitforanswer, int timeout)
font
- E13B, CMC7waitforanswer
- true if this function shall wait until the MICR string has arrived from the printertimeout
- if waitForAnswer==true, this specifies the timeout period in seconds
public EpsonComASBStatus getASB()
public java.lang.String getMICRString()
public java.util.Vector<java.lang.Byte> getImageData()
public byte[] getImageDataBytes()
public EpsonCom.ERROR_CODE setImageParameters(EpsonCom.BITDEPTH bitdepth, EpsonCom.IMAGEPROCESSING imageprocessing, int threshold)
bitdepth
- imageprocessing
- threshold
- -128..+127, standard value = 0
public EpsonCom.ERROR_CODE setScanArea(int x1, int y1, int x2, int y2)
x1
- upper left cornery1
- upper left cornerx2
- lower right cornery2
- lower right corner
public EpsonCom.ERROR_CODE setCropArea(int num, int x1, int y1, int x2, int y2)
num
- index of the crop area 1..10x1
- upper left cornery1
- upper left cornerx2
- lower right cornery2
- lower right corner
public EpsonCom.ERROR_CODE deleteCropArea(int num)
num
- index of the crop area 1..10 to be deleted
public EpsonCom.ERROR_CODE selectImageFormat(EpsonCom.IMAGEFORMAT format)
format
- image format:
- RAW, raw data, no header, uncompressed
- BMP, BMP uncompressed
- TIFF, TIFF uncompressed (gray-scale only)
- TIFF_COMP, TIFF with CCITT Grp4 compression (b/w only)
- JPEG_HIGH, JPEG with high compression rate (gray-scale only)
- JPEG_MED, JPEG with standard compression rate (gray-scale only)
- JPEG_LOW JPEG with low compression rate (gray-scale only)
public EpsonCom.ERROR_CODE selectReceiptPaper()
public EpsonCom.ERROR_CODE selectSlipPaper(EpsonCom.PAPERSIDE side)
side
- side to print on: FRONT or BACK
public EpsonCom.ERROR_CODE selectAlignment(EpsonCom.ALIGNMENT alignment)
alignment
- LEFT, CENTER, RIGHT
public EpsonCom.ERROR_CODE selectPageMode()
public EpsonCom.ERROR_CODE selectPrintDirection(EpsonCom.PRINTDIRECTION direction)
direction
- LEFTTORIGHT, BOTTOMTOTOP, RIGHTTOLEFT, TOPTOBOTTOM
public EpsonCom.ERROR_CODE feedSlipToPrintStartPosition()
public EpsonCom.ERROR_CODE ejectCheck()
public EpsonCom.ERROR_CODE cancelWaitForSlip()
public EpsonCom.ERROR_CODE printString(java.lang.String string, EpsonCom.FONT font, java.lang.Boolean bold, java.lang.Boolean underlined, java.lang.Boolean doubleHeight, java.lang.Boolean doubleWidth)
string
- string to be printedfont
- FONT_A, FONT_Bbold
- true=bold, false=normalunderlined
- true=underlined, false=not underlineddoubleHeight
- true=double height, false=single heightdoubleWidth
- true=double width, false=single width
public EpsonCom.ERROR_CODE printPage(int mode)
mode
- - 0 = print current page and exit page mode
- 1 = print current page and stay in page mode
public EpsonCom.ERROR_CODE cutPaper()
public EpsonCom.ERROR_CODE scanCheck(java.lang.Boolean waitforanswer, int timeout)
waitforanswer
- true if this function shall wait until the image data has arrived from the printertimeout
- if waitForAnswer==true, this specifies the timeout period in seconds
public EpsonCom.ERROR_CODE readMICRScanCheck(EpsonCom.MICR_FONT font, java.lang.Boolean waitforanswer, int timeout)
font
- E13B or CMC7waitforanswer
- true if this function shall wait until the MICR string and the image data has arrived from the printertimeout
- if waitForAnswer==true, this specifies the timeout period in seconds
public EpsonCom.ERROR_CODE scanIDCard(java.lang.Boolean waitforanswer, int timeout)
waitforanswer
- true if this function shall wait until the image data has arrived from the printertimeout
- if waitForAnswer==true, this specifies the timeout period in seconds
public EpsonCom.ERROR_CODE resetDevice()
public EpsonCom.ERROR_CODE registerCallback(CallbackInterface callback)
callback
- object of a class that implements the CallbackInterface interface
public EpsonCom.ERROR_CODE unregisterCallback()
public EpsonCom.ERROR_CODE checkAndSetImageParameters(int checkOrCard)
checkOrCard
- 0=check, 1=card