Package SamplePOSPrinter
Class POSPrinter
- All Implemented Interfaces:
JposBaseInterface,POSPrinterInterface
Class implementing the POSPrinterInterface for the sample pos printer.
-
Field Summary
Fields inherited from class de.gmxhome.conrad.jpos.jpos_base.posprinter.POSPrinterProperties
CapCharacterSet, CapConcurrentJrnRec, CapConcurrentJrnSlp, CapConcurrentPageMode, CapConcurrentRecSlp, CapCoverSensor, CapJrn2Color, CapJrnBold, CapJrnCartridgeSensor, CapJrnColor, CapJrnDhigh, CapJrnDwide, CapJrnDwideDhigh, CapJrnEmptySensor, CapJrnItalic, CapJrnNearEndSensor, CapJrnPresent, CapJrnUnderline, CapMapCharacterSet, CapRec2Color, CapRecBarCode, CapRecBitmap, CapRecBold, CapRecCartridgeSensor, CapRecColor, CapRecDhigh, CapRecDwide, CapRecDwideDhigh, CapRecEmptySensor, CapRecItalic, CapRecLeft90, CapRecMarkFeed, CapRecNearEndSensor, CapRecPageMode, CapRecPapercut, CapRecPresent, CapRecRight90, CapRecRotate180, CapRecRuledLine, CapRecStamp, CapRecUnderline, CapSlp2Color, CapSlpBarCode, CapSlpBitmap, CapSlpBold, CapSlpBothSidesPrint, CapSlpCartridgeSensor, CapSlpColor, CapSlpDhigh, CapSlpDwide, CapSlpDwideDhigh, CapSlpEmptySensor, CapSlpFullslip, CapSlpItalic, CapSlpLeft90, CapSlpNearEndSensor, CapSlpPageMode, CapSlpPresent, CapSlpRight90, CapSlpRotate180, CapSlpRuledLine, CapSlpUnderline, CapTransaction, CartridgeNotify, CharacterSet, CharacterSetDef, CharacterSetList, CoverOpen, ErrorLevel, ErrorStation, ErrorString, FontTypefaceList, InsertionMode, JrnCartridgeState, JrnCurrentCartridge, JrnCurrentCartridgeDef, JrnEmpty, JrnLetterQuality, JrnLineChars, JrnLineCharsList, JrnLineHeight, JrnLineHeightDef, JrnLineSpacing, JrnLineSpacingDef, JrnLineWidth, JrnLineWidthDef, JrnNearEnd, MapCharacterSet, MapMode, PageModeArea, PageModeDescriptor, PageModeHorizontalPosition, PageModePrintArea, PageModePrintDirection, PageModeStation, PageModeVerticalPosition, RecBarCodeRotationList, RecBitmapRotationList, RecCartridgeState, RecCurrentCartridge, RecCurrentCartridgeDef, RecEmpty, RecLetterQuality, RecLineChars, RecLineCharsList, RecLineHeight, RecLineHeightDef, RecLineSpacing, RecLineSpacingDef, RecLinesToPaperCut, RecLinesToPaperCutDef, RecLineWidth, RecLineWidthDef, RecNearEnd, RecSidewaysMaxChars, RecSidewaysMaxCharsDef, RecSidewaysMaxLines, RecSidewaysMaxLinesDef, RemovalMode, RotateSpecial, SlpBarCodeRotationList, SlpBitmapRotationList, SlpCartridgeState, SlpCurrentCartridge, SlpCurrentCartridgeDef, SlpEmpty, SlpLetterQuality, SlpLineChars, SlpLineCharsList, SlpLineHeight, SlpLineHeightDef, SlpLinesNearEndToEnd, SlpLinesNearEndToEndDef, SlpLineSpacing, SlpLineSpacingDef, SlpLineWidth, SlpLineWidthDef, SlpMaxLines, SlpMaxLinesDef, SlpNearEnd, SlpPrintSide, SlpPrintSideDef, SlpSidewaysMaxChars, SlpSidewaysMaxCharsDef, SlpSidewaysMaxLines, SlpSidewaysMaxLinesDefFields inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
AllowAlwaysSetProperties, AllowDeprecatedMethods, AsyncInputActive, AsyncMode, AutoDisable, CapStatisticsReporting, CapUpdateStatistics, CheckHealthText, Claimed, Claiming, ClaimWaiters, CurrentCommands, CurrentUnitID, DataCount, DataEventEnabled, DataEventList, Device, DeviceEnabled, DeviceServiceDescription, DeviceServiceVersion, DevProps, ErrorUnits, EventCB, EventList, EventSource, EventString, EventUnitID, EventUnits, ExclusiveAllowed, ExclusiveNo, ExclusiveUse, ExclusiveYes, FirstEnableHappened, FlagWhenIdle, FlagWhenIdleStatusValue, FreezeEvents, Index, LogicalName, MaximumConfirmationEventWaitingTime, OutputID, PowerNotify, PowerState, SerializedRequestRunner, SerializedRequests, State, StrictFIFOEventHandling, SuspendedCommands, SuspendedConcurrentCommands, UnitsOnline, UsesSubsystemUnits -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacterSet(int value)Final part of setting CharacterSet.voidcheckHealth(int level)Final part of CheckHealth method.voidclaim(int timeout)Final part of setting claim.voidFinal part of CutPaper method.voiddeviceEnabled(boolean enable)Final part of setting DeviceEnabled.getLogoData(boolean top)This method will be called whenever print data contain a logo print sequence ESC|tL or ESC|bL.voidmapMode(int i)Final part of setting MapMode.printImmediate(int station, String data)Validation part of PrintImmediate method.printNormal(int station, String data)Validation part of PrintNormal method.voidprintNormal(PrintNormal request)Final part of PrintNormal method.voidrecLineChars(int value)Final part of setting RecLineChars.voidrecLineHeight(int i)Final part of setting RecLineHeight.voidrecLineSpacing(int i)Final part of setting RecLineSpacing.voidrelease()Final part of release method.voidFinal part of SetLogo method.voidtransactionPrint(TransactionPrint request)Final part of TransactionPrint method.voidvalidateData(int station, POSPrinterService.ControlChar ctrl)Validate control character.voidvalidateData(int station, POSPrinterService.EscCut esc)Validate cut sequence.voidvalidateData(int station, POSPrinterService.EscEmbedded esc)Validate embedded data sequence.voidvalidateData(int station, POSPrinterService.EscFeed esc)Validate feed sequence.voidvalidateData(int station, POSPrinterService.EscLogo esc)Validate logo sequence.voidvalidateData(int station, POSPrinterService.PrintData data)Validate printable character sequence.Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.posprinter.POSPrinterProperties
beginInsertion, beginRemoval, cartridgeNotify, changePrintSide, clearErrorProperties, clearPrintArea, cutPaper, drawRuledLine, drawRuledLine, endInsertion, endRemoval, initOnEnable, initOnFirstEnable, initOnOpen, jrnCurrentCartridge, jrnLetterQuality, jrnLineChars, jrnLineHeight, jrnLineSpacing, mapCharacterSet, markFeed, markFeed, newJposOutputRequest, pageModeHorizontalPosition, pageModePrint, pageModePrint, pageModePrintArea, pageModePrintDirection, pageModeStation, pageModeVerticalPosition, printBarCode, printBarCode, printBitmap, printBitmap, printMemoryBitmap, printMemoryBitmap, printTwoNormal, printTwoNormal, recCurrentCartridge, recLetterQuality, rotatePrint, rotatePrint, rotateSpecial, setBitmap, slpCurrentCartridge, slpLetterQuality, slpLineChars, slpLineHeight, slpLineSpacing, transactionPrint, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateDataMethods inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
addProperties, asyncMode, attachWaiter, autoDisable, checkForDeprecation, checkProperties, clearDataProperties, clearInput, clearOutput, clearOutputErrorProperties, close, compareFirmwareVersion, dataEventEnabled, directIO, directIO, flagWhenIdle, freezeEvents, getClaimingInstance, handlePowerStateOnEnable, initOnClaim, open, powerNotify, releaseWaiter, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, signalWaiter, unitDataCount, updateFirmware, updateFirmware, updateStatistics, waitWaiterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.gmxhome.conrad.jpos.jpos_base.JposBaseInterface
asyncMode, autoDisable, clearInput, clearOutput, close, compareFirmwareVersion, dataEventEnabled, directIO, directIO, flagWhenIdle, freezeEvents, handlePowerStateOnEnable, open, powerNotify, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, unitDataCount, updateFirmware, updateFirmware, updateStatistics
-
Constructor Details
-
POSPrinter
Constructor. Gets instance of Device to be used as communication object. Device index for sample is always 0.- Parameters:
dev- Instance of Device this object belongs to.
-
-
Method Details
-
claim
public void claim(int timeout) throws jpos.JposExceptionDescription copied from interface:JposBaseInterfaceFinal part of setting claim. Can be overwritten within derived classes. This method will be called only if the following plausibility checks lead to a positive result:- Device has not been closed,
- The device is not claimed,
- ExclusiveUse dos not equal ExclusiveNo,
- timeout is negative not equal to FOREVER.
- Specified by:
claimin interfaceJposBaseInterface- Overrides:
claimin classJposCommonProperties- Parameters:
timeout- see UPOS specification, method Claim- Throws:
jpos.JposException- If an error occurs while claiming the device
-
release
public void release() throws jpos.JposExceptionDescription copied from interface:JposBaseInterfaceFinal part of release method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is claimed,
- ExclusiveUse equals ExclusiveYes: Device is not enabled.
- Specified by:
releasein interfaceJposBaseInterface- Overrides:
releasein classJposCommonProperties- Throws:
jpos.JposException- See UPOS specification, method Release
-
deviceEnabled
public void deviceEnabled(boolean enable) throws jpos.JposExceptionDescription copied from interface:JposBaseInterfaceFinal part of setting DeviceEnabled. Can be overwritten within derived classes. Performs initOnEnable method of corresponding property set in addition to setting DeviceEnabled. This method will be called only if the following plausibility checks lead to a positive result:- Device has not been closed,
- ExclusiveUse equals ExclusiveYes: Device is claimed,
- DeviceEnabled != enabled.
- Specified by:
deviceEnabledin interfaceJposBaseInterface- Overrides:
deviceEnabledin classJposCommonProperties- Parameters:
enable- True to enable, false to disable- Throws:
jpos.JposException- If an error occurs during enable or disable
-
checkHealth
public void checkHealth(int level) throws jpos.JposExceptionDescription copied from interface:JposBaseInterfaceFinal part of CheckHealth method. Can be overwritten in derived class, if necessary. Keep in mind that dvice class specific checks (e.g. check of Claimed or DeviceEnabled) must be done within derived classes. This method will be called only if the following plausibility checks lead to a positive result:- Device is neither enabled nor claimed.
- Specified by:
checkHealthin interfaceJposBaseInterface- Overrides:
checkHealthin classJposCommonProperties- Parameters:
level- See UPOS specification, method CheckHealth- Throws:
jpos.JposException- See UPOS specification, method CheckHealth
-
mapMode
public void mapMode(int i) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterfaceFinal part of setting MapMode. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- The new value is one of MM_DOTS, MM_TWIPS, MM_ENGLISH or MM_METRIC.
- Specified by:
mapModein interfacePOSPrinterInterface- Overrides:
mapModein classPOSPrinterProperties- Parameters:
i- New MapMode value- Throws:
jpos.JposException- If an error occurs
-
characterSet
public void characterSet(int value) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterfaceFinal part of setting CharacterSet. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapJrnCartridgeSensor, CapRecCartridgeSensor or CapSlpCartridgeSensor is not 0,
- The new value is one of the values specified in CharacterSetList.
- Specified by:
characterSetin interfacePOSPrinterInterface- Overrides:
characterSetin classPOSPrinterProperties- Parameters:
value- New character set value- Throws:
jpos.JposException- If an error occurs
-
recLineChars
public void recLineChars(int value) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterfaceFinal part of setting RecLineChars. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapRecPresent is true,
- The new value is ≥ 0 and ≤ the maximum value specified in RecLineCharsList.
- Specified by:
recLineCharsin interfacePOSPrinterInterface- Overrides:
recLineCharsin classPOSPrinterProperties- Parameters:
value- New RecLineChars value- Throws:
jpos.JposException- If an error occurs
-
recLineHeight
public void recLineHeight(int i) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterfaceFinal part of setting RecLineHeight. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapRecPresent is true.
- Specified by:
recLineHeightin interfacePOSPrinterInterface- Overrides:
recLineHeightin classPOSPrinterProperties- Parameters:
i- New RecLineHeight value- Throws:
jpos.JposException- If an error occurs
-
recLineSpacing
public void recLineSpacing(int i) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterfaceFinal part of setting RecLineSpacing. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapRecPresent is true.
- Specified by:
recLineSpacingin interfacePOSPrinterInterface- Overrides:
recLineSpacingin classPOSPrinterProperties- Parameters:
i- New RecLineSpacing value- Throws:
jpos.JposException- If an error occurs
-
getLogoData
Description copied from interface:POSPrinterInterfaceThis method will be called whenever print data contain a logo print sequence ESC|tL or ESC|bL. Since it is possible that logos can be changed between the print call and execution of methods for asynchronous print, e.g. when transaction printing will be used, data describing the logo must be retrieved by POSPrinterService whenever an EscLogo object is generated. Every POSPrinter service implementation must overwrite this method because only the specific service stores information about the logo data. However, logo data are of type POSPrinterService.PrintDataPart[], where POSPrinterService.PrintDataPart is one of the objects supported by validateData(int, POSPrinterService.PrintDataPart). As default, this method returns an empty list of objects.- Specified by:
getLogoDatain interfacePOSPrinterInterface- Overrides:
getLogoDatain classPOSPrinterProperties- Parameters:
top- Specifies which logo data shall be filled, true for top logo, false for bottom logo.- Returns:
- POSPrinterService.PrintDataPart array containing logo data. Array is empty if the requested logo has not been set.
-
setLogo
Description copied from interface:POSPrinterInterfaceFinal part of SetLogo method. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- Selected location is L_TOP or L_BOTTOM,
- data is not null.
- Specified by:
setLogoin interfacePOSPrinterInterface- Overrides:
setLogoin classPOSPrinterProperties- Parameters:
location- See UPOS specification, method SetLogo.data- See UPOS specification, method SetLogo.- Throws:
jpos.JposException- See UPOS specification, method SetLogo.
-
validateData
Description copied from interface:POSPrinterInterfaceValidate printable character sequence. ESC sequences, CR and LF have been filtered out. Default behavior is that all other characters with character code ≤ 0x20 are invalid. If a service should support more characters, this method must be overwritten.
Keep in mind that data may contain an empty string. In that case, it marks the end of printable data in cases where the last character was a CR to support post-validation of CR.- Specified by:
validateDatain interfacePOSPrinterInterface- Overrides:
validateDatain classPOSPrinterProperties- Parameters:
station- POSPrinter station, one of S_JOURNAL, S_RECEIPT or S_SLIP.data- Data to be printed.- Throws:
jpos.JposException- For details, see UPOS method ValidateData.
-
validateData
public void validateData(int station, POSPrinterService.ControlChar ctrl) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterfaceValidate control character. One of CR or LF. Default behavior is that both characters are valid. CR will be passed to ValidateData only once for any sequence of multiple CR in the original data stream and only if LF is neither the previous nor the following character. However, even if the printer supports CR, CR might be valid behind or in case of a following escape sequence.- Specified by:
validateDatain interfacePOSPrinterInterface- Overrides:
validateDatain classPOSPrinterProperties- Parameters:
station- POSPrinter station, one of S_JOURNAL, S_RECEIPT or S_SLIP.ctrl- ControlChar object, representing CR or LF.- Throws:
jpos.JposException- For details, see UPOS method ValidateData.
-
validateData
Description copied from interface:POSPrinterInterfaceValidate logo sequence. For details, see UPOS specification of ESC|xL. The default behavior is to assume that requests to print a logo are always valid. The following plausibility checks will be made before this method will be called:- The printer station is valid.
- Specified by:
validateDatain interfacePOSPrinterInterface- Overrides:
validateDatain classPOSPrinterProperties- Parameters:
station- A valid printer station, S_RECEIPT, S_JOURNAL or S_SLIP.esc- EscLogo object containing sequence attributes.- Throws:
jpos.JposException- For details, see UPOS method ValidateData.
-
validateData
Description copied from interface:POSPrinterInterfaceValidate feed sequence. For details, see UPOS specification of ESC|[#]xF. Default behavior is that all count values are valid. The following plausibility checks will be made before this method will be called:- The printer station is valid.
- Specified by:
validateDatain interfacePOSPrinterInterface- Overrides:
validateDatain classPOSPrinterProperties- Parameters:
station- A valid printer station, S_RECEIPT, S_JOURNAL or S_SLIP.esc- EscFeed object containing the sequence attributes.- Throws:
jpos.JposException- For details, see UPOS method ValidateData.
-
validateData
Description copied from interface:POSPrinterInterfaceValidate embedded data sequence. For details, see UPOS specification of ESC|[*]#E. Default behavior is that the given sequence is valid. The following plausibility checks will be made before this method will be called:- The printer station is valid.
- Specified by:
validateDatain interfacePOSPrinterInterface- Overrides:
validateDatain classPOSPrinterProperties- Parameters:
station- A valid printer station, S_RECEIPT, S_JOURNAL or S_SLIP.esc- EscEmbedded object containing sequence attributes.- Throws:
jpos.JposException- For details, see UPOS method ValidateData.
-
validateData
Description copied from interface:POSPrinterInterfaceValidate cut sequence. For details, see UPOS specification of ESC|[#][x]P. Default behavior is that a service supports only full cut and no cut (CP_FULLCUT and 0 percent). If a service supports more values, this method must be overwritten. The following plausibility checks will be made before this method will be called:- The printer station is valid,
- Capability CapXxxPapercut is true,
- EscCut attribute Stamp is false or CapXxxStamp is true.
- Specified by:
validateDatain interfacePOSPrinterInterface- Overrides:
validateDatain classPOSPrinterProperties- Parameters:
station- S_RECEIPT.esc- EscCut object containing sequence attributes.- Throws:
jpos.JposException- For details, see UPOS method ValidateData.
-
cutPaper
Description copied from interface:POSPrinterInterfaceFinal part of CutPaper method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a CutPaper object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.
In case of asynchronous processing, the following additional checks have been made before invocation:- Receipt paper is present.
- Cover is closed.
- If present, cartridge is operational.
- Specified by:
cutPaperin interfacePOSPrinterInterface- Overrides:
cutPaperin classPOSPrinterProperties- Parameters:
request- Output request object returned by validation method that contains all parameters to be used by CutPaper.- Throws:
jpos.JposException- For details, see UPOS method CutPaper.
-
printNormal
Description copied from interface:POSPrinterInterfaceValidation part of PrintNormal method. For details, see UPOS specification. Can be overwritten within derived classes, if necessary. This method shall only perform additional validation. It will be called before the service buffers the method call for synchronous or asynchronous execution. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- If AsyncMode is false: State is S_IDLE, paper present, cover closed and if present, cartridge is operational,
- station is valid (S_JOURNAL, S_RECEIPT or S_SLIP and the corresponding CapXxxPresent is true),
- data is not null.
- Specified by:
printNormalin interfacePOSPrinterInterface- Overrides:
printNormalin classPOSPrinterProperties- Parameters:
station- Print station, see UPOS method PrintNormal.data- Print data. See UPOS method PrintNormal.- Returns:
- PrintNormal object for use in final part.
- Throws:
jpos.JposException- For details, see UPOS method PrintNormal.
-
printImmediate
Description copied from interface:POSPrinterInterfaceValidation part of PrintImmediate method. For details, see UPOS specification. Can be overwritten within derived classes, if necessary. This method shall only perform additional validation. It will be called before the service buffers the method call for synchronous or asynchronous (high-priority) execution. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- Selected station is S_JOURNAL, S_RECEIPT or S_SLIP,
- The cover is closed, paper present, head ready and cartridge neither empty nor removed.
- Specified by:
printImmediatein interfacePOSPrinterInterface- Overrides:
printImmediatein classPOSPrinterProperties- Parameters:
station- See UPOS specification, method PrintImmediate.data- Print data. See UPOS specification, method PrintImmediate.- Returns:
- PrintImmediate object for use in final part.
- Throws:
jpos.JposException- See UPOS specification, method PrintImmediate.
-
printNormal
Description copied from interface:POSPrinterInterfaceFinal part of PrintNormal method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a PrintNormal object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.
In case of asynchronous processing, the following additional checks have been made before invocation:- The station specified by request.getStation() is present.
- Cover is closed.
- If present, cartridge is operational.
- Specified by:
printNormalin interfacePOSPrinterInterface- Overrides:
printNormalin classPOSPrinterProperties- Parameters:
request- Output request object returned by validation method that contains all parameters to be used by PrintNormal.- Throws:
jpos.JposException- For details, see UPOS method PrintNormal.
-
transactionPrint
Description copied from interface:POSPrinterInterfaceFinal part of TransactionPrint method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a TransactionPrint object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.
In case of asynchronous processing, the following additional checks have been made before invocation:- The station specified by request.getStation() is present.
- Cover is closed.
- If present, cartridge is operational.
- Specified by:
transactionPrintin interfacePOSPrinterInterface- Overrides:
transactionPrintin classPOSPrinterProperties- Parameters:
request- Output request object returned by validation method that contains all parameters to be used by TransactionPrint.- Throws:
jpos.JposException- For details, see UPOS method TransactionPrint.
-