36 #ifdef USB_FILTER_DEBUG
37 #define USB_FILTER_QXTLOG_DEBUG(...) qDebug() << __VA_ARGS__
38 #else // USB_FILTER_DEBUG
39 #define USB_FILTER_QXTLOG_DEBUG(...)
40 #endif // USB_FILTER_DEBUG
44 if ((m_vid.contains(port.
vendorID) || m_vid.isEmpty())
45 && (port.
productID == m_pid || m_pid == -1)
46 && ((port.
bcdDevice >> 8) == m_boardModel || m_boardModel == -1)
47 && (port.
getRunState() == m_runState || m_runState == -1)) {
54 void USBSignalFilter::m_deviceDiscovered(
USBPortInfo port)
56 if (portMatches(port)) {
57 USB_FILTER_QXTLOG_DEBUG(
"USBSignalFilter emit device discovered");
62 void USBSignalFilter::m_deviceRemoved(
USBPortInfo port)
64 if (portMatches(port)) {
65 USB_FILTER_QXTLOG_DEBUG(
"USBSignalFilter emit device removed");
72 , m_boardModel(boardModel)
73 , m_runState(runState)
79 &USBSignalFilter::m_deviceDiscovered, Qt::QueuedConnection);
81 &USBSignalFilter::m_deviceRemoved, Qt::QueuedConnection);
87 , m_boardModel(boardModel)
88 , m_runState(runState)
91 &USBSignalFilter::m_deviceDiscovered, Qt::QueuedConnection);
93 &USBSignalFilter::m_deviceRemoved, Qt::QueuedConnection);
void deviceDiscovered(const USBPortInfo &info)
static USBMonitor * instance()
void deviceRemoved(const USBPortInfo &info)
USBSignalFilter(int vid, int pid, int boardModel, int runState)
unsigned char getRunState()