简体   繁体   中英

How to detect signals at the serial COM1 port?

I have a infrared device (both transmitter and receiver). I've connected the receiver to the serial COM port and I send IR signals using the transmitter.

I'd like to monitor theese signals and whenever there is no signal, invoke another thread (sms sending code).

If I check the signals on hiperterminal, I get some unreadable values.

What should I look for as a NO CARRIER value to see if there is no data being recieved so I execute the second thread?

eg

if(signals!=null)
{
    //do nothin
} 
else
{
    //thread2();
}

First of all, you should read The Java comm API documentation .

Also, look at this code example .

We'd need more information as to help you with the exact implementation details of your IR reciever.

Head over to rxtx.org for a free serial port library for Java under Windows, Linux or OSX. All the details and sample code can be found in this WikiBook .

The section on events, like getting notifications on control signal changes, is here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM