Author Topic: Polling cash drawer status or reading from COM port periodically  (Read 10737 times)

DQ

  • Jr. Member
  • **
  • Posts: 82
Polling cash drawer status or reading from COM port periodically
« on: February 28, 2013, 07:42:59 pm »
Hello,
  I want to implement functionality where SambaPOS should not allow to take orders if cash drawer status.
I created a trigger with 1 minute timer and display a message to close the cash drawer which is fine.

Is there any generic action to read from specific serial port? If not what is the best way to implement?

emre

  • SambaPOS Developer
  • Samba Team
  • Hero Member
  • *****
  • Posts: 1564
Re: Polling cash drawer status or reading from COM port periodically
« Reply #1 on: March 01, 2013, 12:27:11 am »
I don't think generic cash drawers does that but if it is possible I'll be happy to learn how.

rvandam

  • Jr. Member
  • **
  • Posts: 96
Re: Polling cash drawer status or reading from COM port periodically
« Reply #2 on: March 01, 2013, 12:10:01 pm »
Reading the status of a serial port would be a nice feature of Sambapos. For example it would make it possible to check the status of serial printers and do so action when a printer is not reachable.

On this site they sell an Epson cash drawer which claims to have an open/close detection: http://barcodescannersdiscount.com/epcadrvali.html No idea how it works....

DQ

  • Jr. Member
  • **
  • Posts: 82
Re: Polling cash drawer status or reading from COM port periodically
« Reply #3 on: March 01, 2013, 10:08:42 pm »
Hi Emre,
  See the IBM SurePOS 500/600 Reference manual (Page 65): ftp://ftp.software.ibm.com/software/retail/pubs/hw/4840/blp2mst.pdf

In  IBM Cash Drawer, by sending <XCT 07> in Header Template (COM4 serial port), I am able to open the cash drawer 1. What I want is trigger a timer for 1 minute and when timer expires, check cash drawer status by sending <XCT 06> and read a byte from  serial port (COM4)  and see if bit 6 is 1, if it is 1 means cash drawer is open.  If it is open, display a message asking user to close the cash drawer. Once it is closed, the message should disappear.

Copied below details from page 65.

Open cash drawer 1 : 07
Purpose"  To open cash drawer 1, use the command (07), which sends an ASCII
Bell character to the character-display serial port.

Open cash drawer 2 : 1B 07
Purpose:
To open cash drawer 2, use the 2-byte sequence (1B 07) , which sends an
Escape character followed by an ASCII Bell character to the character
display serial port.

Read cash-drawer status : 06
Purpose: To obtain status information for cash drawers, use the command (06),
which sends an ASCII ACK character to the character display serial port.
See “CD status byte format” for a description of the cash-drawer status
byte.

Unsolicited cash-drawer status : 1B 06
Purpose: To toggle the unsolicited cash-drawer status function on or off, use the
following 2-byte sequence(1B 06), which sends an Escape character followed by
an ASCII Ack character to the character-display serial port.

 The default setting is OFF. If the unsolicited status function is ON, the system checks
cash drawer status approximately every 500 ms. Any status change causes
the return of the status byte. Also, if unsolicited status is on, sending an
Open command causes the cash drawer to return a status byte. See “CD
status byte format” for a description of the status byte.

CD status byte format
CD1 CD1/CD2 Status Byte

Bit 7 Always a 0, for compatibility

Bit 6 Cash drawer 1 sensor
v ’1’ = Cash drawer 1 open (if connected)
v ’0’ = Cash drawer 1 closed
December 7, 2001 Input/output device commands
Chapter 7. Input/output devices and commands 65CD1 CD1/CD2 Status Byte

Bit 5 Cash drawer 2 sensor
v ’1’ = Cash drawer 2 open (if connected)
v ’0’ = Cash drawer 2 closed

Bit 4 Cash drawer 1 present indicator
v ’1’ = Cash drawer 1 is present
v ’0’ = Cash drawer 1 is not present

Bit 3 Cash drawer 2 present indicator
v ’1’ = Cash drawer 2 is present
v ’0’ = Cash drawer 2 is not present

Bit 2 Unsolicited status function state
v ’1’ = Unsolicited status function is currently ON
v ’0’ = Unsolicited status function is currently OFF

Bit 1 Reserved always 0 for compatibility

Bit 0 Reserved always 0 for compatibility

Purpose:
To obtain status information format for a cash drawer, send read status
command. The system also supports unsolicited cash drawer status.

emre

  • SambaPOS Developer
  • Samba Team
  • Hero Member
  • *****
  • Posts: 1564
Re: Polling cash drawer status or reading from COM port periodically
« Reply #4 on: March 02, 2013, 12:05:06 pm »
Hello, I've created a V3 issue about this.
https://github.com/emreeren/SambaPOS-3/issues/128

Thank you for the documentation.