You can track and use all available ComPorts on your Linux machine by using this fantastic library.
It is simple, fast, and efficient to use; simply download and add the library path, declare the units, and call its functions.
Follow the tutorial to learn how to do so. In my case, I was using VirtualBox to run Ubuntu on a Windows host.
Table of Contents
Installing Development Packages
To install the development packages on Ubuntu:
- Right-click your desktop and select Open Terminal.
- To upgrade the packages you have already installed, type
sudo apt update && sudo apt upgrade && sudo apt dist-upgrade
in the terminal. - Type your user password and press Enter
- Wait until prompted to agree to the package upgrade operation. Type Y and press Enter
- Wait until the package upgrade operation is complete. It may take a few minutes to complete.
- To add the development packages, type
sudo apt install joe wget p7zip-full curl openssh-server build-essential zlib1g-dev libcurl4-gnutls-dev libncurses5
in the terminal. - Type your user password and press Enter
- Wait until prompted to agree to the package installation operation. Type Y and press Enter
- Wait until the package installation operation is complete. It may take a few minutes to complete.
Preparing Your Linux Machine
To create Linux applications, you need to add a virtual machine PAServer:
- 1. Find the
LinuxPAServer21.0.tar.gz
file in the following location on your windows machine, and send it to your linux machine:C:Program Files (x86)EmbarcaderoStudio21.0PAServerLinuxPAServer21.0.tar.gz
- 2. Unpack the
LinuxPAServer21.0.tar.gz
file. -
- Right-click the folder where you have unpacked the
LinuxPAServer21.0.tar.gz
file, and then click Open in Terminal. - Enter
./paserver
in terminal. Then, press Enter. - Set your password.
- Right-click the folder where you have unpacked the
Click here to see the full tutorial and how to install it on Red Hat.
Now that the machine is ready to receive the deployment from Windows, let’s check how to implement the code. by the way, there is a simple demo showing how to work with the library, you can download it here.
After downloading and opening the demo project, follow the steps below to set up and deploy.
Remember to download the SDK for the target Linux OS.
Now that the machine is ready to receive the Windows deployment, let’s look at how to put the code into action. By the way, you can download a simple demo showing how to use the library here.
After downloading and opening the demo project, proceed with the setup and deployment steps outlined below.
Remember to download the SDK for the target Linux operating system.
Creating a Connection Profile
- On the Tools > Options > Environment Options > Connection Profile Manager page, click the Add button. The Create a Connection Profile wizard opens.
- On the Profile information page, enter the following:
- In the Profile Name field, enter the needed name.
- In the Platform field, click the 64-bit Linux platform.
- Click Next.
- On the Remote machine information page, enter the following:
- In the Remote machine field, enter the IP address or machine name.
- Click Test Connection to check if the values are valid.
- Click Finish.
Adding the Installed SDK to RAD Studio
- On the Tools > Options > Environment Options > SDK Manager page, click the Add button.
- In the Add a New SDK dialog, enter the following:
- In the Select a platform field, click 64-bit Linux.
- In the Select a profile to connect, select a created profile from the drop-down list.
- In the Select an SDK version field, the name of the SDK that you just installed will automatically appear. If you have not installed SDK previously, you can do it on this step. If you have already installed the SDK, move on to the next step
As you can see in the demo project, just declare the unit LComPort
, to track and use the Ports declare the following variables:
[crayon-6767dca15a3b9056223141/]
Then you can use the following code to list them all:
[crayon-6767dca15a3c2760719321/]
and to send some data through the Port:
[crayon-6767dca15a3c4198430414/]
Hope you guys succeeded in making it work, looking forward to seeing what comes next. WINSOFT Library link here, full tutorial Link here.
Check out this step-by-step guide on how to download and use the ComPort DLL Library to make your developer life easy and increase your efficiency.
You can easily work with a COMPort on Linux in Delphi using a WINSOFT Library with the use of IDE Software. Try it out and make the most of it. Request a Free Trial here.