Package SampleCAT
Class Device
- All Implemented Interfaces:
Runnable
Base of a JposDevice based implementation of JavaPOS CAT and ElectronicJournal device service implementations for the
sample device implemented in SampleCAT.tcl. The sample device simulates EFT payment transactions without ticket
printing (the simulator sends ticket and display data to its target).
Supported features are:
Minimum requirements: It must support code mapping or ASCII, ANSI or Unicode encoding.
The advantages of processing display data via DirectIOEvent:
If JournalPath specifies a POSPrinter device name, the printer will be claimed and enabled at CAT operation start. If the printer reports an error (not online, paper near end, cover open), the CAT operation will not be started. If printing ticket data fails due to head cleaning, printing will be repeated automatically, otherwise the sample waits for pressing the OK button on a message box (OK, that's a bad solution, but this is only a sample). After printing finished, the POSPrinter will be released.
Minimum requirements to the POSPrinter device:
Ticket data of the sample CAT do not contain any control characters except newline (0ah).
The advantages of processing ticket data via DirectIOEvent:
Here a full list of all device specific properties that can be changed via jpos.xml:
Supported features are:
- Sale, refund and void.
- Start transaction before amount to approve is known.
- Confirmation in case of signature based approval.
- Lock / unlock terminal.
- Card issuer, transaction number, transaction date, tip, approved amount, approval result, terminal result, masked card number (last 4 digit readable), expiration date sent in case of successful operation.
- Display output will be sent to LineDisplay or to the application via DirectIOEvent during CAT operations.
- Ticket layout will be send to a POS printer, to the application via DirectIOEvent or passed to ElectronicJournal devices.
Minimum requirements: It must support code mapping or ASCII, ANSI or Unicode encoding.
The advantages of processing display data via DirectIOEvent:
- The application has full control over display contents.
- No hardware limits for number of display lines and columns (sample CAT uses 4 lines with 40 characters).
- No limitations for test formatting, character sets and usable fonts.
- Neither need to release the cash register's LineDisplay before CAT operations nor need to re-claim and re-enable the LineDisplay after CAT operation has been finished.
- No need for vendor-specific code to process display data.
- No need to change the application if it is designed to share its line display during CAT operations:
- If the application releases the LineDisplay before CAT operations start.
- If the application re-claims and re-enables LineDisplay after CAT operations finish.
If JournalPath specifies a POSPrinter device name, the printer will be claimed and enabled at CAT operation start. If the printer reports an error (not online, paper near end, cover open), the CAT operation will not be started. If printing ticket data fails due to head cleaning, printing will be repeated automatically, otherwise the sample waits for pressing the OK button on a message box (OK, that's a bad solution, but this is only a sample). After printing finished, the POSPrinter will be released.
Minimum requirements to the POSPrinter device:
- Power Reporting,
- Receipt print station,
- Receipt near end sensor,
- Maximum receipt width ≥ JournalWidth (Jpos.xml) property. Default for JournalWidth is 32.
Ticket data of the sample CAT do not contain any control characters except newline (0ah).
The advantages of processing ticket data via DirectIOEvent:
- Printing ticket data is completely under control of the application, including error handling and error recovery.
- The application knows the ticket data and can print copies if requested.
- Ticket data come directly from the service to the application, no need to query data from ElectronicJournal devices.
- No need to release the POSPrinter before each CAT operation and to re-claim and re-enable after each CAT operation has been finished.
- Printing ticket data is completely under control of the application, including error handling and error recovery.
- The application knows the ticket data and can print copies if requested.
- The ElectronicJournal interface is a well-defined standard, no vendor specific implementation needed (if usage of ElectronicJournal devices has been implemented for such usage cases).
- No need to release the POSPrinter before each CAT operation and to re-claim and re-enable after each CAT operation has been finished.
- No need for vendor-specific code to process ticket data.
- No need to change the application if it is designed to share its pos printer during CAT operations:
- If the application releases the POSPrinter before CAT operations start.
- If the application re-claims and re-enables POSPrinter after CAT operations finish.
Here a full list of all device specific properties that can be changed via jpos.xml:
- CharacterTimeout: Positive integer value, specifying the maximum delay between bytes that belong to the same frame. Default value: 50 milliseconds.
- ClientPort: Integer value between 0 and 65535 specifying the TCP port used for communication with the device simulator. Default: 0 (for random port number selected by operating system).
- DisplayLines: Number of display lines the application or the attached JavaPOS display can support. Must be 2, 3 or 4. Default: 4
- DisplayName: See description above: Must be a LineDisplay device name or empty. Default: empty.
- DisplayWidth: Maximum length of a single display line the application or the attached LineDisplay can support. Must be an integer value between 20 and 40 (both inclusive). Default: 40.
- JournalLowSize: Maximum free space (in tickets) to report nearly full. Must be a positive value between 0 and the maximum size of the journal, in tickets. Default: 10.
- JournalMaxSize: Maximum size of of electronic journal (in tickets). Must be a positive value. Default: 1000.
- JournalPath: See description above: Path of electronic journal files or empty to force usage of DirectIoEvent objects to pass CAT tickets to the application. Default: empty (to force DirectIOEvent usage).
- JournalWidth: Length of one ticket line stored in the journal or sent vie DirectIOEvent. Must be a value between 28 and 99 (inclusive). Default: 32.
- MinClaimTimeout: Minimum timeout in milliseconds used by method Claim to ensure correct working. Must be a positive value. If this value is too small, Claim might throw a JposException even if everything is OK if the specified timeout is less than or equal to MinClaimTimeout. Default: 100.
- Port: The IPv4 address of the device. Must always be specified and not empty. Notation: address:port, where address is a IPv4 address and port the TCP port of the device.
- RequestTimeout: Maximum time the service object waits for the reception of a response frame after sending a request to the target, in milliseconds. Default: 1000.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic int
EventNumber of DirectIOEvent for display data.static int
EventNumber of DirectIOEvent for ticket data.static int
Data value of DirectIOEvent with EventNumber CAT_CMD_TICKET for merchant and customer tickets.static int
Data value of DirectIOEvent with EventNumber CAT_CMD_TICKET for customer tickets.Fields inherited from class de.gmxhome.conrad.jpos.jpos_base.JposDevice
Belts, BillAcceptors, BillDispensers, Biometricss, BumpBars, CashChangers, CashDrawers, CATs, CheckScanners, ClaimedBelt, ClaimedBillAcceptor, ClaimedBillDispenser, ClaimedBiometrics, ClaimedBumpBar, ClaimedCashChanger, ClaimedCashDrawer, ClaimedCAT, ClaimedCheckScanner, ClaimedCoinAcceptor, ClaimedCoinDispenser, ClaimedDeviceMonitor, ClaimedElectronicJournal, ClaimedElectronicValueRW, ClaimedFiscalPrinter, ClaimedGate, ClaimedGestureControl, ClaimedGraphicDisplay, ClaimedHardTotals, ClaimedImageScanner, ClaimedIndividualRecognition, ClaimedItemDispenser, ClaimedKeylock, ClaimedLights, ClaimedLineDisplay, ClaimedMICR, ClaimedMotionSensor, ClaimedMSR, ClaimedPINPad, ClaimedPointCardRW, ClaimedPOSKeyboard, ClaimedPOSPower, ClaimedPOSPrinter, ClaimedRemoteOrderDisplay, ClaimedRFIDScanner, ClaimedScale, ClaimedScanner, ClaimedSignatureCapture, ClaimedSmartCardRW, ClaimedSoundPlayer, ClaimedSoundRecorder, ClaimedSpeechSynthesis, ClaimedToneIndicator, ClaimedVideoCapture, ClaimedVoiceRecognition, CoinAcceptors, CoinDispensers, DeviceMonitors, ElectronicJournals, ElectronicValueRWs, FiscalPrinters, Gates, GestureControls, GraphicDisplays, HardTotalss, ImageScanners, IndividualRecognitions, ItemDispensers, Keylocks, Lightss, LineDisplays, MICRs, MotionSensors, MSRs, PINPads, PointCardRWs, POSKeyboards, POSPowers, POSPrinters, RemoteOrderDisplays, RFIDScanners, Scales, Scanners, SignatureCaptures, SmartCardRWs, SoundPlayers, SoundRecorders, SpeechSynthesiss, ToneIndicators, VideoCaptures, VoiceRecognitions
Fields inherited from class de.gmxhome.conrad.jpos.jpos_base.JposBaseDevice
AllowAlwaysSetProperties, AsyncProcessorRunning, CapCompareFirmwareVersion, CapPowerReporting, CapUpdateFirmware, CurrentCommand, DrawerBeepVolume, ID, JposVersion, Log, LogFilePath, LogFilePattern, LoggerFormat, LoggerName, LogLevel, MaxArrayStringElements, MaximumConfirmationEventWaitingTime, PendingCommands, PhysicalDeviceDescription, PhysicalDeviceName, SerialIOAdapterClass, StrictFIFOEventHandling
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeDefaults(CATProperties props)
Change defaults of properties.void
Change defaults of properties.void
checkProperties(jpos.config.JposEntry entry)
Checks whether a JposEntry belongs to a predefined property value an if so, sets the corresponding driver valuegetCATProperties(int index)
Returns device implementation of CATProperties.getElectronicJournalProperties(int index)
Returns device implementation of ElectronicJournalProperties.boolean
This method removes the given property set from the corresponding property set list and removes the device from the list of all devices, if no further property set is present in any other property set list.void
run()
Method to send an abort command without waiting for the response.Method to perform any command, Keep in mind that commands normally generate no response.Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.JposDevice
beltInit, billAcceptorInit, billDispenserInit, biometricsInit, bumpBarInit, cashChangerInit, cashDrawerInit, cATInit, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, changeDefaults, checkScannerInit, coinAcceptorInit, coinDispenserInit, deviceMonitorInit, electronicJournalInit, electronicValueRWInit, fiscalPrinterInit, gateInit, gestureControlInit, getArrayOf, getBeltProperties, getBillAcceptorProperties, getBillDispenserProperties, getBiometricsProperties, getBumpBarProperties, getCashChangerProperties, getCashDrawerProperties, getCheckScannerProperties, getCoinAcceptorProperties, getCoinDispenserProperties, getDeviceMonitorProperties, getElectronicValueRWProperties, getFiscalPrinterProperties, getGateProperties, getGestureControlProperties, getGraphicDisplayProperties, getHardTotalsProperties, getImageScannerProperties, getIndividualRecognitionProperties, getItemDispenserProperties, getKeylockProperties, getLightsProperties, getLineDisplayProperties, getMICRProperties, getMotionSensorProperties, getMSRProperties, getPINPadProperties, getPointCardRWProperties, getPOSKeyboardProperties, getPOSPowerProperties, getPOSPrinterProperties, getRemoteOrderDisplayProperties, getRFIDScannerProperties, getScaleProperties, getScannerProperties, getSignatureCaptureProperties, getSmartCardRWProperties, getSoundPlayerProperties, getSoundRecorderProperties, getSpeechSynthesisProperties, getToneIndicatorProperties, getVideoCaptureProperties, getVoiceRecognitionProperties, graphicDisplayInit, hardTotalsInit, imageScannerInit, individualRecognitionInit, itemDispenserInit, keylockInit, lightsInit, lineDisplayInit, mICRInit, motionSensorInit, mSRInit, noOfPropertySets, pINPadInit, pointCardRWInit, pOSKeyboardInit, pOSPowerInit, pOSPrinterInit, remoteOrderDisplayInit, rFIDScannerInit, scaleInit, scannerInit, signatureCaptureInit, smartCardRWInit, soundPlayerInit, soundRecorderInit, speechSynthesisInit, toneIndicatorInit, videoCaptureInit, voiceRecognitionInit
Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.JposBaseDevice
check, checkext, checkMember, checkRange, concurrentProcessingSupported, createConcurrentRequestThread, delay, getClaimingInstance, getCount, getPropertySetInstance, getRequestRunnersRequest, handleEvent, handleEvent, handleEvent, handleEvent, handleEvent, handleEvent, handlePowerStateOnEnable, invokeRequestThread, log, member, member, postDirectIOProcessing, postTransitionProcessing, prepareSignalStatusWaits, processEventList, signalStatusWaits, stringArrayToLongArray, synchronizedMessageBox
-
Field Details
-
CAT_CMD_DISPLAY
public static final int CAT_CMD_DISPLAYEventNumber of DirectIOEvent for display data. Property Data contains line number (starting from 1), Obj contains String object with the display contents.- See Also:
- Constant Field Values
-
CAT_CMD_TICKET
public static final int CAT_CMD_TICKETEventNumber of DirectIOEvent for ticket data. Property Data contains the target (merchant, customer or both), Obj contains String object with the ticket. The ticket contains no control characters except LF (0Ah, line feed).- See Also:
- Constant Field Values
-
CAT_DATA_CUSTOMER
public static final int CAT_DATA_CUSTOMERData value of DirectIOEvent with EventNumber CAT_CMD_TICKET for customer tickets. Such a ticket should be printed and handed over to the customer.- See Also:
- Constant Field Values
-
CAT_DATA_BOTH
public static final int CAT_DATA_BOTHData value of DirectIOEvent with EventNumber CAT_CMD_TICKET for merchant and customer tickets. Such a ticket should be printed twice, one to be handed over to the customer and one to be kept by the merchant, in most cases with customer signature.- See Also:
- Constant Field Values
-
-
Constructor Details
-
Device
Constructor. ID is the network address of the credit authorisation terminal (CAT). displayName specifies how display information of the CAT will be performed. journalPath specifies how ticket data provided by the CAT will be handled.- Parameters:
id
- Network address of the display controller.displayName
- Value of Jpos.xml property DisplayName (default: null).journalPath
- Value of Jpos.xml property JournalPath (default: null).
-
-
Method Details
-
checkProperties
public void checkProperties(jpos.config.JposEntry entry) throws jpos.JposExceptionDescription copied from class:JposBaseDevice
Checks whether a JposEntry belongs to a predefined property value an if so, sets the corresponding driver value- Overrides:
checkProperties
in classJposBaseDevice
- Parameters:
entry
- Entry to be checked, contains value to be set- Throws:
jpos.JposException
- if a property value is invalid
-
changeDefaults
Description copied from class:JposDevice
Change defaults of properties. Must be implemented within derived classed that support credit authorization terminal services.- Overrides:
changeDefaults
in classJposDevice
- Parameters:
props
- Property set for setting the property defaults
-
changeDefaults
Description copied from class:JposDevice
Change defaults of properties. Must be implemented within derived classed that support electronic journal services.- Overrides:
changeDefaults
in classJposDevice
- Parameters:
props
- Property set for setting the property defaults
-
removePropertySet
Description copied from class:JposBaseDevice
This method removes the given property set from the corresponding property set list and removes the device from the list of all devices, if no further property set is present in any other property set list.- Overrides:
removePropertySet
in classJposBaseDevice
- Parameters:
props
- Property set to be removed from the corresponding property set list.- Returns:
- true if the device has been removed from the list of all devices, otherwise false
- Throws:
jpos.JposException
- Source is JposDeviceFactory.deleteDevice. Fails if device cannot be found in list of all devices.
-
sendRecv
Method to perform any command, Keep in mind that commands normally generate no response.- Parameters:
command
- Command data to be sent, without final ETX.resptype
- Header byte of expected response. If no response is expected: 0.timeout
- Timeout for whole operation.- Returns:
- JposException in case of communication error, String containing the response otherwise.
-
sendAbort
Method to send an abort command without waiting for the response.- Returns:
- JposException in error case, null if no error occurred.
-
run
public void run() -
getCATProperties
Description copied from class:JposDevice
Returns device implementation of CATProperties.- Overrides:
getCATProperties
in classJposDevice
- Parameters:
index
- Device index, see constructor of JposCommonProperties.- Returns:
- Instance of CATProperties that matches the requirements of the corresponding device service.
-
getElectronicJournalProperties
Description copied from class:JposDevice
Returns device implementation of ElectronicJournalProperties.- Overrides:
getElectronicJournalProperties
in classJposDevice
- Parameters:
index
- Device index, see constructor of JposCommonProperties.- Returns:
- Instance of ElectronicJournalProperties that matches the requirements of the corresponding device service.
-