NDEVR
API Documentation
DeviceWatcher

Watches and alerts the program when a USB device is plugged in or unplugged. More...

Public Member Functions

 DeviceWatcher (QObject *parent=0)
 Constructs a DeviceWatcher with the given parent object.
void appendEventReceiver (QObject *receiver)
 Appends an additional event receiver that will be notified of device change events.
void deviceAdded (const QString &dev)
 Emitted when a new device is added to the system.
void deviceChanged (const QString &dev)
 Emitted when a device state changes, such as when unmounting.
void deviceRemoved (const QString &dev)
 Emitted when a device is removed from the system.
bool isRunning () const
 Checks whether the watcher is currently monitoring for device changes.
bool start ()
 Starts watching for device changes.
bool stop ()
 Stops watching for device changes.

Static Public Member Functions

static DeviceWatcherDefaultWatcher ()
 Returns the singleton default DeviceWatcher instance.

Protected Attributes

DeviceWatcherPrivate * d_ptr
 Private implementation pointer for platform-specific watching logic.
bool running
 Whether the watcher is currently active.

Detailed Description

Watches and alerts the program when a USB device is plugged in or unplugged.


Definition at line 11 of file DeviceWatcher.h.

Constructor & Destructor Documentation

◆ DeviceWatcher()

DeviceWatcher::DeviceWatcher ( QObject * parent = 0)
explicit

Constructs a DeviceWatcher with the given parent object.

Parameters
[in]parentThe parent QObject, or nullptr for no parent.

References DeviceWatcher().

Referenced by DeviceWatcher(), and DefaultWatcher().

Member Function Documentation

◆ appendEventReceiver()

void DeviceWatcher::appendEventReceiver ( QObject * receiver)

Appends an additional event receiver that will be notified of device change events.

Parameters
[in]receiverThe QObject to receive device change events.

◆ DefaultWatcher()

DeviceWatcher & DeviceWatcher::DefaultWatcher ( )
static

Returns the singleton default DeviceWatcher instance.

Returns
A reference to the default DeviceWatcher.

References DeviceWatcher().

◆ deviceAdded()

void DeviceWatcher::deviceAdded ( const QString & dev)

Emitted when a new device is added to the system.

Parameters
[in]devThe device identifier string.

◆ deviceChanged()

void DeviceWatcher::deviceChanged ( const QString & dev)

Emitted when a device state changes, such as when unmounting.

Parameters
[in]devThe device identifier string.

◆ deviceRemoved()

void DeviceWatcher::deviceRemoved ( const QString & dev)

Emitted when a device is removed from the system.

Parameters
[in]devThe device identifier string.

◆ isRunning()

bool DeviceWatcher::isRunning ( ) const

Checks whether the watcher is currently monitoring for device changes.

Returns
True if the watcher is running.

◆ start()

bool DeviceWatcher::start ( )

Starts watching for device changes.

Returns
True if watching was successfully started.

◆ stop()

bool DeviceWatcher::stop ( )

Stops watching for device changes.

Returns
True if watching was successfully stopped.

The documentation for this class was generated from the following file: