Article View: borland.public.cppbuilder.nativeapi
Article #14437Re: Synchronization Problems....
From: Keneth Wagner
Date: Thu, 14 Aug 2003 06:40
Date: Thu, 14 Aug 2003 06:40
41 lines
3001 bytes
3001 bytes
Thanks Phuoc Can HUA for the answer. I already use a thread to read from
the serial port, and the timer solution ok, i took not that in count because
my problem is Wait inside a Function meanwhile an event is happening severla
times and a timer running at the same time. Maybe i forgoting something and
i can not see my problem (Maybe my logic is wrong) -
I have to do this:
- check how many serial port are availables in the computer (Done)
- Connect, Desconnect, Send to the serial Port (Done)
- Receive Bytes from the Port (Done - with a thread)
- Comunicate to the main window when i receive a message (Done, WM_USER
message)
- Check for an special dispositive in each port found (MY PORBLEM)
For make this i need to send a message trhoug the port. If a
dispositive is there, it can understand the message i sent and response
retruning the Firmware. I have to construct the complete string before make
the return of the function, so i need wait inside a function for construct
the string with several port reads and, when the firmware is correct, return
true or fale in order to know when in a port is a dispositive connected. I
have to wait for the "acknowledged message" but this gonna happen only with
an specific baudrate, so i have to test in each port sending the message
with 5 different baudrates. When a "defined wait Answer time" is gone i
have to test the next baudrate an so on. I can not see the way to wait :-).
I know is there (in some place). I can use a recursive function to check
the Baudrates, but i still need the way to make Connect-Send-Receive-Wait
inside the function who ask if any dispositive with that baudarate is in
that port.
bool isThere(Baudrate){
if(GetResponse()) // This is my problem
return true;
else
if(BaudRate <= TotalBaudrates)
return isThere(NextBaudRate)
return false;
}
Thanks again, if you have any comment, please let me know,.
Keneth.
Technical Details
Message-ID:
<3f3b2efc$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-05!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f3a0df1@newsgroups.borland.com> <oprtvd370vbq7az6@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,a4a10dc5e85235c0 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-14 00:09:57 PST From: "Keneth Wagner" <keneth.wagner@peak-system.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f3a0df1@newsgroups.borland.com> <oprtvd370vbq7az6@newsgroups.borland.com> Subject: Re: Synchronization Problems.... Date: Thu, 14 Aug 2003 08:40:06 +0200 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 213.157.9.171 Message-ID: <3f3b2efc$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1060843260 213.157.9.171 (13 Aug 2003 23:41:00 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-05!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail