Archive

Archive for August 29, 2009

MEI Cash Acceptor with Bunch Note Feeder

August 29, 2009 Abhijeet Iraj Leave a comment

Frankly speaking i had never used cash acceptor in my life since in India that technology is not used much. But recently i got a chance to integrate MEI CASHFLOW® SC Series note acceptor with BNF in our system at work and it was really a nice experience. This is one of the world’s most technically advanced cash acceptor.

Cash Acceptor

Because of bunch note feeder (BNF) user can deposit cash more efficiently by placing a bundle of up to 30 notes into a BNF.

Before starting integration, one thing which was really important was to change MEI Cash Acceptor from Stand-Alone mode to EBDS mode. In Stand-Alone mode the communication between the SC and API will not work.

Integration using MEI provided java api was straightforward..

/**
 * @author airaj
 *
 */
public class MEICashAcceptor extends CashAcceptor
                                           implements AcceptorEventListener
{
    // serial port to which device is connected
    private String serialPort = "/dev/ttyS3";

    private Acceptor cashAcceptor = null;

    // connect to the device
    public void connect()
    {
        cashAcceptor = new Acceptor();
        cashAcceptor.addAcceptorEventListener(this);
        Acceptor.listPorts();
        try
        {
            cashAcceptor.open(serialPort, PowerUp.A);
        }
        catch (AcceptorException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    // enable acceptor so that it accepts bills
    public void enable()
    {
        cashAcceptor.setEnableAcceptance(true);
    }

    // disable acceptor so that it stops accepting bills
    public void disable()
    {
        cashAcceptor.setEnableAcceptance(false);
    }

    // This method gets called when any device event occurs
    public void acceptorEventOccurred(AcceptorEvent evt)
    {
        if (evt.getDescription() == null)
        {
            return;
        }
        if (evt instanceof EscrowEvent)
        {
            // Event generated for bill Escrow
            if (DocumentType.Bill.equals(cashAcceptor.getDocType()))
            {
                Bill b = cashAcceptor.getBill();
                try
                {
                    // stack the bill
                    cashAcceptor.escrowStack();
                }
                catch (AcceptorException e)
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
        else if (evt instanceof StackedEvent)
        {
            // Event generated when a document is stacked.
            if (DocumentType.Bill.equals(cashAcceptor.getDocType()))
            {
                Bill bill = cashAcceptor.getBill();
                String country  = bill.getCountry();
                String value = bill.getValue();
            }
        }
        else if (evt instanceof CheatedEvent)
        {
             // Event generated when the device detects a cheat attempt.
        }
        else if (evt instanceof JamDetectedEvent)
        {
            // Event generated when the device detects a jam.
        }
        else if (evt instanceof StackerFullEvent)
        {
            // Event generated when the device stacker is full.
        }
    }

}

You can view MEI CASHFLOW Bill acceptor with BNF demo here