static bool readConfig(EVMod *mod) { HSP_mod_OVS *mdata = (HSP_mod_OVS *)mod->data; HSP *sp = (HSP *)EVROOTDATA(mod); resetConfig(&mdata->config); if(sp->sFlowSettings == NULL) return NO; mdata->config.sampling_n = sp->sFlowSettings->samplingRate; mdata->config.polling_secs = sp->actualPollingInterval; mdata->config.header_bytes = sp->sFlowSettings->headerBytes; char ipbuf[51]; SFLAddress_print(&sp->agentIP, ipbuf, 50); setStr(&mdata->config.agent_ip, ipbuf); setStr(&mdata->config.agent_dev, sp->agentDevice); for(HSPCollector *coll = sp->sFlowSettings->collectors; coll; coll = coll->nxt) { if(mdata->config.num_collectors == SFVS_MAX_COLLECTORS) { myLog(LOG_ERR, "OVS: MAX collectors exceeded"); } else { uint32_t i = mdata->config.num_collectors++; SFLAddress_print(&coll->ipAddr, ipbuf, 50); setStr(&mdata->config.collectors[i].ip, ipbuf); mdata->config.collectors[i].port = coll->udpPort; mdata->config.collectors[i].priority = 0; } } // turn the collectors list into the targets string formatTargets(mod); return YES; }
void Mega8Config::loadConfig(const wxString &profile) { bool isNew; if (_config == NULL) { _config = new wxConfig(wxT("Mega8"), wxT("Ready4Next")); if (!readBool(wxT("FirstInit"))) { resetConfig(); writeBool(wxT("FirstInit"), true); saveConfig(profile); } } _currentProfile = profile; isNew = loadKeyboard(profile); _LastFolder = readString(wxT("LastFolder")); _FullScreen = readBool(wxT("FullScreen")); _SpeedAuto = readBool(wxT("SpeedAuto")); _DisplayHUD = readBool(wxT("DisplayHUD")); _Filtered = readBool(wxT("Filtered")); _Sound = readBool(wxT("Sound")); _UseSleep = readBool(wxT("UseSleep")); _SyncClock = readBool(wxT("SyncClock")); _ColorTheme = (Chip8ColorTheme)readLong(wxT("ColorTheme")); _InverseColor = readBool(wxT("InverseColor")); for (int i = 0; i <= sizeof(Chip8Types); i++) { _FrequencyRatio[i] = (long)min((long)max((long)readLong(wxT("FrequencyRatio/") + getMachineTypeStr((Chip8Types) i)), (long)4), (long)9); } // Save this profile if new if (isNew) { saveConfig(profile); } }
void factoryReset() { UART_PRINT("[Blink] Factory reset\r\n"); resetParseClient(); resetConfig(); resetNetwork(); resetBoard(); }
/******************************************************************************* ** ** Function: NfcAdaptation::Finalize() ** ** Description: class finalizer ** ** Returns: none ** *******************************************************************************/ void NfcAdaptation::Finalize() { const char* func = "NfcAdaptation::Finalize"; AutoThreadMutex a(sLock); ALOGD ("%s: enter", func); GKI_shutdown (); resetConfig(); nfc_nci_close(mHalDeviceContext); //close the HAL's device context mHalDeviceContext = NULL; mHalCallback = NULL; memset (&mHalEntryFuncs, 0, sizeof(mHalEntryFuncs)); ALOGD ("%s: exit", func); delete this; }
void LoRa::init(LORA_MODE desiredMode){ config->build(desiredMode); resetConfig(); setPublicNetwork(); setFrequencySubBand(); setNetworkName(); setNetworkPassphrase(); setSpreadingFactor(); setAckRetries(); setTxPower(); saveConfig(); if(config->isActiv()){ joinNetwork(); } }
//__________________________________________________________________________ void Speller::Aspell::Suggest::resetConfig(const std::string& lang, const std::string& jargon, const std::string& encoding) throw( std::invalid_argument, std::runtime_error ) { // Save new aspell configuration values flang = lang; fjargon = jargon; fencoding = encoding; try { resetConfig(); // Actually reset configuration } catch( const std::invalid_argument& err ) { throw err; } catch( const std::runtime_error& err ) { throw err; } }
Common::Error HugoEngine::run() { s_Engine = this; initGraphics(320, 200, false); _mouse = new MouseHandler(this); _inventory = new InventoryHandler(this); _route = new Route(this); _sound = new SoundHandler(this); // Setup mixer syncSoundSettings(); _text = new TextHandler(this); _topMenu = new TopMenu(this); switch (_gameVariant) { case kGameVariantH1Win: // H1 Win _file = new FileManager_v1w(this); _scheduler = new Scheduler_v1w(this); _intro = new intro_v1w(this); _screen = new Screen_v1w(this); _parser = new Parser_v1w(this); _object = new ObjectHandler_v1w(this); _normalTPS = 9; break; case kGameVariantH2Win: _file = new FileManager_v2w(this); _scheduler = new Scheduler_v1w(this); _intro = new intro_v2w(this); _screen = new Screen_v1w(this); _parser = new Parser_v1w(this); _object = new ObjectHandler_v1w(this); _normalTPS = 9; break; case kGameVariantH3Win: _file = new FileManager_v2w(this); _scheduler = new Scheduler_v1w(this); _intro = new intro_v3w(this); _screen = new Screen_v1w(this); _parser = new Parser_v1w(this); _object = new ObjectHandler_v1w(this); _normalTPS = 9; break; case kGameVariantH1Dos: // H1 DOS _file = new FileManager_v1d(this); _scheduler = new Scheduler_v1d(this); _intro = new intro_v1d(this); _screen = new Screen_v1d(this); _parser = new Parser_v1d(this); _object = new ObjectHandler_v1d(this); _normalTPS = 8; break; case kGameVariantH2Dos: _file = new FileManager_v2d(this); _scheduler = new Scheduler_v2d(this); _intro = new intro_v2d(this); _screen = new Screen_v1d(this); _parser = new Parser_v2d(this); _object = new ObjectHandler_v2d(this); _normalTPS = 8; break; case kGameVariantH3Dos: _file = new FileManager_v3d(this); _scheduler = new Scheduler_v3d(this); _intro = new intro_v3d(this); _screen = new Screen_v1d(this); _parser = new Parser_v3d(this); _object = new ObjectHandler_v3d(this); _normalTPS = 9; break; } if (!loadHugoDat()) return Common::kUnknownError; // Use Windows-looking mouse cursor _screen->setCursorPal(); _screen->resetInventoryObjId(); _scheduler->initCypher(); initStatus(); // Initialize game status initConfig(); // Initialize user's config if (!_status._doQuitFl) { initialize(); resetConfig(); // Reset user's config initMachine(); // Start the state machine _status._viewState = kViewIntroInit; int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { _status._skipIntroFl = true; _file->restoreGame(loadSlot); } else { _file->saveGame(0, "New Game"); } } while (!_status._doQuitFl) { _screen->drawBoundaries(); g_system->updateScreen(); runMachine(); // Handle input Common::Event event; while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: _parser->keyHandler(event); break; case Common::EVENT_MOUSEMOVE: _mouse->setMouseX(event.mouse.x); _mouse->setMouseY(event.mouse.y); break; case Common::EVENT_LBUTTONUP: _mouse->setLeftButton(); break; case Common::EVENT_RBUTTONUP: _mouse->setRightButton(); break; case Common::EVENT_QUIT: _status._doQuitFl = true; break; default: break; } } if (_status._helpFl) { _status._helpFl = false; _file->instructions(); } _mouse->mouseHandler(); // Mouse activity - adds to display list _screen->displayList(kDisplayDisplay); // Blit the display list to screen _status._doQuitFl |= shouldQuit(); // update game quit flag } return Common::kNoError; }
int ConfigClass::initConfig() { return resetConfig(); }
Mento::Mento(QObject *parent) : QObject(parent) { if(CocoaInitialize::DefaultApp()->checkRunning()) { initsuccess=false; QMessageBox::warning(0,"Warning","Cocoa Mento 正在运行当中!",QMessageBox::Ok,QMessageBox::Ok); return; } else initsuccess=true; log=new QTextBrowser(); log->setWindowModality(Qt::WindowModal); log->setWindowFlags(Qt::WindowStaysOnTopHint|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint); log->setGeometry(200,200,400,500); log->setWindowTitle(tr("认证日志")); gt=new Guite(); main=new Menu("Cocoa Mento"); sub=new Menu("Settings"); status=new MenuItem("[状态:正常] 未连接"); connectHandle=new MenuItem("开始认证"); settings=new MenuItem("偏好设置"); about=new MenuItem("关于CocoaMento"); aboutQt=new MenuItem("关于Qt"); help=new MenuItem("使用说明"); exit=new MenuItem("退出"); resetsettings=new MenuItem("重置偏好设置"); logs=new MenuItem("显示日志"); cv=new ConfigView(); cvcontainer=new MenuViewItem("Settings",cv); cv->setPalette(Qt::white); cv->show(); settings->setSubMenu(sub); main->addMenuItem(status); main->addMenuSeparator(); main->addMenuItem(connectHandle); main->addMenuItem(settings); main->addMenuItem(resetsettings); main->addMenuItem(logs); main->addMenuSeparator(); main->addMenuItem(help); main->addMenuItem(about); main->addMenuItem(aboutQt); main->addMenuSeparator(); main->addMenuItem(exit); sub->addMenuItem(cvcontainer); icon=new StatusIcon(); icon->setMenu(main); icon->showIcon(); mainthread=new MentoThread(cv->Config()); connect((QObject*)exit->port,SIGNAL(trigger()),this,SLOT(quitApp())); connect((QObject*)resetsettings->port,SIGNAL(trigger()),cv,SLOT(resetConfig())); connect((QObject*)connectHandle->port,SIGNAL(trigger()),this,SLOT(toggleConnect())); connect((QObject*)logs->port,SIGNAL(trigger()),log,SLOT(show())); connect((QObject*)about->port,SIGNAL(trigger()),gt,SLOT(showAbout())); connect((QObject*)aboutQt->port,SIGNAL(trigger()),this,SLOT(showAboutQt())); connect((QObject*)help->port,SIGNAL(trigger()),gt,SLOT(showHelp())); connect(mainthread,SIGNAL(output(QString)),this,SLOT(outputHandle(QString))); connect(mainthread,SIGNAL(exitSuccess()),this,SLOT(exitHandle())); connect(mainthread,SIGNAL(statusChanged(QString,int)),this,SLOT(statusHandle(QString,int))); connect(mainthread,SIGNAL(error(QString)),this,SLOT(errorHandle(QString))); connect(mainthread,SIGNAL(authError()),this,SLOT(authMento())); connect(mainthread,SIGNAL(noConfig()),this,SLOT(noconfigHandle())); connect(mainthread,SIGNAL(notify(QString)),this,SLOT(notifyHandle(QString))); if(cv->autoConnect()) toggleConnect(); }
bool PlannerThread::resetPlanVars() { plan_level = 0; restartPlan = false; return resetConfig(); }
bool PlannerThread::planning_cycle() { checkPause(); if (!updateState()) { return false; } checkPause(); if (!completePlannerState()) { return false; } checkPause(); if (!loadState()) { return false; } checkPause(); if (compareState()) { checkPause(); if (!adaptRules()) { return false; } checkPause(); } checkPause(); if (!goalUpdate()) { return false; } checkPause(); if (!loadGoal()) { return false; } checkPause(); if (!planCompletion()) { return true; } checkPause(); if (!checkHoldingSymbols()) { checkPause(); jumpBack(); checkPause(); if (!resetConfig()) { return false; } checkPause(); } else { checkPause(); if (checkGoalCompletion()) { checkPause(); if (!resetRules()) { return false; } checkPause(); if (!resetConfig()) { return false; } checkPause(); if (!loadRules()) { return false; } checkPause(); if (!jumpForward()) { return false; } checkPause(); return true; } checkPause(); int flag_prada = PRADA(); checkPause(); if (flag_prada == 0) { return false; } else if (flag_prada == 2) { if (!increaseHorizon()) { return false; } checkPause(); return true; } if (!loadUsedObjs()) { return false; } checkPause(); if (!codeAction()) { return false; } checkPause(); if (!execAction()) { return false; } checkPause(); if (!preserveState()) { return false; } checkPause(); if (!checkFailure()) { return false; } checkPause(); } checkPause(); return true; }
QgsAuthConfigEdit::QgsAuthConfigEdit( QWidget *parent , const QString& authcfg , const QString &dataprovider ) : QDialog( parent ) , mAuthCfg( authcfg ) , mDataProvider( dataprovider ) , mAuthNotifyLayout( 0 ) , mAuthNotify( 0 ) { bool disabled = QgsAuthManager::instance()->isDisabled(); bool idok = true; if ( !disabled && !authcfg.isEmpty() ) { idok = QgsAuthManager::instance()->configIds().contains( authcfg ); } if ( disabled || !idok ) { mAuthNotifyLayout = new QVBoxLayout; this->setLayout( mAuthNotifyLayout ); QString msg( disabled ? QgsAuthManager::instance()->disabledMessage() : "" ); if ( !authcfg.isEmpty() ) { msg += "\n\n" + tr( "Authentication config id not loaded: %1" ).arg( authcfg ); } mAuthNotify = new QLabel( msg, this ); mAuthNotifyLayout->addWidget( mAuthNotify ); mAuthCfg.clear(); // otherwise will contiue to try authenticate (and fail) after save buttonBox->button( QDialogButtonBox::Save )->setEnabled( false ); } else { setupUi( this ); connect( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( saveConfig() ) ); connect( buttonBox->button( QDialogButtonBox::Reset ), SIGNAL( clicked() ), this, SLOT( resetConfig() ) ); populateAuthMethods(); connect( cmbAuthMethods, SIGNAL( currentIndexChanged( int ) ), stkwAuthMethods, SLOT( setCurrentIndex( int ) ) ); connect( cmbAuthMethods, SIGNAL( currentIndexChanged( int ) ), this, SLOT( validateAuth() ) ); connect( authCfgEdit, SIGNAL( validityChanged( bool ) ), this, SLOT( validateAuth() ) ); // needed (if only combobox is ever changed)? // connect( stkwAuthMethods, SIGNAL( currentChanged( int ) ), // cmbAuthMethods, SLOT( setCurrentIndex( int ) ) ); // connect( stkwAuthMethods, SIGNAL( currentChanged( int ) ), // this, SLOT( validateAuth() ) ); if ( cmbAuthMethods->count() > 0 ) { cmbAuthMethods->setCurrentIndex( 0 ); stkwAuthMethods->setCurrentIndex( 0 ); } loadConfig(); validateAuth(); leName->setFocus(); } }