ScanDir* ScanManager::setTop(const QString& path, int data) { stopScan(); if (_topDir) { delete _topDir; _topDir = 0; } if (!path.isEmpty()) { _topDir = new ScanDir(path, this, 0, data); } return _topDir; }
void ScanManager::startScan(ScanDir* from) { if (!_topDir) return; if (!from) from = _topDir; if (scanRunning()) stopScan(); from->clear(); if (from->parent()) from->parent()->setupChildRescan(); _list.append(new ScanItem(from->path(),from)); }
/** * @brief MainWindow::createActionButtonBox * * Creates a simple group box with a couple of functions. * Te different functions invoke the actions: * - MainWindow::startFileFinder * - MainWindow::startFileHasher * - MainWindow::startVerifyFiles * - MainWindow::stopScan * - MainWindow::clearResults */ void MainWindow::createActionButtonBox() { findFilesButton = new QPushButton(tr("Find files")); hashFilesButton = new QPushButton(tr("Calculate")); verifyFilesButton = new QPushButton(tr("Verify")); cancelButton = new QPushButton(tr("Stop")); clearResultsButton = new QPushButton(tr("Clear list")); clearHashesButton = new QPushButton(tr("Clear hashes")); clearVerificationsButton = new QPushButton(tr("Clear verifications")); connect(findFilesButton, SIGNAL(clicked()), this, SLOT(startFileFinder())); connect(clearResultsButton, SIGNAL(clicked()), this, SLOT(clearResults())); connect(hashFilesButton, SIGNAL(clicked()), this, SLOT(startFileHasher())); connect(clearHashesButton, SIGNAL(clicked()), this, SLOT(clearHashes())); connect(clearVerificationsButton, SIGNAL(clicked()), this, SLOT(clearVerifications())); connect(verifyFilesButton, SIGNAL(clicked()), this, SLOT(startVerifyFiles())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(stopScan())); progressbar = new QProgressBar; QHBoxLayout* progresslayout = new QHBoxLayout; progresslayout->addWidget(progressbar); progresslayout->addWidget(cancelButton); progresswidget = new QWidget; progresswidget->setLayout(progresslayout); progresswidget->hide(); QGridLayout* actionButtonsLayout = new QGridLayout; actionButtonsLayout->addWidget(findFilesButton, 0, 0); actionButtonsLayout->addWidget(clearResultsButton, 0, 1); actionButtonsLayout->addWidget(hashFilesButton, 1, 0); actionButtonsLayout->addWidget(clearHashesButton, 1, 1); actionButtonsLayout->addWidget(verifyFilesButton, 2, 0); actionButtonsLayout->addWidget(clearVerificationsButton, 2, 1); hashFilesButton->setVisible(false); verifyFilesButton->setVisible(false); clearResultsButton->setVisible(false); clearHashesButton->setVisible(false); clearVerificationsButton->setVisible(false); actionButtons = new QWidget; actionButtons->setLayout(actionButtonsLayout); QVBoxLayout* layout = new QVBoxLayout; layout->addWidget(actionButtons); layout->addWidget(progresswidget); layout->setAlignment(actionButtons, Qt::AlignTop); layout->setAlignment(progresswidget, Qt::AlignTop); actionButtonBox = new QGroupBox("Scanning"); actionButtonBox->setLayout(layout); }
void testScan() { printf("starting scan with max_ap_per_scan#%d base_period#%d threshold#%d \n", stest_max_ap,stest_base_period, stest_threshold); if (!startScan(&onScanResultsAvailable, stest_max_ap,stest_base_period, stest_threshold)) { printMsg("failed to start scan!!\n"); return; } else { EventInfo info; memset(&info, 0, sizeof(info)); while (true) { getEventFromCache(info); printMsg("retrieved event %d : %s\n", info.type, info.buf); retrieveScanResults(); if(--max_event_wait > 0) printMsg("Waiting for more :: %d event \n", max_event_wait); else break; } stopScan(); printMsg("stopped scan\n"); } }
ScanManager::~ScanManager() { stopScan(); delete _topDir; }
void testStopScan() { stopScan(); printMsg("stopped scan\n"); }
void radarStateClass::update(sf::RenderWindow& window) { sf::Event event; while(window.pollEvent(event)) { if(event.type == sf::Event::Closed) { window.close(); return; } else if(event.type == sf::Event::KeyPressed) { if(event.key.code == sf::Keyboard::Tab) { stopScan(); global::activeGameStateStack->pop(); return; } } } ++currentFrame; if(currentFrame > numberOfWaitFrame) { currentFrame = 0; } if(currentFrame == 0) { for(auto circleIte = listOfCircle.begin(); circleIte != listOfCircle.end(); ) { if(circleIte->getOutlineThickness() < maxThickness) { circleIte->setOutlineThickness(circleIte->getOutlineThickness() + 1); if(circleIte->getOutlineThickness() >= maxThickness) { circleIte->setFillColor(sf::Color::Transparent); } } else { circleIte->setRadius(circleIte->getRadius() + 0.1); } if(circleIte->getRadius() > maxRadius) { listOfCircle.erase(circleIte++); continue; } circleIte->setOrigin(circleIte->getRadius(), circleIte->getRadius()); ++circleIte; } } if(scannerTimer.getElapsedTime().asSeconds() > timeBetweenScan && inScan == false) { startScan(); } if(inScan == true) { moveScannerAndScan(); } global::activeGameStateStack->oldUpdate(window); }
/* * @brief Constructor of the main class * The Constructor initializes all needed variables and one instance of every used dialog. */ CReaderTool::CReaderTool(QWidget *parent) : QMainWindow(parent) , QrfeTraceModule("Reader_Tool") { m_updateThread = NULL; int alignment = Qt::AlignHCenter | Qt::AlignBottom; //Mod by yingwei tseng for hiding AMS code, 2010/03/10 #if 0 QPixmap logo(":/ams logos/amsStartupLogo"); #endif QPixmap logo(":/ams logos/mtiRfidLogo"); //End by yingwei tseng for hiding AMS code, 2010/03/10 //clark 2011.12.15 //logo.setMask(logo.createHeuristicMask()); QSplashScreen *splash = new QSplashScreen(logo); splash->setMask(logo.mask()); splash->setWindowOpacity(0); splash->show(); for(double i = 0; i < 1; i += 0.05) { splash->setWindowOpacity(i); Sleep(50); } /* Init variables */ m_scanActive = false; splash->showMessage(tr("Initialize GUI..."), alignment); /* Setup the ui */ ui.setupUi(this); this->setWindowTitle(QString(APPLICATION_NAME)); splash->showMessage(tr("Create Handlers..."), alignment); /* Create Action Handler */ m_actionHandler = new CActionHandler(&m_dataHandler, this); /* Create Read Rate Calculator */ m_readRateCalc = new CReadRateCalc(this); /* Create Tag Manager */ m_tagManager = new CTagManager(this); m_amsComWrapper = new USBHIDWrapper(0x0); splash->showMessage(tr("Create Dialogs..."), alignment); /* Create Dialogs */ m_aboutDialog = new QrfeAboutDialog(this); m_keyDialog = new QrfeKeyWindow(this); m_tagListDialog = new CTagListView(m_tagManager, this); m_settingsDialog = new CSettingsDialog(this); m_tagSettingsDialog = new CTagSettingsDialog(&m_dataHandler, this); m_gen2SettingsDialog = new CGen2TagDialog(this); /* Create the view manager */ m_tagViewManager = new CTagViewManager(ui.readerTreeWidget, &m_dataHandler, m_readRateCalc, this); m_tagViewManager->setUp( m_settingsDialog->showAlias(), m_settingsDialog->useTtl(), m_settingsDialog->msecsToShowInactive(), m_settingsDialog->msecsToShowOutOfRange(), m_settingsDialog->msecsToDelete()); QObject::connect(m_tagViewManager, SIGNAL(requestTagSettings(QString)), this, SLOT(requestTagSettingsDialog(QString))); QObject::connect(m_tagViewManager, SIGNAL(requestTagAdvancedSettings(QString, QString)), this, SLOT(requestTagAdvancedSettingsDialog(QString, QString))); QObject::connect(m_tagViewManager, SIGNAL(requestReaderAdvancedSettings(QString)), this, SLOT(requestReaderAdvancedSettingsDialog(QString))); QObject::connect(m_tagViewManager, SIGNAL(requestReaderRegisterMap(QString)), this, SLOT(requestReaderRegisterMap(QString))); QObject::connect(m_tagViewManager, SIGNAL(newTagCount(int)), ui.tagCountNumber, SLOT(display(int))); QObject::connect(m_tagViewManager, SIGNAL(newDifferentTagCount(int)), ui.differentTagCountNumber, SLOT(display(int))); QObject::connect(m_tagViewManager, SIGNAL(newOverallDifferentTagCount(int)), ui.overallDifferentTagCountNumber, SLOT(display(int))); QObject::connect(m_tagViewManager, SIGNAL(oldTagEntryRemoved(QString,QString)), m_tagManager, SLOT(oldTagEntryRemoved(QString,QString))); QObject::connect(m_tagViewManager, SIGNAL(currentReaderChanged(QString)), this, SLOT(currentReaderChanged(QString))); QObject::connect(m_tagViewManager, SIGNAL(countTotalTags(QString)), this, SLOT(countTotalTags(QString))); splash->showMessage(tr("Connect..."), alignment); /* Connect the signals of the gui to the right slots */ QObject::connect(QrfeTrace::getInstance(), SIGNAL(traceSignal(QString)), ui.traceBrowser, SLOT(append(QString))); QObject::connect(ui.actionAboutReaderTool, SIGNAL(triggered (bool)), m_aboutDialog, SLOT(exec())); QObject::connect(ui.actionShow_TagList, SIGNAL(triggered (bool)), m_tagListDialog, SLOT(exec())); QObject::connect(ui.readerTabWidget, SIGNAL(currentChanged(int)), this, SLOT(selectReader(int))); QObject::connect(ui.startScanButton, SIGNAL(toggled (bool)), this, SLOT(startScan(bool))); QObject::connect(ui.handleActionPushButton, SIGNAL(toggled(bool)), this, SLOT(handleActionsToggled(bool))); QObject::connect(ui.actionAdd_Serial_Reader, SIGNAL(triggered(bool)), this, SLOT(addSerialReader())); //Del by yingwei tseng for hiding AMS code, 2010/03/10 //QObject::connect(ui.actionAdd_Tcp_Reader, SIGNAL(triggered(bool)), this, SLOT(addTcpReader())); //End by yingwei tseng for hiding AMS code, 2010/03/10 QObject::connect(ui.actionHandle_Actions, SIGNAL(triggered(bool)), this, SLOT(handleActionsToggled(bool))); QObject::connect(ui.actionShow_Alias_Names, SIGNAL(triggered ( bool)), this, SLOT(showAliasNames(bool))); QObject::connect(ui.actionUse_Time_To_Live, SIGNAL(triggered ( bool)), this, SLOT(useTimeToLive(bool))); QObject::connect(ui.actionPreferences, SIGNAL(triggered ( bool)), this, SLOT(showSettings())); QObject::connect(ui.actionOpen_Register_Map, SIGNAL(triggered ( bool)), this, SLOT(showRegisterMap())); QObject::connect(ui.clearButton, SIGNAL(clicked()), m_readRateCalc, SLOT(clearResults())); QObject::connect(ui.actionClear_Tags, SIGNAL(triggered (bool)), m_readRateCalc, SLOT(clearResults())); QObject::connect(ui.clearButton, SIGNAL(clicked()), m_tagViewManager, SLOT(clearTags())); QObject::connect(ui.actionClear_Tags, SIGNAL(triggered (bool)), m_tagViewManager, SLOT(clearTags())); QObject::connect(ui.clearOfflineReaderButton, SIGNAL(clicked()), m_tagViewManager, SLOT(clearOfflineReader())); QObject::connect(ui.clearOfflineReaderButton, SIGNAL(clicked()), this, SLOT(clearOfflineReader())); QObject::connect(ui.actionClear_Offline_Reader, SIGNAL(triggered(bool)), m_tagViewManager, SLOT(clearOfflineReader())); QObject::connect(m_gen2SettingsDialog, SIGNAL(easterKeyUnlocked()), this, SLOT(easterKeyUnlocked())); /* Create the scan timer to get the end of the scan */ m_scanTimer = new QTimer(this); m_scanTimer->setSingleShot(true); QObject::connect(m_scanTimer, SIGNAL(timeout()), this, SLOT(stopScan())); /* Create timer for the scan progress bar */ m_scanProgressTimer = new QTimer(this); m_scanProgressTimer->setSingleShot(false); m_scanProgressTimer->setInterval(1000); m_regMapWindow = NULL; /* Connect to the Reader Manager */ QObject::connect(this, SIGNAL(currentReaderChanged(QrfeReaderInterface*)), m_amsComWrapper, SLOT(gotReader(QrfeReaderInterface*))); QObject::connect(&m_readerManager, SIGNAL(lostReader(QrfeReaderInterface*)), m_amsComWrapper, SLOT(lostReader(QrfeReaderInterface*))); QObject::connect(&m_readerManager, SIGNAL(gotReader(QrfeReaderInterface*)), this, SLOT(gotReader(QrfeReaderInterface*))); QObject::connect(&m_readerManager, SIGNAL(lostReader(QrfeReaderInterface*)), this, SLOT(lostReader(QrfeReaderInterface*))); //Add by yingwei tseng for using bar to set power, 2010/07/09 QObject::connect(ui.powerSlider, SIGNAL(valueChanged(int)), this, SLOT(powerSliderChange(int))); //End by yingwei tseng for using bar to set power, 2010/07/09 /* Create the timer for the multiplexer control */ m_multiplexTimer = new QTimer(this); m_multiplexTimer->setSingleShot(true); m_multiplexTimer->setInterval(m_settingsDialog->multiplexTime()); QObject::connect(m_multiplexTimer, SIGNAL(timeout()), this, SLOT(multiplexISR())); /* Finally set up the gui */ ui.traceDockWidget->setVisible(false); ui.informationBox->setVisible(false); ui.actionShow_Alias_Names->setChecked(m_settingsDialog->showAlias()); ui.actionUse_Time_To_Live->setChecked(m_settingsDialog->useTtl()); splash->showMessage(tr("Starting up..."), alignment); ActivateSettings(); Sleep(1000); splash->close(); //Add by yingwei tseng for hiding AMS code, 2010/03/10 ui.handleActionPushButton->hide(); ui.clearOfflineReaderButton->hide(); //ui.actionAdd_Serial_Reader->setVisible(false); ui.actionAdd_USB->setVisible(false); ui.actionAdd_Tcp_Reader->setVisible(false); ui.actionHandle_Actions->setVisible(false); ui.actionClear_Offline_Reader->setVisible(false); //End by yingwei tseng for hiding AMS code, 2010/03/10 //Add by yingwei tseng for hiding items, 2010/12/08 ui.actionShow_Alias_Names->setVisible(false); ui.actionUse_Time_To_Live->setVisible(false); ui.actionShow_Trace_Browser->setVisible(false); ui.actionShow_TagList->setVisible(false); //End by yingwei tseng for hiding items, 2010/12/08 ui.groupBox_3->hide(); }