How To Qt Creator Embedded use PSQL - qt

I'm trying to use connection to postgres with Qt Creator for embedded device with the Raspberry Pi 3, however the driver is not loaded. The same application on the desktop is ok.
My example is quite simple.
I have a console project with a main class and in it a log with
QSqlDatabase::drivers();
In raspberry list only QSQLITE, and desktop list QSQLITE, QPSQL, QMYSQL among others.
I am using oQt Creator Enterprise, connecting to the device with Boot2Qt, that comes with Qt Creator, compilation and execution is everything correctly, however is not listed PSQL driver in device.

QSqlDatabase::drivers() lists only the drivers that can be loaded on that particular platform, in many cases to have a working driver you need the Qt driver and a specific client library.
Probably there is a postgresql client library for raspberry with your specific linux version somewhere but Boot2Qt does not load it automatically to your board.
You have to find the client library for your specific version of linux (maybe you will have to compile it) then manually copy the postgresql Qt driver onto the board and the QSqlDatabase::drivers() should show you the postgresql driver available.

Related

Need to develop a Device Driver, which when installed on a system would create multiple Virtual serial port

This is my first Windows device driver and I have been assigned a task to develop a Windows device driver from scratch. When the user installs this driver on a windows PC it would ask the user, during the installation process, to enter the number of virtual serial port that user requires & after installation of the driver the number of virtual port desired by the user shall be created. Then the user connects his customized printer to the windows PC via USB port. The user should be able to send data to the printer through the Hyper terminal by selecting any of the newly created Virtual serial port at 9600 baud rate, 8 data bit, No parity and 1 stop bit.
Now to get started I am using a windows 7 system on which I have installed Visual Studio 2015 along with Windows Driver Kit 10 form the MSDN website. I have also downloaded the Windows drivers sample codes form the GITHUB this sample soce base contains a virtualSerial UMDF project under serial/Svirtualserial2. This project file contained 2 projects one being the Virtualserial2 project and the other is a FakeModem project so I deleted the FakeModem project (as its was of no use for me) and successfully compiled the source/VirtualSerial2 sample code. after compilation a .dll (as UDMF drivers have .dll extensions) file gets generated in the debug folded but I don't get any .exe for this driver so I am not sure how can I install this driver on my system.
I was also going through this link https://msdn.microsoft.com/en-in/library/windows/hardware/dn745911%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 that list the process to debug a UMDF driver using WinDbg, in an example it also asks us to run the .exe so my first question is how do I need to generate a .exe file of my driver & test it on a system.
Along with this I have one more query. after I install my driver on the target system (Windows 7 32 bit I need to link it to the hyper terminal). So that I will be able to send the Commands & data to my printer through the hyper terminal and my driver will be responsible to take the data from the hyper terminal and send it to my printer through USB. How can I do that?
Am I going in the right direction?

Running java application from usb

I am trying to build a cross platform (vista, xp, mac, Linux).
I need to put the application in the USB drive formatted in FAT-32 and it should run on any OS computers.
Planning to use Java/JavaFx to do it.
Any advice how we can run on the multiple platforms.
Hi, Can anyone advice use of uber-jar for the above requirment. Would that be good fit.
A few things to take into consideration:
The USB must be formatted with a filesystem compatible with all the OS you need to work with.
A Java application would be able to run on any OS that is able to run Java, but each OS needs a different Java runtime. There's a Java runtime for Linux, one for Windows, one for OSX, etc.
My suggestion would be to define which OS you want to support and create launcher scripts for each one of them on the root of the USB. For instance you would have at least a couple like: myapp.cmd (for Windows), myapp.sh (for Linux), etc.
Additionally you may want to have different Java Runtimes in the same USB, so with the launcher scripts you execute your Java application running it with the corresponding JRE in the USB filesystem.
A twist in the launcher script would be to somehow check if the OS has already a JRE available (Like checking for a variable JAVA_HOME in the environment, or checking the output of "java -version") and act accordingly (although, running a Java application from your own JRE would be safer).

The QPSQL driver can not loaded

if i try to run my qt application on windows 7, the console print:
QPSQL driver not loaded ... available driver:...QPSQL...
After that, i've tried to include the following paths to the windows path variable
C:\psql32\bin;C:\psql32\include;C:\psql32\lib;
The application can connect to the psql db and all works fine. How can i fix this problem, without to install the psql software on all pc's. ?
Best regards, chris.
Usually you don't need to use the drivers from Postgres. At least in the version I use (commercial, 4.8.4, Win)
Qt provides the drivers in the directory <QTDIR>\plugins\sqldrivers.
When the application runs on the computer, where Qt is installed, nothing should be done explicitly - Qt should find the drivers.
When the application is deployed on a computer without Qt-installation, I copy release versions of the files found in <QTDIR>\plugins to <MyAppExeDir>\plugins.
Besides Sql drivers, same problem could apply also to jpeg an other pluggable components.
P.S.:
Make sure, not to mix Qt-dlls from one computer with Qt-plugins from other computer, even if the versions are the same.

Qt creator remote debugger

I am trying to hook my beagle board to qt creator 2.3.1 running on Ubuntu Linux. I tried to find a good tutorial for this and found that qt documentation has nothing on this.(I do not understand why there is a feature which documentation does not bother to explain how to use). Could some one please explain how to do this?
Cross compile qt for beagle board This post should be at help
Open Qtcreator and go to project tab and select the tools -> options. Select Linux devices and add the device. For this beagle board need to be attached. For the option of host name it is required to add the ip address of the device. Other than this other fields are self explanatory. Test Button would assist in checking the device addition.
Then in the project settings under Run configuration in the Deployment drop-down box select Build tar ball and install.
At this point tool chain and the cross compiled qt version should be added in the qt creator.
Basic procedure should be done by now and when the application is run it should be deployed on the device at the specified location.

Moving a Java JAR file to a new machine

I have a Java program that connects to com ports when it's running. All I have is a .JAR file. I recently attempted to move this from a machine that the program runs on to another machine. I know the serial devices work on the new machine because I can interact with them thru a program called Putty. When I execute the .JAR file it comes up and seems to run just fine, but is unable to connect to the com port. Could this be a missing library that is installed in the JRE of the other machine? How would I figure out what is missing to make this program run?
Yes that could very well be the problem. Legacy ports (parallel and serial port) support in Java is provided by the Java Communications API, which relies on native code to support low level access to those ports. That API it's an extension to the JDK and not part of it.
Of course it could also be that on the new machine the user running your program doesn't have permissions to access the port, which is a different problem.
EDIT: For cross platform support for legacy ports, hell even if you only intend to use your program in one platform I recommend RXTX, an open source replacement for JavaComm.
Open the jar, look at META-INF/MANIFEST.MF file to see if it specifies any jar dependencies.
If not, it is possible that the JAR is using some native libraries to connect to COM ports.
Using the Serial port with Java normally involves addition of a compiled native (.so or .dll) file to the LD_LIBRARY_PATH.
I think you're using Linux, so look out for a file called librxtxSerial.so on the original machine (it'd be called rxtxSerial.dll on Windows)
The library path can be set in a few ways, but your best bet is to check for this file within the original Java installation:
e.g. /jre/lib/i386/librxtxSerial.so
Another thing to look out for is the rxtx jar itself (this may have been bundled inside your jar, or maybe not).
You may get better results by simply following instructions on the RXTX website, but I'd try understanding the original installation first.
http://rxtx.qbang.org/wiki/index.php/Installation
Good luck!

Resources