COM port communication

B

bharath_r

Hi,

I am developing a GPS data logging application, basically a windows
service where i read GPS data from the device and write it to a text
file. I use CreateFile function passing the port number as an
argument. The GPS device outputs the data every second. I want to
identify this event i.e., i want to read from the port only when the
GPS outputs the data. Currently my program is not in sync with the
device causing my program to read only a part of the data i.e., if the
device outputs 6 lines of data my program read only the first few
lines or the last few lines of the data. I want to synchronise my
program with the device. I want to read data only when it outputs the
data. Is there a way to do this. Is there an event which i can handle
when the device outputs the data?

Thanks
bharath
 
A

alan

Hi,

I am developing a GPS data logging application, basically a windows
service where i read GPS data from the device and write it to a text
file. I use CreateFile function passing the port number as an
argument. The GPS device outputs the data every second. I want to
identify this event i.e., i want to read from the port only when the
GPS outputs the data. Currently my program is not in sync with the
device causing my program to read only a part of the data i.e., if the
device outputs 6 lines of data my program read only the first few
lines or the last few lines of the data. I want to synchronise my
program with the device. I want to read data only when it outputs the
data. Is there a way to do this. Is there an event which i can handle
when the device outputs the data?
In case you were wondering, this is a group about C++ as the language,
itself, largely independently of the hardware it's running on. Sorry,
I don't know where to get this information either. For one, you might
prefer to ask groups related to, say, the operating system you are
using, which will be nearer to the hardware.
 
J

jebblue

In case you were wondering, this is a group about C++ as the language,
itself, largely independently of the hardware it's running on. Sorry, I
don't know where to get this information either. For one, you might
prefer to ask groups related to, say, the operating system you are
using, which will be nearer to the hardware.

Where is the C++ framework, like C# or Java?
 
J

jebblue

It is called the standard library and should be included with all
compliant compilers.

Fair enough as long as it contains a specified serial API (back to the OP
post which was the context in which I posted) like .NET (which is what I
should have said, not C#) or Java (the platform).

If you can show me that, I would be grateful as I do not wish to code
on .NET or Java any more than necessary.
 
A

Alf P. Steinbach

* jebblue:
Fair enough as long as it contains a specified serial API (back to the OP
post which was the context in which I posted) like .NET (which is what I
should have said, not C#) or Java (the platform).

If you can show me that, I would be grateful as I do not wish to code
on .NET or Java any more than necessary.

C++ doesn't have one standard framework, but one standard library
offering mainly "internal" functionality (the C++ standard library,
shipped with your compiler), one more-or-less de facto standard library
offering more of that sort (Boost), and many non-standard frameworks
offering system-specific functionality such as GUI, communication, etc.

This strategy gives access to machine and system dependent features
where needed. E.g., Java's framework is implemented in C and/or C++.
It is a philosophical question what's more portable: Java code, relying
at bottom on the portability of C and C++, but therefore in principle
portable without touching the code (as long as the VM and Java library
has been ported), or C and C++ code, which typically must be rewritten,
but provides the base portabity for most other languages.

In C++ you can and must choose a framework if you want or need one, but
I suggest you take a look at Poco, <url: http://www.appinf.com/poco/>
(also, of course, Boost and the standard C++ library).


Cheers, & hth.,

- Alf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top