Pages: 1 [2]   Go Down
Author Topic: Re-implementing serial monitor (serial read) C++  (Read 2709 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

C++, I'm using a PC with window 7 OS, and netbean or QT creator with the minGW compiler set.

Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 616
Posts: 49441
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I PM'ed you.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So am I right in thinking there is no simple way to only call a read byte function when a byte is present in the buffer to be read?

Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 616
Posts: 49441
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I looked at the SerialPort documentation for C#, and I don't see a method of determining whether there is data to read, or not.

On the other hand, the derivation path for SerialPort makes it just another stream reader, and stream readers know to stop when the stream is empty. There might be an eof() function somewhere in it's derivation path that you could use to see if you are at the end of the stream.

If you use a thread to read the port, it doesn't matter that the thread blocks waiting for data.
Logged

Pages: 1 [2]   Go Up
Jump to: