On 04/10/2010 07:17, Bo Berglund wrote:

Thanks for the suggestion! I have now installed the serial component
of the suite on my Ubuntu Lazarus.
As indicated there is an event for receiving the incoming data even
though that event does not tell how many characters are actually
available. So how do I know how many I can read in from the port?

You don't need to know. When you are in the OnRxData event if you call ReadData():

procedure TForm1.SdpoSerial1RxData(Sender: TObject);
var mess: string;
begin
  mess := SdpoSerial1.ReadData();
  ...
end;

It will return a string with all available bytes in the input buffer.

But there is one strange thing about the way the component works:
I can call the Open method for ttyS0 and there is no error even though
the ttyS0 does not exist...

I run my Ubuntu in a VMWare virtual machine and I had forgotten to add
a serial port to its hardware so there is definitely no such port and
yet there is no indication from the component that it has failed to
open the port.
How come?

Should there not be an exception raised if the wanted port does not
exist?

Yes. There is an exception that is raised when the open() call fails.

Paulo Costa

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to