Results 1 to 5 of 5

Thread: How to Know Active COM port Dynamically

  1. #1
    Join Date
    Aug 2008
    Posts
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default How to Know Active COM port Dynamically

    Hi,
    I am using QT4.4 on windows to develop a GUI application which will communicate with a Electronic Unit (named data processing system) using MOXA USB which I have bought in market, they provide the drivers to make work.If I insert the USb cable and install the drivers of it ,it will be installed to that COM port (either it is COM1/COM2/COM3).Now I am using QExtSerialport library to make communicate through the USB. In this QExtSerialport library they provided member functions to set the COM and to open it .Now ,what I am doing is ,I am manually looking the system device drivers to make confirm in which COM the USB is installed and knowing this I am writing code as QExtserial port port->setCom (COM NAME).But I want to kknow Dynamically through Program ,that which Comport is active with MOXA USB .How can I know the COM number Dynamically to make that port open using QT.
    So please help me to solve this problem .

    With Regards
    Sudheer
    Last edited by sudheer168; 20th June 2009 at 07:54.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to Know Active COM port Dynamically

    You can try opening each port in sequence and trying to communicate with the device until you succeed. I don't think there is a way to detect the proper port automatically in a general way.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2008
    Posts
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: How to Know Active COM port Dynamically

    Thanks for your kind reply.
    You asked me to see which port is open. I did it and got the all open ports list with names as COM1,COM2,COM3.In these three COMs how can I know which one is MOXA USB(the USB which I connected to system to communicate) .So here I definitely have to know the name of the USB port which is connected to the COM port.One thing is in system decice manager.. Ports(COM &LPT) it is showing both COM name and USB device name as MOXA USB Serial Port (COM2).
    So please help me to solve the problem.

    With Regards,
    Sudheer.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to Know Active COM port Dynamically

    You have to use native API for this, if it allows to query for such information (which is doubtful).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Aug 2008
    Posts
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: How to Know Active COM port Dynamically

    Thanks for your kind reply.If u don't mind please help me to get the name with a sample example code.


    With Regards,
    Sudheer.

Similar Threads

  1. setting port in qexserialport
    By Myx in forum Newbie
    Replies: 2
    Last Post: 15th April 2011, 15:49
  2. QUdpSocket -- Rebinding with Different Port Numbers
    By swamyonline in forum Qt Programming
    Replies: 0
    Last Post: 22nd January 2009, 13:39
  3. Rendering 3D Objects on Ubuntu
    By Sandip in forum Qt Programming
    Replies: 3
    Last Post: 19th January 2009, 14:29
  4. Problem with Painter in Qt4.4.1
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 1st September 2008, 13:47
  5. Replies: 6
    Last Post: 18th April 2007, 15:04

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
  •  
Qt is a trademark of The Qt Company.