void SmartMote::config(){ AString conf; AStringList * param = NULL; bool flag; /* se il bottone non è premuto */ if(!checkButton()){ /* ritorno */ return; } /* accendo l'uart */ openUART(); /* inizializzo il modulo come AP */ if(!m_net.initialize(AESP07::APMode)){ /* se fallisce notifico l'errore */ error(); } /* setto il nome come SmartMote e password admin */ if(!m_net.configureAP("SmartMote", "smartmote")){ /* se fallisce notifico l'errore */ error(); } /* imposto l'ip a 192.168.1.1 */ if(!m_net.setIp(AESP07::APMode, "192.168.1.1")){ /* se fallisce notifico l'errore */ error(); } /* disabilito le connessioni multiple */ if(!m_net.setMultipleConnections(false)){ /* se fallisce notifico l'errore */ error(); } /* apro il server sulla porta 8000 */ if(!m_net.listen(8000)){ /* se fallisce notifico l'errore */ error(); } /* aspetto di ricevere la stringa */ while(conf.isEmpty()){ m_net.waitForData(conf); } /* prendo i parametri */ param = conf.split(' '); /* se la stringlist è allocata correttamente */ if(param){ saveSSID(param->at(0)); saveKey(param->at(1)); saveHost(param->at(2)); RTCC.setHours(static_cast<uint32>(param->at(3).toInt32(flag))); RTCC.setMinutes(static_cast<uint32>(param->at(3).toInt32(flag))); RTCC.setSeconds(static_cast<uint32>(param->at(3).toInt32(flag))); }else{ /* altrimenti notifico l'errore */ error(); } /* spengo i led */ turnOffRed(); turnOffGreen(); }
void DatabaseLogin::copy(DatabaseLogin const &oSource) { setUser(oSource.getUser()); setPassword(oSource.getPassword()); setDatabase(oSource.getDatabase()); setHost(oSource.getHost()); setPort(oSource.getPort()); saveHost(oSource.requiresSaveHost()); }
void DatabaseLogin::clear(void) { setUser(""); setPassword(""); setDatabase(""); setHost(""); setPort(-1); saveHost(false); }