-
February 4th, 2019, 08:50 AM
#1
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
-
February 4th, 2019, 09:48 AM
#2
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
-
February 4th, 2019, 09:58 AM
#3
Re: Bill Acceptor Integration
Originally Posted by Norm
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
-
February 4th, 2019, 10:09 AM
#4
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
-
February 4th, 2019, 11:13 AM
#5
Re: Bill Acceptor Integration
Yes the device is properly connected.
Any command need to send to Bill acceptor to recieve pulses ?
-
February 4th, 2019, 11:42 AM
#6
Re: Bill Acceptor Integration
Is there any documentation for that device that describes the protocols for communications?
Norm
-
February 4th, 2019, 11:55 AM
#7
Re: Bill Acceptor Integration
Yes, it works on EDBS protocol.
skype Id:-manish.kumar9956
Thanks
-
February 4th, 2019, 11:56 AM
#8
Re: Bill Acceptor Integration
-
February 4th, 2019, 12:34 PM
#9
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
-
February 4th, 2019, 12:45 PM
#10
Re: Bill Acceptor Integration
Code is for serial port communication only.
For better communication can we have a call right now.
Thanks
-
February 4th, 2019, 01:52 PM
#11
Re: Bill Acceptor Integration
Where is the code for the EBDS protocol?
What happens when the posted code is compiled and executed?
Norm
-
February 4th, 2019, 02:14 PM
#12
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
-
February 4th, 2019, 02:27 PM
#13
Re: Bill Acceptor Integration
Sorry, I don't make calls.
Norm
-
February 5th, 2019, 04:30 AM
#14
Re: Bill Acceptor Integration
Ok. No issue so lets continue here
-
February 5th, 2019, 06:37 AM
#15
Re: Bill Acceptor Integration
What happens when the code is compiled and executed?
What is printed on the console window?
Norm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|