Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

QlabIbm4694 Class Reference
[CashboxdriversIBM]

#include <qlabibm4694.h>

Inheritance diagram for QlabIbm4694:

QlabCashboxInterfaceDefinition List of all members.

Detailed Description

The QlabIbm4694 provides an abstract view of IBM 4694 hardware. The goal is providing a widget like view as seen by application logic class.

Hardware abstraction is not really easy, specifically when we have to deal with non standard hardware.

One has to map whatever can happen to something able to send signals to connected widgets and slots that interact naturally with various hardware pieces.

This version is by no ways a definitive one. Some parts of the abstraction could not be built as I did not have the needed hardware for, namely scale and fiscal printers.

You might have to create in child class for Fiscal Printers as capabilities and management depend harshly on each and every country laws and usages.

Todo:
Add more test cases, prefilter scanner data and format them...
A sample of usage is included in qlabibmcashbox.cpp sample application which describes a full fledged skeleton for IBM 4694 cashbox hardware.

Public Slots

Public Member Functions

Protected Slots

Private Member Functions

Private Attributes


Constructor & Destructor Documentation

QlabIbm4694::QlabIbm4694 QlabCashboxInterfaceDefinition parent = 0,
char *  name = 0
 

Creates a new instance of QlabIbm4694 owned by parent with name name

QlabIbm4694::~QlabIbm4694  ) 
 

Deletes the instance


Member Function Documentation

ActivePrintDevice QlabIbm4694::activePrinter  )  const [virtual, slot]
 

Return the active printer.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::clearScreen int  dev  )  [virtual, slot]
 

nCurses ClearScreen emulation for device dev

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::closeAll  )  [virtual, slot]
 

Close All opened devices

This Method _MUST_ be called before shutting down POS software

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::closeDevice int  dev  )  [virtual, slot]
 

Closes device named device

Note:
This method only closes the named device. Names are integer values which depend on the descriptive defines. See note in header file.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::deviceStatus POSQMSG *  pMsg  )  [private]
 

For internal use only.

Process device Status Online & offline messages

void QlabIbm4694::displayFullScreen int  dev,
const QString &  msg,
int  cursor = 0
[virtual, slot]
 

Display in full screen emulation Write msg on device dev starting at cursor pos cursor

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::displayItemRight int  dev,
const QString &  msg,
int  lineno = 1
[virtual, slot]
 

Displays msg on device dev at line lineno.

Note:
Even if lineno can be 0 to number of lines, some displays do weird things when we use line 0. Try and adjust your UI to the hardware.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::displayString int  dev,
const QString &  msg,
int  cursor = 0
[virtual, slot]
 

Displays string msg on display & dev at position cursor

Warning: This tries to emulate nCurses, but the displays don't really do what we need. The only safe cursors are 0 and 20. Others may lead to inconsistencies, depending on display versions and release levels.

Reimplemented from QlabCashboxInterfaceDefinition.

long QlabIbm4694::drawerStatus  )  [virtual, slot]
 

Returns current Cash Drawer Status

Reimplemented from QlabCashboxInterfaceDefinition.

QString QlabIbm4694::evalPrintLine const QString &  line,
bool  withdash = FALSE
[virtual, slot]
 

Evaluates the print line and returns a converted version.

allows for dashing the message.

Todo:
Revamp the thing to have it more efficient and implement more XML tags.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::exec  )  [virtual]
 

Starts the event management loop for the hardware.

This is a hardware replica of Dialog behaviour in graphics mode. While the loop stays alive, we scan the messages and send signals when we need them.

An in depth explanation of message loops and message queues can be found in Qt documentation. This is only a Dialog rewrite in a non graphics model. The POSM_ stuff comes from IBM documentation, sorry...

Reimplemented from QlabCashboxInterfaceDefinition.

QStringList QlabIbm4694::features  )  [virtual, slot]
 

Returns cashbox available features.

The available feature list is left to implementor's choice.

The preconized style for the list is (note: no QStringList declaration, only a result):

                OperatorDisplay_YES
                CustomerDisplay_YES
                CustomerReceiptPrinter_YES
                DocumentInsertPrinter_NO
                CheckPrinter_NO
                Scanner_YES
                MagneticStripReader_NO
                ElectronicPayment_NO
                FlyingSaucerGenerator_YES
                AlienFood_YES

and so on for all features.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::initDevices  )  [private, virtual]
 

For internal use only.

