qCNC 0.82-alpha
QextSerialEnumerator Class Reference

#include <qextserialenumerator.h>

List of all members.

Signals

void deviceDiscovered (const QextPortInfo &info)
void deviceRemoved (const QextPortInfo &info)

Public Member Functions

 QextSerialEnumerator ()
 ~QextSerialEnumerator ()
void setUpNotifications ()

Static Public Member Functions

static QList< QextPortInfogetPorts ()

Detailed Description

Provides list of ports available in the system.

Usage

To poll the system for a list of connected devices, simply use getPorts(). Each QextPortInfo structure will populated with information about the corresponding device.

Example

  QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
  foreach( QextPortInfo port, ports ) {
      // inspect port...
  }

To enable event-driven notification of device connection events, first call setUpNotifications() and then connect to the deviceDiscovered() and deviceRemoved() signals. Event-driven behavior is currently available only on Windows and OS X.

Example

  QextSerialEnumerator* enumerator = new QextSerialEnumerator();
  connect(enumerator, SIGNAL(deviceDiscovered(const QextPortInfo &)),
             myClass, SLOT(onDeviceDiscovered(const QextPortInfo &)));
  connect(enumerator, SIGNAL(deviceRemoved(const QextPortInfo &)),
             myClass, SLOT(onDeviceRemoved(const QextPortInfo &)));

Credits

Windows implementation is based on Zach Gorman's work from The Code Project (http://www.codeproject.com/system/setupdi.asp).

OS X implementation, see http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_Finding_Devices/chapter_4_section_2.html

Author:
Michal Policht, Liam Staskawicz

Definition at line 96 of file qextserialenumerator.h.


Constructor & Destructor Documentation

QextSerialEnumerator::QextSerialEnumerator ( )

Definition at line 12 of file qextserialenumerator_osx.cpp.

QextSerialEnumerator::~QextSerialEnumerator ( )

Definition at line 18 of file qextserialenumerator_osx.cpp.


Member Function Documentation

void QextSerialEnumerator::deviceDiscovered ( const QextPortInfo info) [signal]

A new device has been connected to the system.

setUpNotifications() must be called first to enable event-driven device notifications. Currently only implemented on Windows and OS X.

Parameters:
infoThe device that has been discovered.
void QextSerialEnumerator::deviceRemoved ( const QextPortInfo info) [signal]

A device has been disconnected from the system.

setUpNotifications() must be called first to enable event-driven device notifications. Currently only implemented on Windows and OS X.

Parameters:
infoThe device that was disconnected.
QList< QextPortInfo > QextSerialEnumerator::getPorts ( ) [static]

Get list of ports.

Returns:
list of ports currently available in the system.

Definition at line 24 of file qextserialenumerator_osx.cpp.

void QextSerialEnumerator::setUpNotifications ( )

Enable event-driven notifications of board discovery/removal.

Definition at line 204 of file qextserialenumerator_osx.cpp.

Here is the call graph for this function:


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines