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
Printable View
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
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();
}
}
}
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.
Yes the device is properly connected.
Any command need to send to Bill acceptor to recieve pulses ?
Is there any documentation for that device that describes the protocols for communications?
Yes, it works on EDBS protocol.
skype Id:-manish.kumar9956
Thanks
sorry its EBDS protocol.
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.
Code is for serial port communication only.
For better communication can we have a call right now.
Thanks
Where is the code for the EBDS protocol?
What happens when the posted code is compiled and executed?
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
Sorry, I don't make calls.
Ok. No issue so lets continue here
What happens when the code is compiled and executed?
What is printed on the console window?