Package SampleCoinDispenser
Class Device
java.lang.Object
de.gmxhome.conrad.jpos.jpos_base.JposBaseDevice
de.gmxhome.conrad.jpos.jpos_base.JposDevice
SampleCoinDispenser.Device
- All Implemented Interfaces:
Runnable
Base of a JposDevice based implementation of a JavaPOS CoinDispenser device service implementation for the
sample device implemented in SampleCoinDispenserSimulator.tcl.
The simulator provides a coin dispenser with the following properties: Has one slot for 1, 5, 10, 50 and 100 currency units and two slots for 2, 20 and 200 currency units. This allows correct payment for every amount up to 499 currency units.
These 11 slots are ordered by coin size: 1, 2, 2, 10, 5, 20, 20, 100, 50, 200, 200
Here the communication protocol:
Here a full list of all device specific properties that can be changed via jpos.xml:
The simulator provides a coin dispenser with the following properties: Has one slot for 1, 5, 10, 50 and 100 currency units and two slots for 2, 20 and 200 currency units. This allows correct payment for every amount up to 499 currency units.
These 11 slots are ordered by coin size: 1, 2, 2, 10, 5, 20, 20, 100, 50, 200, 200
Here the communication protocol:
- Commands to simulator:
- R\n: Read coin count for all slots.
- A a b c d e f g h i j k\n: Add values a - k to the corresponding slots.
- O a b c d e f g h i j k\n: Subtract values a - k from the corresponding slots. All values must be 0 or 1
- Response from simulator:
- OK a b c d e f g h i j k\n: Operation successful, a - k are the current coin counts for the corresponding slots.
- KO\n: Operation failed. This may happen due to a jam condition.
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).
- ComPort: 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.
- 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.
- NearLimit: Minimum amount of coins in each slot. If one slot contains a lower number of coins, status will be reported as near empty. However, an empty status will only be reported if all slots are empty. Default: 2.
- PollTimeout: Minimum time between status requests, in milliseconds. Status requests will be used to monitor the device state. Default: 500.
- ReadArgumentCheck: Specifies whether the cashCounts argument of readCashCounts shall be used as a template for the result or be overwritten by a string that contains cashCount values for all slots. Default: false.
- RequestTimeout: Maximum time, in milliseconds, between sending a command to the simulator and getting the first byte of its response. Default: 200.
- SlotCapacity: The maximum number of coins that one single (simulated) hardware slot can hold. Default: 999.
-
Field Summary
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
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 valuegetCoinDispenserProperties(int index)
Returns device implementation of CoinDispenserProperties.void
run()
Thread main, used for status check loop while device is enabled.protected String[]
sendCommand(String command)
Method to perform any commandMethods 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, changeDefaults, checkScannerInit, coinAcceptorInit, coinDispenserInit, deviceMonitorInit, electronicJournalInit, electronicValueRWInit, fiscalPrinterInit, gateInit, gestureControlInit, getArrayOf, getBeltProperties, getBillAcceptorProperties, getBillDispenserProperties, getBiometricsProperties, getBumpBarProperties, getCashChangerProperties, getCashDrawerProperties, getCATProperties, getCheckScannerProperties, getCoinAcceptorProperties, getDeviceMonitorProperties, getElectronicJournalProperties, 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, removePropertySet, signalStatusWaits, stringArrayToLongArray, synchronizedMessageBox
-
Constructor Details
-
Device
Constructor. Stores port and baud rate- Parameters:
port
- COM port- Throws:
jpos.JposException
- If COM port is invalid
-
-
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 coin dispenser services.- Overrides:
changeDefaults
in classJposDevice
- Parameters:
props
- Property set for setting the property defaults
-
run
public void run()Thread main, used for status check loop while device is enabled. -
sendCommand
Method to perform any command- Parameters:
command
- Command data to be sent- Returns:
- Array of string components of response, null in error case.
-
getCoinDispenserProperties
Description copied from class:JposDevice
Returns device implementation of CoinDispenserProperties.- Overrides:
getCoinDispenserProperties
in classJposDevice
- Parameters:
index
- Device index, see constructor of JposCommonProperties.- Returns:
- Instance of CoinDispenserProperties that matches the requirements of the corresponding device service.
-