How could java sending data to 7segment display directly - java

I'm new to embedded systems,
could i send data from java application on my pc to serial 7 segment display direct via serial port or i have to use micro-controller in between

"TTL serial communication" probably means the same protocol used by a PC serial port, but at a different voltage.
You will be able to connect it to a serial port if you use a level shifter in between to convert the voltages. Search for "MAX232" chips, which are designed to do exactly this. There will be a bit of wiring involved. For more help with this part, try https://electronics.stackexchange.com/
On the software side, I don't know if Java has a way to access serial ports. There is probably a 3rd-party library to do this, but C might be better-suited anyway.

Related

Write my own packet monitor

I am using an application called Splunk, which has 2 layers of data processing on separate systems. I can connect to both systems via putty and directly logging into the GUI.
Archiecture of the system attached
I want to monitor the output port on layer 1, and input port on layer 2 and find out the below information,
i. Raw data sent out of layer 1
ii. Raw data received into layer 2.
The two layers communicate using tcp.
I do not want to use an existing packet monitors/packet capture like tcpdump or winshark as I want to heavily customize the monitor to display various information. I want to write my own packet monitor in java
I want to know,
If layer 2 is listening to layer 1, can my program connect to the same port and print the raw text being sent? - the protocol is TCP
Is (1) possible for other protocols like udp, http and ftp?
(EDIT: Architecture attached
Info on the systems in case it is relevant,
system 1 is VMWare(Linux Ubuntu 4.4.10) running on a Windows machine.
System 2 is mac os.
Both systems have different IP addresses. I am connecting to both systems from the windows machine where vmware is running.
The two systems connect to the same wifi.
)
There are some packet capture libraries written in Java, jpcap, jNetPcap, and Pcap4J.
Both #1 and #2 are possible by these libraries, I think.
If you would pick Pcap4J I can help you. It's my library.

Specify COM port file in java

In Unix like operating systems, we can access serial ports through files such as /dev/ttyUSB0 or something. And according to this question, filenames such as COM1: can be used to access the serial ports. What is the java alternative for such file names? I don't want to use Serial Communication liberaries.
Edit
What I want my code to look like is this.
String INPUT_PORT_FILE_NAME = linux?"/dev/ttyUSB0":"<File name of comport>"
File in = new File(INPUT_PORT_FILE_NAME)
What I want is the widows alternative to a device file.
EDIT
I am on a linux machine, and I want to enable my code to be ported easily!
Yes, on Linux there is access to serial port for instance through device files /dev/ttyS0, /dev/ttyUSB0 and others. It really depends on hardware/chips used to communicate and even distributions.
If same hardware is used in your program it can be partly achieved. When I worked with Serial Comm libraries and real physical serial ports in Linux I used port numbers in config so number 3 meant n=3, so opens "COM"+(1+n) on windows or "/dev/ttyS"+n on linux. Maybe similar can be used for you to accessing port on /dev/ttyUSB"+n
But there is no grantee that port 2 will be /dev/ttyS1 and COM2 on the same computer after dual boot.
The way not using Serial Comm libraries is hard way and do not recommend it if you want portability in java. I recommend different port config depending on operating system.

ASTM 1381-02 Serial Interfacing with Medical Lab equipment

Has anybody successfully interfaced Medical Lab devices like Cell Counters /ABG instruments to mirth connect using ASTM 1381-02 or similar protocols over serial port. I am working on a small project. I need the data transmitted by the machine in ASTM format to a text file/ to a database and I cannot afford to pay $30000 for mirth commercial support. I need a low cost or open source solution.
I was expecting MLLP listener to be off use but it seems to work with TCP and I have to make it work purely on serial communication.
Secondly
I tried writing ASTM serial data receiver in Java. But control characters such as ACK, STX, ETX, ETB, and other delimiters are not visible in terminals be it in Win 7 cmd or Netbeans/Eclipse console. Making me helpless in parsing the data.
Any help will in right direction be deeply appreciated.
If you are under Linux environment you may use COM port redirector to a given TCP port and use Mirth's TCP Listener to intercept that flow.
E.g., to pipe the serial port through netcat:
netcat ipaddress port < /dev/ttyS0
Or using socat:
socat pty,link=/dev/virtualcom0,raw tcp:ipaddress:port&
(check for correct parameters)
I recognize 2 problems:
First, is it possible to raise an ftp service on the windows PC? if so, you only need to create a file reader addressed to ftp to capture the txt with the ASTM.
Second, to determine the characters of start and end of message I recommend you read the information of the provider, if you do not have it available, I suggest you use notepad ++ to see the hidden features. I hope you help.
Just FYI there is a commercial extension available that provides ASTM E1381 support: https://www.nextgen.com/products-and-services/integration-engine?extension=astm-transmission

Reading remote control signals from java application

Can I write a java application that uses RxTxComm
to get signals from a remote control send to my serial receiver?
I have a RS-232 receiver I am listening on that com port for incoming bytes.
When I press any button on my remote control I don't see any data arriving to my serial port.
What am I missing here?
Should I see any data?
How does lirc do it ?
It is sovled here: http://commjava.blogspot.com/ have a look at it. (Be aware that they use proprietary third party code)
Lirc is not in java, their solution won't help you.

Java TCP Socket Sniffing

I am using TCP sockets to communicate data between a server and client program using a specific port number on the same computer (localhost).
I need a software that can capture the data being sent/received through that socket?
(or)
What's the simplest way of sniffing packets from a specified port in Java?
I suggest using Wireshark. It's easy to use and runs on many platforms.
http://www.wireshark.org/
If you are up to some coding (and not just running the wireshark/tcpdump) then you have few choices. If you want stick to Java, then the only (?) option to use raw sockets is via JNI and there are few libraries that can help, for example:
jNetPcap - wrapper around the native libpcap/winpcap libraries, exposing all of their functions and structures
RockSaw - API for using raw sockets
The easiest way is to replace the InputStream/OutputStream from a socket in one of the programs with a proxy implementation, that either prints/logs or "tees" to the original and a print/log stream.
But there's plenty of sniffers out there if you really want to get messy.
If you don't mind getting down and dirty with the command line you could try netcat.
It'll let you listen on a port and dump the output to a file if you like.
You can also make it send fake data and record the response.
I often use it as a pretend HTTP proxy (and configure Firefox to use it) to discover what is being sent over the wire.
Tcpdump can also be used directly, if the volume of traffic is not high, obviating the need to use wireshark. Just something like
tcpdump -ni lo0 port 1234
should be all you need (lo0 is the loopback interface on all Unix/Linux systems; also change the port number of course).
Run your program like so:
java -Djavax.net.debug=all helloworld.java
The switch is fully documented on the Oracle JSSE page
Pros:
Much simpler than other suggested solutions (requires no external software)
Can also decrypt/dump TLS/SSL connections :)
Cons:
This will only work if you are using classes from java.net.* e.g. OutputStream or InputStream This will not work if you're using raw sockets. This is documented in the link.
Believe this may only work on the Oracle JDK.
You can use tcpdump that gives you a variety of options. You save the capture in a .pcap file with the -w option and when you are done you open that file with wireshark. The advantage of this way is that you can capture a high rate of packets per second without affecting the overall performance of your pc (even if it is low end).

Categories