views:

272

answers:

2

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?

e.g

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

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

fvu
+1  A: 

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.

voyager
thank u...wat more info.???wil u plz specify....am new to java!
@unknown - I think you need to work on your communication skills before moving onto another language. Sorry, but your shorthand typing is something that doesn't belong in a professional programming community.
Rob Hruska
i dont want the code to choose the port...i wat the code to read signals coming at a particular port.thnx
sorry mr.rob!actually my net is slow and i make up for it using shorthand,but wat you said is very true and i apologise for being so irrisponsible and thank you for making m aware.thank you very much.
@unknown have you at least checked the link I gave in my reply and especially the freshly added pointer to the section on event-driven communication?
fvu
yes sir,fvu. i am trying to go through it and i will see if i can get the desired information from the link you have provided.will be back here soon after two more days,i am having exams from tomorrow.thank you.
@unknown - good luck with the exams!
fvu