/**
 * \brief Constructor
 *
 * \note
 *
 */
RawHIDConnection::RawHIDConnection()
{
    RawHidHandle  = NULL;
    enablePolling = true;

    m_usbMonitor  = USBMonitor::instance();

#ifndef __APPLE__
    connect(m_usbMonitor, SIGNAL(deviceDiscovered(USBPortInfo)), this, SLOT(onDeviceConnected()));
    connect(m_usbMonitor, SIGNAL(deviceRemoved(USBPortInfo)), this, SLOT(onDeviceDisconnected()));
#else
    connect(m_usbMonitor, SIGNAL(deviceDiscovered()), this, SLOT(onDeviceConnected()));
    connect(m_usbMonitor, SIGNAL(deviceRemoved()), this, SLOT(onDeviceDisconnected()));
#endif
}
Пример #2
0
void MonitorThread::run()
{
    m_monitor = new DeviceMonitor(NULL);

    connect(m_monitor, SIGNAL(deviceDisconnected(QString)), parent(), SLOT(onDeviceDisconnected(QString)),Qt::QueuedConnection);
    connect(m_monitor, SIGNAL(deviceConnected(QString)), parent(), SLOT(onDeviceConnected(QString)),Qt::QueuedConnection);
    connect(m_monitor, SIGNAL(busyMessage(QString)), parent(), SLOT(onBusyMessage(QString)),Qt::QueuedConnection);
    connect(m_monitor, SIGNAL(errorMessage(QString,QString)), parent(), SLOT(onShowErrorInfo(QString,QString)),Qt::QueuedConnection);

    connect(this, SIGNAL(monitorCreated(DeviceMonitor *)), parent(), SLOT(onMonitorCreated(DeviceMonitor*)),Qt::QueuedConnection);
    emit monitorCreated(m_monitor);
    m_monitor->start();
    exec();
}