This is only called by constructor.

One should never try to call this by other means as this would reset the deviceList parameters and you would have to rescan all the devices.

Reimplemented from QlabCashboxInterfaceDefinition.

long QlabIbm4694::keyboardSupervisorStatus  )  [virtual, slot]
 

Returns the Keyboard Supervisor Key Status.

It's up to implementor to do the real thing with this.

Sample Implementation Code:

long QlabIbm4694::keyboardSupervisorStatus()
{
        PosArg args ;
        device d = deviceList[KEYBOARD] ;
        if ( d.descriptor > 0 ) {
                args.name  = PosNkeyLock ;
                args.value = 0 ;
                if ( PosIOCtl( d.descriptor, POS_SYS_GET_VALUES, &args, 1) == -1) {
                        emit deviceError( PosErrno(), SeverityWarning,
                                                   QString( tr( "Device Error: Keyboard Error: %1" ) )
                                                   .arg( GetTableEntry( ErrnoTable, PosErrno() ) ) ) ;
                        return 0 ;
                }
        }
        return args.value ;
}

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::lockDevice int  dev  )  [virtual, slot]
 

Try to grab a lock on device dev.

Note:
Locking is useful when dealing with scanners to prevent some very difficult to track data injection when using keyboard as input device. Never forget to unlock a locked device when locking is no more mandatory.
Be warned: some devices do not honour this request. They can still emit data or allow input... However, you can test the error bit in the device data and reject them.

Reimplemented from QlabCashboxInterfaceDefinition.

int QlabIbm4694::openAndAcquire int  dev,
PosArgPtr  args,
int  nargs
[protected, slot]
 

For internal use only.

Opens and Acquires a device dev with arguments args and a number of args nargs.

As this uses the POSQMSG structure which is NEVER exported, you should not try to access this from outer classes!!! Only called by openDevice Protected method.

void QlabIbm4694::openCashDrawer  )  [virtual, slot]
 

Opens cash drawer

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::openDevice POSQMSG *  pMsg  )  [protected, slot]
 

Opens the device posted to us by the Message Queue

This is a huge method implementing most of (huge and indigest [hai]) IBM Reference Manual. Device information is stored in the deviceList Map. Sorry, but if you want to understand what's done inside, you'll have to read the hai booklet.

Note:
Fiscal printers not implemented as such beast are mainly country dependant and do not work the same from country to other.

long QlabIbm4694::printerStatus  )  [virtual, slot]
 

Returns current printer status

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::printLine const QString &  li  )  [virtual, slot]
 

Print a line li to current Printer

Note:
You can embed a subset of XML tags in the line source. This is evalled here and replaced by whatever the *~#]] printer wants.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::printText const QString &  txt  )  [virtual, slot]
 

Prints text stream txt to currentPrinter

This is a wrapper to printLine() method allowing to pass full text.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::processCharacterMessage POSQMSG *  qmsg  )  [private]
 

For internal use only.

Internal Message Processor for events from keyboard.

void QlabIbm4694::processChaseComplete  )  [private, virtual]
 

Chase process completed. This means we are ready for a new ticket

Reimplemented from QlabCashboxInterfaceDefinition.

QString QlabIbm4694::processMsrData  )  [private, virtual]
 

Returns MSR data.

Note that the event manager uses this when queing. Thus, an outside world call will always return a blank string.

You access to the real data by connecting to MSRdataAvailable() signal which returns real data.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::processPrinterData POSQMSG *  qmsg  )  [private]
 

Processes data sent by the printer. This is not so linear.

void QlabIbm4694::processPrinterError POSQMSG *  qmsg  )  [private]
 

Error recovery routine for printer errors

void QlabIbm4694::processPrinterStatus POSQMSG *  qmsg  )  [private]
 

For internal use only.

Process printerStatus messages.

This is mainly used to follow DI printing & check printing As many steps are required, we have to handle a bunch of status changes.

void QlabIbm4694::processScannerData  )  [private, virtual]
 

Scanner data available. Must process and release scanner

Note:
Some scanner samples refused to unlock. Could not determine if this si due to scanner or aip.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::processTillClosed long *  till_open_tm  )  [private, virtual]
 

For internal use only.

Received drawer close message

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::processTillOpened long *  till_open_tm  )  [private, virtual]
 

For internal use only.

Received drawer open message

Reimplemented from QlabCashboxInterfaceDefinition.

