Integrating a hardware with Java



Integrating a POLE DISPLAY / CUSTOMER DISPLAY(Hardware) with your JAVA code

Generally speaking, when we need to integrate any hardware with our program, we need to have some driver software to be installed. But when we are developing the application then our application should have the necessary libraries to interact with the hard ware.

Here i am speaking about, connecting a device
(Customer / Pole Display) through a Serial port.

This is a USB Type Device, which is accessed using the serial port.
Through ports like, COM1, COM2 etc on windows.
 /dev/ttyS0 , /dev/ttyS1 etc on Linux.
for Mac.
For JAVA applications, we use jar file of rxtx which provides some library
functions . And also some system library files (.dll , .so files).

You can download the JAR file and some system libraries from the following link:
http://rxtx.qbang.org/wiki/index.php/Download

In the downloaded package you have the jar file, that you may add along the library in Eclipse(Java IDE).
the other library files to be placed are specified in the readme.txt file.
  
 How to do 

1 . Pole Display - Customer Display

Also Refer

Setup

Installing the driver file
For Windows machine, you may need to put the the librxtxSerial.dll file in the folders:
jdk1.6/bin/
jre/bin
For Linux machine, you may need to put the the librxtxSerial.so file in the folders:

    Checking the PORT No
    In windows machine, You may go to Device manager, and the PoleDisplay (Posiflex) will
be shown under PORTS
.

           



Select Posiflex PD2800 & go to properties- > Port Setting tab -> click advanced button, as shown in fig below


According to the image above, the device is connected to Com Port 1, “COM1”.
So our program also should connect to COM1.



Description
For running the PoleDisplay we are using the java files in poledisplay package.
    /client/src/org/compiere/pos/poledisplay/sod

  • The “PoleDisplayApp.java” is the class file used for displaying the data on the PoleDisplay.It contails the functions to display data on the PoleDisplay on different situations.
  • It imports the following packages-
    • import gnu.io.CommPort;
    • import gnu.io.CommPortIdentifier;
    • import gnu.io.SerialPort;
  • These class files are obtained from the jar file RXTXcomm.jar from the download link

No comments

Thanks for viewing the blog post. Follow the blog to receive the updates.. Powered by Blogger.