Results 1 to 6 of 6

Thread: List serial ports in Qt application on windows and Mac

  1. #1
    Join Date
    Jul 2012
    Location
    India
    Posts
    33
    Thanks
    10
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default List serial ports in Qt application on windows and Mac

    I am creating one Qt based application for windows and Mac OS X. I used Qextserial port to connect and communicate through serial port it works well.

    But now I need to list existing serial ports in a system like "COM1" "COM2" etc.

    How I can do this in Qt, is there any native C++ code available to list existing serial ports in a system that i can include in Qt application

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,594
    Thanks
    13
    Thanked 1,588 Times in 1,517 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: List serial ports in Qt application on windows and Mac

    Did you read the QextSerialPort documentation? There are only two classes and the bit about QextSerialEnumerator will be illuminating.

  3. #3
    Join Date
    Jul 2012
    Location
    India
    Posts
    33
    Thanks
    10
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: List serial ports in Qt application on windows and Mac

    I didn't understand. Is there any function to get existing serial ports in a system

    There is no function available to list existing serial ports in QExtserilport. They are simply hard coded the portnames

    They are used like this
    port = new QextSerialPort("COM1");

    but i need to get this "COM1" from system

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: List serial ports in Qt application on windows and Mac

    From the link posted by Chris:
    QextSerialEnumerator enumerates ports currently available in the system.
    QextSerialEnumerator::getPorts
    Get list of ports.

    return list of ports currently available in the system.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. The following user says thank you to spirit for this useful post:

    arunkumaraymuo1 (27th August 2012)

  6. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,391
    Thanks
    247
    Thanked 690 Times in 680 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: List serial ports in Qt application on windows and Mac

    As they say in English: "You can lead a horse to water, but you can't make him drink."
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  7. #6
    Join Date
    Jul 2012
    Location
    India
    Posts
    33
    Thanks
    10
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: List serial ports in Qt application on windows and Mac

    Thank you all, I didn't noticed that earlier
    Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Similar Threads

  1. qextserialport cant open ports in windows 7
    By manaila in forum Newbie
    Replies: 4
    Last Post: 16th April 2012, 15:40
  2. Replies: 5
    Last Post: 11th August 2011, 14:16
  3. Replies: 1
    Last Post: 3rd May 2011, 16:13
  4. GUI application for serial communication
    By jerkymotion in forum Newbie
    Replies: 6
    Last Post: 8th March 2011, 20:00
  5. Serial comms on Windows Pc (Qextserialport)
    By SteveH in forum Qt Programming
    Replies: 19
    Last Post: 10th June 2010, 23:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.