![]() In my read thread I am reading the incoming data into a TBytes container, then I fire off an event function that also carries that data over to the client. I do not want to modify the behavior of the application because I feel I would get out on thin ice then. ![]() I need something simple, which I can expand to contain the functionality needed by the ported application. It is instructive and I could probably try that out in another attempt at making a serial component. I stole the read thread from LazSerial to create the event OnRxData and this then works just fine in one of my test applications.īut now when I try to integrate this component into the main application I am porting, of course I stumble across this transmit buffer state reading, which seems not to be available in serial.pas. So this is why I tried to simplify things by creating a serial port component myself based on the built-in serial unit in FPC. Too much and rather hard to track down myself, so there are at least 2 threads here where this endeavour is discussed. So I had to specify some project setting I never even knew about before as "nonGui" but it was not sufficient, I also had to add a uses clause "interfaces" before lazserial and finally when I moved to the RPi, which is ARM CPU, I had to edit the lazserial package file jedi.inc in order to remove a requirement for some Intel thing. ![]() The compile would not work, complaining about missing wsmenus or similar, like 30-40 such error messages.īut in a GUI app all was OK, that is why it took a while before I could zoom in on the LazSerial connection to synapse. In both cases I had to run trough hoops to get it working for a non-GUI simple program. Well, what I have done is I tested with both LazSerial and SdpoSerial and they are based on Synapse. So now I try to build my own serial component based on the built-in serial unit and make this component command compatible to AsyncPro regarding the methods actually used. I have tried LazSerial based on Synapse and in my test applications it worked OK, but then on the real command line app it just was a mess because LazSerial (and also SdpoSerialPort) brings in a lot of GUI stuff that makes them incompatible with a command line only program in Linux. Most of the code ported well without much changes except for the two instances that communicate (RS232 and TCP/IP) where I have had to find a replacement for AsyncPro and TServerSocket in Delphi7.įor TCP/IP I moved to Indy10 and it works fine, but the serial stuff is much more complicated due to the way the equipment communicates. It will run as a systemd service in Pi-OS on Raspberry Pi4 in the end. Well, for Windows I will not move away from Delphi just for maintenance and then AsyncPro works OK.īut my current goal is to get the app onto Linux so I can get rid of Windows altogether. It looks like this in Windows using AsyncPro: I must find a way to implement a function to return the number of unsent bytes in the Linux buffer because the application I am porting uses this when sending large data chunks in order not to overload the transmit buffer.īasically the existing program sends the data in chunks of 512 bytes, waits for the transmit buffer to empty below 16 bytes before sending another 512 bytes etc. I must replace the existing AsyncPro and when doing this I have now run into a problem concerning the serial unit. So now I want to use this when I port a Windows application interfacing to a data collection system through RS232 at baudrates of 1920. I did this using a thread running whenever the serial port is open. In order to be usable when converting old Delphi programs it needs to implement an event function for receiving data. The aim was to make a lean component with just the bare bones needed for a control application intended to run on Linux (Pi-OS on Raspberry Pi 3 and 4). I have created a component wrapper around the serial unit that comes with FreePascal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |