Solved

Application with two Comport

Posted on 2003-11-20
3
385 Views
Last Modified: 2010-04-01
Hi,

I would like to open two Comport in my Borland C++ Builder 6 programme to communicate with a GPS receiver for receive and a GSM module for send and receive data. Actually I have realised the GPS comport with a Thread who manages the incoming data(ASCII). This part works fine.

How can I add the second comport? Can I use the existing thread to receive and send data or do I need a second thread? If yes how can I do it? I guess multitreading is not that easy!!!

I have downloaded the Comport component from http://www.winsoft.sk. I think I can do all this with it? Is there anything I should think about it before I start?

Thanks,
Ronald

 
0
Comment
Question by:rsch1973
3 Comments
 
LVL 13

Assisted Solution

by:SteH
SteH earned 75 total points
ID: 9786050
If you realised the GPS with a thread I understand that you already have an additional thread for this purpose. Plus the main thread gives 2 threads: you are multithreading already. Adding another thread is not too difficult then. I would go that way unless you need some execution order fro GPS and GSM. In that case a single thread for both of them could be easier.

No idea about the last option. I wrote serial communications myself. Have you done your attempt with that component already?
0
 
LVL 16

Assisted Solution

by:George Tokas
George Tokas earned 75 total points
ID: 9786062
Using the  Comport component you can use 2,3,4,5.... comports and control them indepentently.
there are some examples along with the component.
Initialization is very easy...
try it first using both your comports connected and send/receive ASCII data..
After that communication with the modems will be easy...

gtokas.
0
 

Accepted Solution

by:
jayesh_j_patel earned 100 total points
ID: 9786868
It is better idea to keep same thread for sending data also. So you can synchronize incoming and outgoing data when ever you needed. Generally it is a same comport to send and recieve the data, I mean duplex or half duplex. But as you said you have two different comport to get and send data. So just open another comport with proper details and handle send and recieve with two different handles in the same thread.
Hope will help
Jayesh
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question