Dec 22nd, 2024, 7:12am
Welcome, Guest. Please Login or Register.
Pages: 1  Reply Reply  Notify of replies Notify of replies  Print Print
   Author  Topic: Close procedure  (Read 4925 times)
Close procedure
on: Apr 12th, 2006, 10:58pm
Quote Quote  Modify Modify

I developed a GPS application written in Delphi but I have problems of communication with USB emulators. I Try Serial Port Control v1.4, it seems to work perfectly.  
 
I work with your example TinyTerm.I put a simple form with 2 buttons and a TMemo.  
 
With Button1, I send a sentence to the port where a GPS is connected. Parameters in Open procedure are 57600,N,8,1. If communication is OK, GPS answers a sentence with serial number.
 
With button2 I stop the test with a simple procedure called Stop_Test :
 
    FTSerialControl1.Close;
    TTY.Lines.Add('  Test finished...');
 
No problem... when i use button1 followed by button2. One second of delay and it's OK. If I call Stop_Test in FormClose evenment, same thing...
 
I have a problem when I want to close the port by program. Basically when I have anwser of GPS, I close the port. In a FTSerialControl1CommEvent procedure, I recover anwser of GPS and I call Stop_Test. When I make this, application is freezing... What is the right way to close the port by program ?
 
Many thanks. ( sorry for my bad english !!!)
IP Logged
Re: Close procedure
Reply #1 on: Apr 13th, 2006, 7:14am
Quote Quote  Modify Modify

You can not call blocking methods (like CLOSE or READ with non-zero Timeout parameter )  within FTSerialControl1CommEvent handler because that can cause deadlocks as in your case. We suggest you to close port outside of handler.
IP Logged

Andrew Scott

FabulaTech
===================
http://www.fabulatech.com
Re: Close procedure
Reply #2 on: Apr 13th, 2006, 8:28am
Quote Quote  Modify Modify

Thanks for this quick reply. I put a Close action in the formClose evenment. It's OK... We keep on test on PC with USB emultors.
IP Logged
Pages: 1  Reply Reply  Notify of replies Notify of replies  Print Print

Previous topic | Next topic
Online Talk to our
support team or
sales department.