Results 1 to 8 of 8

Thread: How to detect Hardware generated signals and reflect on Ui using Qt??

  1. #1
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question How to detect Hardware generated signals and reflect on Ui using Qt??

    Hi,
    I have to detect some hardware signals like the USB connected, Network availability etc. How can i achieve the above using Qt class refrence...???

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to detect Hardware generated signals and reflect on Ui using Qt??

    qt wont help you here. you have to use system specific api.

  3. #3
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to detect Hardware generated signals and reflect on Ui using Qt??

    Thanks for the reply, but can you suggest how the same can be achieved ?? As to how can i approach this problem. What i want is to emit a signal and trap it in my UI application event loop can this be achieved in any ways...???

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to detect Hardware generated signals and reflect on Ui using Qt??

    Design a QOBJECT class that detects hardware signals like the USB connected, Network availability etc and emits a signal upon those events. You can then connect those signals to relevent slots in your ui class.

    Anything further than that is really outside the scope of this forum.

    Qt Code:
    1. class HardwareDetector : public QObject
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. HardwareDetector(QObject *parent = 0);
    7.  
    8. Q_SIGNALS:
    9. USBDetect();
    10. NetworkDetect();
    11. };
    To copy to clipboard, switch view to plain text mode 

    then in a relevent function in your .cpp :

    Qt Code:
    1. emit USBDetect();
    To copy to clipboard, switch view to plain text mode 
    Last edited by squidge; 23rd November 2009 at 17:59.

  5. #5
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Re: How to detect Hardware generated signals and reflect on Ui using Qt??

    The same implementation i have in mind but my problem is to pass the signal from Kernal space to the user space where i can emit Qt signals and take it to the UI. So my concern is to how can i detect the hardware signals using Qt??

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

    Default Re: How to detect Hardware generated signals and reflect on Ui using Qt??

    If you're using Linux, you can use HAL through DBUS to interconnect with the hardware.
    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.


  7. #7
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Re: How to detect Hardware generated signals and reflect on Ui using Qt??

    Yes i am using Linux system, but i dont have any idea of using dbus does qt provide an interface with dbus or how can i achieve the same...????

    Thanks in advance.

    regards,
    sudhish kapoor

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

    Default Re: How to detect Hardware generated signals and reflect on Ui using Qt??

    Yes, see the QtDbus module in the docs.
    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.


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.