Solved

Application with two Comport

Posted on 2003-11-20
3
364 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now