QString QlabIbm4694::readMicr long  size  )  [protected, virtual, slot]
 

Reads MICR data.

On failure, posts an error and returns an empty string.

Reimplemented from QlabCashboxInterfaceDefinition.

QString QlabIbm4694::readScannerData  )  [protected, virtual, slot]
 

Returns Scanner data.

Note that the event manager uses this when queing. Thus, an outside world call will always return a blank string.

You access to the real data by connecting to scannerDataAvailable() signal which returns real data.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::releaseAll  )  [virtual, slot]
 

Releases all locked devices.

This method _MUST_ be called before closeAll() If not released, the close may fail. If the app closes without closing devices, a concurrent app could crash on startup.

Reimplemented from QlabCashboxInterfaceDefinition.

bool QlabIbm4694::selectFullPage  )  [virtual, slot]
 

Sets printing to Document Insert device

Reimplemented from QlabCashboxInterfaceDefinition.

bool QlabIbm4694::selectRollPaper  )  [virtual, slot]
 

Sets printing to Roll paper Customer Receipt

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::setActivePrinter ActivePrintDevice  prn  )  [slot]
 

Sets the active Printer to device prn.

void QlabIbm4694::setCheckoutNumpadStyle int  dev  )  [protected, slot]
 

For internal use only.

Numpad Style manager used only my the Checkout style keyboard

PRIVATE use only. Don't even try to access this from outside.

void QlabIbm4694::setup  )  [virtual]
 

Sets up everything for normal use.

This method must be called before starting the exec() event loop. It mainly checks all hardware, opens and acquires devices and reports hardware failures...

Note:
This makes heavy use of IBM predifined constants. Please refer to the IBM reference manual to understand the quirks and drops here.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::soundError  )  [virtual, slot]
 

Default Error Beep

Long high pitch tone

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::soundReject  )  [virtual, slot]
 

Default Reject beep

MidTime low pitch tone

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::soundTone int  frequency = PosMEDIUM,
int  duration = 10,
int  volume = PosLOW
[virtual, slot]
 

Sounds some beeps qualifies by frequency, duration and volume.

Note:
  • frequency _MUST_ be only one of PosLOW, PosMEDIUM or PosHIGH
  • Duration is in 1/10th seconds
  • Volume is PosLOW or PosHIGH
This hardware does not support discrete values and thus prevents us from using melodic tones. This buzzer is by no way a HI-FI device!

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::soundWarning  )  [virtual, slot]
 

Default warning beep

Short Medium Pitch tone

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::unlockDevice int  dev  )  [virtual, slot]
 

Unlock eventually locked device dev

Note:
This is MANDATORY for scanner.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::waitForDrawerClosed  )  [virtual, slot]
 

Wait for the user closing Drawer

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::writeToCRandSJstations const QString &  buffer  )  [virtual, slot]
 

Used to write to CR and SJ station the buffer text

Used by most printers except the 4610 series. Defining 2 methods is mandatory due to some inconsistencies in IBM aip driver. One should consider rewriting a really coherent aip. But this is a heavy task cause aip was never opened by IBM.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::writeToCRstation const QString &  line  )  [virtual, slot]
 

Used to write to CR station the line text

This is needed cause 4610 printers to not have SJ printing. CR+SJ must be implemented in different ways as 4610 printer does not discard SJ queries.

Reimplemented from QlabCashboxInterfaceDefinition.

void QlabIbm4694::writeToDIstation const QString &  buffer  )  [virtual, slot]
 

Write the buffer to the DI Station

One should consider making this more efficient. The DI interface is very confusing in aip driver.

Reimplemented from QlabCashboxInterfaceDefinition.


Member Data Documentation

QString QlabIbm4694::p4610FlipCheck [private]
 

Temporary only for devel prurposes. Will disappear soon.

For internal use only.

QString QlabIbm4694::p4610ReadMicrInfo [private]
 

Temporary only for devel prurposes. Will disappear soon.

For internal use only.

QString QlabIbm4694::p4610RegisterDocument [private]
 

Temporary only for devel prurposes. Will disappear soon.

For internal use only.

QString QlabIbm4694::p4610ReleaseDocument [private]
 

Temporary only for devel prurposes. Will disappear soon.

For internal use only.

POSQMSG QlabIbm4694::qmsg [private]
 

Handle to Message from internal queue.

For internal use only.

 

L.A.B. Project © 2001-2004 LAB Project & DJ Anubis