Hi all,
I am in the process of redeveloping an application I once did in VB6.0. Back then I bought a component that accomplished the task I want to achieve in .NET now.
The application/module is quite simple, it reads SMS from a GSM device using serial port communication. I'll be using the SerialPort component available in VS2005, and this is how it works:
First I need to send a message to the device asking it if there are any messages in the inbox (I use AT commands for this), and herein lies the problem:
Since the communication is asynchronous I need to wait until the modem has replied with some data (text). Now I want to have a function in my component called i.e. GetMessages(), but how can I make the GetMessages() halt execution until data has been received on the serial port?
Can I i.e. use the DataReceived-event available from the serial port component, and what function do you suggest I use as a timeout check?
I am not looking for complete code from anyone here, but of course: If you have any pseudo-code I would be very grateful. If nothing else, if you will share your thoughts with me I am sure that it would be helpful as well!
Thanks in advance!
I am in the process of redeveloping an application I once did in VB6.0. Back then I bought a component that accomplished the task I want to achieve in .NET now.
The application/module is quite simple, it reads SMS from a GSM device using serial port communication. I'll be using the SerialPort component available in VS2005, and this is how it works:
First I need to send a message to the device asking it if there are any messages in the inbox (I use AT commands for this), and herein lies the problem:
Since the communication is asynchronous I need to wait until the modem has replied with some data (text). Now I want to have a function in my component called i.e. GetMessages(), but how can I make the GetMessages() halt execution until data has been received on the serial port?
Can I i.e. use the DataReceived-event available from the serial port component, and what function do you suggest I use as a timeout check?
I am not looking for complete code from anyone here, but of course: If you have any pseudo-code I would be very grateful. If nothing else, if you will share your thoughts with me I am sure that it would be helpful as well!
Thanks in advance!