Qt5.1 android usb to serial adapters



  • Hello all!

    I'm tasked with porting a windows application over to android.
    I'ts written in c++ with the use of the vcl library from embarcadero.
    The app uses a serialport to talk with a machine.

    I'm interested in qt and wonder if it can be used to help me port it over.

    Biggest question currently is the support of serialports, using an usb-to-serial adapter.
    Both profilic and fdti have "drivers" for android in java. But how does this work in qt?

    thanks in advance



  • Hi phesk!
    Welcome to DevNet.
    I don't know how it will work on android but since 5.1 Qt has serial port library.
    "Try it":http://qt-project.org/wiki/QtSerialPort .



  • An alternative solution is using a serial port to WiFi adapter.

    Those adapters are actually cheap wifi enabled microcontrollers that map a serial port interface to a TCP or UDP socket (you usually can configure it connecting to the adapter's embedded webserver ).

    Some models are sold as barebones you can customize to your specific needs (type of power source and power source connector, type of wifi antenna, casing, signal converter max422 instead of max232, etc.).



  • phesk, Im in a similar situation as you, Im experimenting with porting windows to android. Did you find a proper solution yet?
    I was going to try this usb serial adapter "here":http://www.usconverters.com/index.php?main_page=page&id=62&chapter=0 and probably also this "serial wifi adapter here":http://www.usconverters.com/index.php?main_page=product_info&cPath=70&products_id=404
    I have no idea if any of these will work but I through I would give it a try.



  • As told qxoz, there is already ready QtSerialPort module. It supports only WIn/Lin/Mac.

    Android isn't supported yet.

    Anybody yet didn't do port for Android because in team of developers there are no experts of Android. Most likely it is necessary to include patches in the Necessitas project, instead of in Qt. (?)

    Therefore, for access to serial ports try to use JNI calls from "low-level" native Android's core (or something like, if I'm not mistaken).

    PS: I'm not expert in Android.



  • IIRC on a rooted Android device it is possible to access serial port devices opening them as files like you do on Linux, but you have to use JNI or NDK function calls (QtSerialPort needs some patches because you have to go thru the Dalvik VM).

    On non-rooted devices the only option is using "Android USB host mode":http://developer.android.com/guide/topics/connectivity/usb/host.html functions
    but you have to directly handle USB packets and the device has to have USB host mode enabled in Android configuration files (some devices do not enable it even if they have USB host ports, you can connect USB sticks and other supported stuff in USB host mode but a configuration file do not allow application-level USB host handling).

    Using a serial<-->wifi adapter is the easier route, it is garanteed to work on any android device with wifi, but this will add latency to the communication.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.