dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 5 1234 ... LastLast
Results 1 to 15 of 66

Thread: Bill Acceptor Integration

  1. #1
    Join Date
    Feb 2019
    Posts
    34

    Post Bill Acceptor Integration

    Woking on MEI Bill acceptor integration having model number AE 2831 D10 E.
    But unable to get response from bill acceptor.

    Please guide me on this.

    Thanks

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,853

    Re: Bill Acceptor Integration

    Is this a java programming question?
    If it is, can you post the java code you are having problems with?
    Norm

  3. #3
    Join Date
    Feb 2019
    Posts
    34

    Re: Bill Acceptor Integration

    Quote Originally Posted by Norm View Post
    Is this a java programming question?
    If it is, can you post the java code you are having problems with?

    Yes, This is Java question. Below is code

    Code:
    package com;
    
    import gnu.io.CommPort;
    import gnu.io.CommPortIdentifier;
    import gnu.io.SerialPort;
    import gnu.io.SerialPortEvent;
    import gnu.io.SerialPortEventListener;
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    
    /**
     * This version of the TwoWaySerialComm example makes use of the 
     * SerialPortEventListener to avoid polling.
     *
     */
    public class TwoWaySerialComm
    {
        public TwoWaySerialComm()
        {
            super();
        }
        
        void connect ( String portName ) throws Exception
        {
            CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
            if ( portIdentifier.isCurrentlyOwned() )
            {
                System.out.println("Error: Port is currently in use");
            }
            else
            {
                CommPort commPort = portIdentifier.open(this.getClass().getName(),2000);
                
                if ( commPort instanceof SerialPort )
                {
                    SerialPort serialPort = (SerialPort) commPort;//BAUDRATE_9600
                    serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
                    
                    System.out.println("getParity() == "+serialPort.getParity()+"getName()=="+serialPort.getName());
                    
                    InputStream in = serialPort.getInputStream();
                    OutputStream out = serialPort.getOutputStream();
                    
                    System.out.println("input stream object :---"+in);
                    System.out.println("output stream object :--"+out);
                    
                    (new Thread(new SerialWriter(out))).start();
                    
                    System.out.println("listening................"+serialPort.getName());
                    serialPort.addEventListener(new SerialReader(in));
                    serialPort.notifyOnDataAvailable(true);
                    
    
                }
                else
                {
                    System.out.println("Error: Only serial ports are handled by this example.");
                }
            }     
        }
        
        /**
         * Handles the input coming from the serial port. A new line character
         * is treated as the end of a block in this example. 
         */
        public static class SerialReader implements SerialPortEventListener 
        {
            private InputStream in;
            private byte[] buffer = new byte[1024];
            
            public SerialReader ( InputStream in )
            {
                this.in = in;
            }
            
            public void serialEvent(SerialPortEvent arg0) {
                int data;
                
                System.out.println("event listner calling");
              
                try
                {
                    int len = 0;
                    while ( ( data = in.read()) > -1 )
                    {
                        if ( data == '\n' ) {
                            break;
                        }
                        buffer[len++] = (byte) data;
                    }
                    System.out.print(new String(buffer,0,len));
                }
                catch ( IOException e )
                {
                    e.printStackTrace();
                    System.exit(-1);
                }             
            }
    
        }
    
        /** */
        public static class SerialWriter implements Runnable 
        {
            OutputStream out;
            
            public SerialWriter ( OutputStream out )
            {
                this.out = out;
            }
            
            public void run ()
            {
                try
                {                System.out.println("calling thread");
                    int c = 0;
                    System.out.println("System.in.read() === "+System.in.read());
                    while ( ( c = System.in.read()) > -1 )
                    {
                        this.out.write(c);
                        System.out.println("in run method == "+this.out);
                    }                
                }
                catch ( IOException e )
                {
                    e.printStackTrace();
                    System.exit(-1);
                }            
            }
        }
        
    
        
        public static void main ( String[] args )
        {
            try
            {
                (new TwoWaySerialComm()).connect("COM5");
            }
            catch ( Exception e )
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    
    
    }
    Last edited by 2kaud; February 4th, 2019 at 01:03 PM. Reason: Added code tags

  4. #4
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,853

    Re: Bill Acceptor Integration

    Can you edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.

    Is this question about a connection between a PC and some device using a serial port? Are you sure the device is properly connected to the PC?

    Be sure that all the catch blocks have calls to the printStackTrace method so all errors are shown.
    Norm

  5. #5
    Join Date
    Feb 2019
    Posts
    34

    Re: Bill Acceptor Integration

    Yes the device is properly connected.
    Any command need to send to Bill acceptor to recieve pulses ?

  6. #6
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,853

    Re: Bill Acceptor Integration

    Is there any documentation for that device that describes the protocols for communications?
    Norm

  7. #7
    Join Date
    Feb 2019
    Posts
    34

    Re: Bill Acceptor Integration

    Yes, it works on EDBS protocol.

    skype Id:-manish.kumar9956

    Thanks

  8. #8
    Join Date
    Feb 2019
    Posts
    34

    Re: Bill Acceptor Integration

    sorry its EBDS protocol.

  9. #9
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,853

    Re: Bill Acceptor Integration

    Sorry, I don't know anything about that protocol. Can you post a description?

    Does the posted code follow that protocol? I don't see any comments in the code describing what it is supposed to do.

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    Norm

  10. #10
    Join Date
    Feb 2019
    Posts
    34

    Re: Bill Acceptor Integration

    Code is for serial port communication only.

    For better communication can we have a call right now.


    Thanks

  11. #11
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,853

    Re: Bill Acceptor Integration

    Where is the code for the EBDS protocol?
    What happens when the posted code is compiled and executed?
    Norm

  12. #12
    Join Date
    Feb 2019
    Posts
    34

    Re: Bill Acceptor Integration

    Hi Norm,

    Here am not working on EBDS protocol currently am just work on port where device is connected.

    This code works on event listener of port. If any thing happend on port where device is connected it give us output.
    Here am expecting when bill is inserted into bill acceptor it give me output on that particular port.
    But am not able to get any output or response from machine when any bill is inserted into it.
    If you have any idea please share with me.
    This task is very important to me.

    This is my number Contact no. +918146068144. Either you can message me on whats app me or simply call me.

    Thanks

  13. #13
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,853

    Re: Bill Acceptor Integration

    Sorry, I don't make calls.
    Norm

  14. #14
    Join Date
    Feb 2019
    Posts
    34

    Re: Bill Acceptor Integration

    Ok. No issue so lets continue here

  15. #15
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,853

    Re: Bill Acceptor Integration

    What happens when the code is compiled and executed?
    What is printed on the console window?
    Norm

Page 1 of 5 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)