Recent

Author Topic: TLazSerial : serial port component for Lazarus (windows and linux).  (Read 344610 times)

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #75 on: July 31, 2014, 05:07:09 pm »
http://ctrlterm.com/ might be a good place to learn?
Regards,
Paul Breneman
www.ControlPascal.com

laskov

  • Newbie
  • Posts: 3
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #76 on: September 26, 2014, 09:18:33 am »
Hello everybody,

Is it possible to make console application with TLazSerial and if yes,
 1. what must be in Uses? (interfaces, ...)
 2. how to define LazSerial1: TLazSerial; ?

Thanks a lot!
Valentin

PS:
I managed to do it without TLazSerial:
Quote
uses ... , synaser;

type TSerial = class(TBlockSerial)
   end;

var ser: TSerial;

begin
  ser:=TSerial.Create;
...
...
end.
« Last Edit: October 02, 2014, 04:26:28 pm by laskov »

CM630

  • Hero Member
  • *****
  • Posts: 1089
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #77 on: October 27, 2014, 07:54:21 am »
There is a chain of BUGS, which finally results in lazserialsetup.pas used in Windows XP.
Briefly: if the number of a device to be added is higher than nine (i.e. COM15) it is displayed only as
COM1. More information is given in this thread. I would like to ask if other people can reproduce the bug (and possibly in other Win versions).
Also, I would ask Jurassic Pork about his opinion. IMHO, bes solution is to contact the developers of Ararat Synapse, but also the GetSerialPortNames function can be duplicated in LazSerial with a bugfix.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #78 on: October 27, 2014, 08:34:56 am »
IMHO, bes solution is to contact the developers of Ararat Synapse,
FYI: If that bug is confirmed: submitting a patch via the synapse mailing list has been a painless process for me both for bug fixes and commenting improvements...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #79 on: October 29, 2014, 01:50:04 am »
hello,
my O.S is Windows 7 64 bits, i use Lazarus 1.2.4   32 bits.  I have created two virtual serial ports paired with the software com0com . The names of these ports are COM129 and COM140.  I launch two instances of the example gps simulator sertest of tlazerial component. In the first i can choose and open the COM129 port , in the other the port COM140. When i start the gps simulator on one , i receive the frames on the other.
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

CM630

  • Hero Member
  • *****
  • Posts: 1089
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #80 on: November 05, 2014, 09:42:50 am »
my O.S is Windows 7 64 bits, i use Lazarus 1.2.4   32 bits.  I have created two virtual serial ports paired with the software com0com .

Did you check the value of the registry with regedit (as seen from attached image)?  A virtual com port might be created properly, there is a problem with Bluetooth com port installation. I just plugged a USB to Serial adapter, win assigned COM3 to it, then I manually changed the prot number to 41 and it is okay (right picture). But adding COM devices to bluetooth (in Win XP) does not add last two zeroes (left screenshot).
I did the same on another PC with WinXP 32 bit. Bluetooth added COMS the same way. Then I run this source in VB.NET:
Code: [Select]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  Dim readValue As String
  readValue = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", "\Device\BthModem10", Nothing)
  MsgBox("The value is " & readValue)
End Sub
It returned the entire string. So I have nothing else to think, except that there is a bug in the FPC registry implementation, or precisely registry.pp.
Here is their code:
 
Quote
function TRegistry.ReadString(const Name: string): string;

Var
  Info : TRegDataInfo;

begin
  GetDataInfo(Name,Info);
  if info.datasize>0 then
    begin
     If Not (Info.RegData in [rdString,rdExpandString]) then
       Raise ERegistryException.CreateFmt(SInvalidRegType, [Name]);
     SetLength(Result,Info.DataSize);
     If StringSizeIncludesNull then
       SetLength(Result, Info.DataSize-1)
     else
       SetLength(Result, Info.DataSize);

     GetData(Name,PChar(Result),Info.DataSize,Info.RegData);
   end
  else
    result:='';
end;
In the source of registry.pp I could not find where StringSizeIncludesNull gets its value from, but it always returns true!?!


Edit: I have fixed the code the following way, no it seems to work fine:
Code: [Select]
function TRegistry.ReadString(const Name: string): string;
Var
  Info : TRegDataInfo;
begin
  GetDataInfo(Name,Info);
  if info.datasize>0 then
    begin
     If Not (Info.RegData in [rdString,rdExpandString]) then
       Raise ERegistryException.CreateFmt(SInvalidRegType, [Name]);
     SetLength(Result,Info.DataSize);
     GetData(Name,PChar(Result),Info.DataSize,Info.RegData);
     FStringSizeIncludesNull:=(RightStr(Result,1)=#0);
     If StringSizeIncludesNull then
       SetLength(Result, Info.DataSize-1)
     else
       SetLength(Result, Info.DataSize);
   end
  else
    Result:='';
end; 
Edit: Reported as bug 27002.
Edit: It occurs that the problem was reported 2,5 years ago, still no resolution.
Jurassic Pork, what about using a custom ReadString  function in your library, until the bug is fixed? Also, do you mean uploading it to SF or somthing similar?
« Last Edit: November 06, 2014, 08:09:01 am by paskal »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.


CM630

  • Hero Member
  • *****
  • Posts: 1089
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #82 on: November 10, 2014, 07:36:51 am »
The problem is that no one from the FPC team seems to solve problem. I will submit a patch, hopefully s.o. will apply it.
And also, since *Jurassic Pork does not seem to be interested in TLazSerial anymore, maybe I should fork it, since I am willing to make some improvements.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

whoim

  • Newbie
  • Posts: 1
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #83 on: December 02, 2014, 09:30:48 am »
this component may work on android?)
need bluetouch slave cdc connect to my device

brewdos

  • Newbie
  • Posts: 1
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #84 on: December 02, 2014, 05:24:05 pm »
Thank you very much for your work

CM630

  • Hero Member
  • *****
  • Posts: 1089
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #85 on: December 12, 2014, 08:39:43 pm »
Latest info from the bugtracker is that the registry bug is fixed. I hope I will be able to try it soon.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

Ferke

  • New Member
  • *
  • Posts: 13
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #86 on: February 23, 2015, 07:13:54 pm »
Hi,

first of all, thank you for your component.
I have a question.  I would like to use this component on Raspberry Pi 2. Will this work on ARM?

maxid

  • Newbie
  • Posts: 2
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #87 on: June 12, 2015, 02:47:04 pm »
can implement datapackets?
how send and receive Records?

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #88 on: June 13, 2015, 02:04:10 am »
hello,
 you can parse packets in the OnRxData event. TComportDataPacket is only an easy way to do this.
if you are on Windows, see Tcomport component for Lazarus.

Friendly, J.P
« Last Edit: June 13, 2015, 02:18:47 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

eny

  • Hero Member
  • *****
  • Posts: 1634
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #89 on: June 13, 2015, 06:06:28 am »
can implement datapackets?
how send and receive Records?
By not cross posting and creating a new thread with your question.
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

 

TinyPortal © 2005-2018