BoardRight::BoardRight(QWidget *parent, SubteStatus * subte, EventHandler *eventHandler) : BaseBoard(parent,subte,eventHandler), ui(new Ui::BoardRight) { ui->setupUi(this); QSize buttonSize; buttonSize.setWidth(78); buttonSize.setHeight(78); ui->CONDisy_widget->setSize(buttonSize); ui->DESDisy_widget->setSize(buttonSize); ui->calientapies->setSize(buttonSize); ui->frenoRetencion->setSize(buttonSize); ui->desacople->setSize(buttonSize); connect(m_eventHandler,SIGNAL(controlReady()),this,SLOT(startBoard())); connect(m_eventHandler,SIGNAL(controlDisable()),this,SLOT(disableScreen())); connect(m_eventHandler,SIGNAL(controlEnable()),this,SLOT(enableScreen())); connect(m_eventHandler,SIGNAL(controlReset()),this,SLOT(resetControls())); connect(m_eventHandler,SIGNAL(cargarEstado(int)),this,SLOT(loadState(int))); m_manometer = NULL; m_CON_Disyuntor = NULL; m_DES_Disyuntor = NULL; m_sicasmac = NULL; m_modoConduccion = NULL; m_frenoRetencion = NULL; }
BoardHardware::BoardHardware(QWidget *parent, SubteStatus * subte, EventHandler *eventHandler) : BaseBoard(parent,subte,eventHandler), ui(new Ui::BoardHardware) { ui->setupUi(this); connect(m_eventHandler,SIGNAL(controlReady()),this,SLOT(startBoard())); connect(m_eventHandler,SIGNAL(controlDisable()),this,SLOT(disableScreen())); connect(m_eventHandler,SIGNAL(controlEnable()),this,SLOT(enableScreen())); connect(m_eventHandler,SIGNAL(controlReset()),this,SLOT(resetControls())); connect(m_eventHandler,SIGNAL(cargarEstado(int)),this,SLOT(loadState(int))); connect(m_eventHandler,SIGNAL(bPressed()),this,SLOT(bocinaON())); connect(m_eventHandler,SIGNAL(bReleased()),this,SLOT(bocinaOFF())); // connect(m_eventHandler,SIGNAL(aPressed()),this,SLOT(ranaAD())); // connect(m_eventHandler,SIGNAL(ceroPressed()),this,SLOT(ranaCERO())); // connect(m_eventHandler,SIGNAL(rPressed()),this,SLOT(ranaAT())); connect(m_eventHandler,SIGNAL(fPressed()),this,SLOT(setaON())); connect(m_eventHandler,SIGNAL(tPressed()),this,SLOT(setaOFF())); m_horn = NULL; // m_tractionLever = NULL; // m_rana = NULL; // m_hombreMuerto = NULL; m_setaButton = NULL; m_tractionHardware = NULL; }
/********************************************************** * @brief backmm (back with control, no pulling function * @param speed ( 0 to 100 ), distance millimeter * @retval None **********************************************************/ void backmm(int speed, int distance) { String commande; int state = 0; controlEnable(); commande = "#MBC," + String(distance*4) + "," + String(speed) + "!"; Serial.println(commande); }
/********************************************************** * @brief turnRightControl * @param * @retval None **********************************************************/ static void turnRightControl(int speed, int angle) { String commande; controlEnable(); if(state_control == true) { commande = "#TRC," + String(angle) + "," + String(speed) + "!"; Serial.println(commande); } }
BoardLeft::BoardLeft(QWidget *parent, SubteStatus * subte, EventHandler *eventHandler) : BaseBoard(parent,subte,eventHandler), ui(new Ui::BoardLeft) { ui->setupUi(this); connect(m_eventHandler,SIGNAL(controlReady()),this,SLOT(startBoard())); connect(m_eventHandler,SIGNAL(controlDisable()),this,SLOT(disableScreen())); connect(m_eventHandler,SIGNAL(controlEnable()),this,SLOT(enableScreen())); connect(m_eventHandler,SIGNAL(controlReset()),this,SLOT(resetControls())); connect(m_eventHandler,SIGNAL(cargarEstado(int)),this,SLOT(loadState(int))); }
/********************************************************** * @brief forwardControl * @param speed ( 0 to 100 ) * @retval None **********************************************************/ static void forwardControl(int speed, int distance) { String commande; controlEnable(); if(state_control == true) { commande = "#MFC," + String(distance) + "," + String(speed) + "!"; Serial.println(commande); } }
/********************************************************** * @brief forwardmm (forward with control, no pulling function * @param speed ( 0 to 100 ), distance millimeter * @retval None **********************************************************/ void forwardmm(int speed, int distance) { String commande; int state = 0; static bool fmm = false; controlEnable(); commande = "#MFC," + String(distance*4) + "," + String(speed) + "!"; Serial.println(commande); }
void MusicDownloadWidget::initWidget() { m_ui->loadingLabel->run(true); controlEnable(true); if(m_queryType == MusicDownLoadQueryThreadAbstract::MovieQuery) { m_ui->downloadPathEdit->setText(MOVIE_DIR_FULL); } else { m_ui->downloadPathEdit->setText(M_SETTING_PTR->value(MusicSettingManager::DownloadMusicPathDirChoiced).toString()); } }
/********************************************************** * @brief turnLeft_degree * @param speed ( 0 to 100 ), angle (0 to 360) * @retval None **********************************************************/ void turnLeft_degree(int speed, unsigned int angle) { float angle_degree = 0; int angle_turn; controlEnable(); if((angle >= 0)&&(angle <= 360)) { angle_degree = (float)(angle*546.0); angle_degree = (float)(angle_degree/90.0); angle_turn = (int)(angle_degree); turnLeftC(speed, angle_turn); } else { // error angle value } controlDisable(); }
void MusicDownloadWidget::initWidget() { controlEnable(true); QString path = M_SETTING->value(MusicSettingManager::DownloadMusicPathDirChoiced).toString(); ui->downloadPathEdit->setText(path.isEmpty() ? MUSIC_DOWNLOAD_AL : path); }
/********************************************************** * @brief back_mm (forward with control) - pulling function * @param speed ( 0 to 100 ), distance millimeter * @retval None **********************************************************/ void back_mm(int speed, int distance) { controlEnable(); backC(speed, distance*4); //controlDisable(); }
/********************************************************** * @brief forward_mm (forward with control, pulling function) * @param speed ( 0 to 100 ), distance millimeter * @retval None **********************************************************/ void forward_mm(int speed, int distance) { controlEnable(); forwardC(speed, distance*4); }
void EventHandler::processValueChanged(std::string host, std::string key, std::string value){ qDebug() << "value - key:: host:" << host.c_str() << " key:"<< key.c_str() << " value:" << value.c_str() << "time: " << QTime::currentTime().toString() ; if(key.compare("i_iniciar_simulador") == 0){ if (value.compare("con") == 0){ qDebug() << "i_iniciar_simulador con recibido" ; m_eNetHelper->client()->CambiarValorClave("c_listo","0"); emit controlReady(); m_eNetHelper->client()->Suscribirse(m_eNetHelper->instructionsHostName(),"i_estado_simulador"); m_eNetHelper->client()->Suscribirse(m_eNetHelper->visualHostName(),"v_velocidad"); m_eNetHelper->client()->Suscribirse(m_eNetHelper->visualHostName(),"v_voltaje"); m_eNetHelper->client()->Suscribirse(m_eNetHelper->visualHostName(),"v_esfuerzo"); m_eNetHelper->client()->Suscribirse(m_eNetHelper->visualHostName(),"v_estado_puertas"); emit controlReset(); m_eNetHelper->client()->CambiarValorClave("c_rana","at"); m_eNetHelper->client()->CambiarValorClave("c_regulador_mando","0"); m_eNetHelper->client()->CambiarValorClave("c_traccion","0"); m_eNetHelper->client()->CambiarValorClave("c_freno_emergencia","des"); emit controlDisable(); m_eNetHelper->client()->CambiarValorClave("c_listo","1"); }else if (value.compare("des") == 0){ m_eNetHelper->client()->CambiarValorClave("c_listo","0"); m_eNetHelper->client()->CambiarValorClave("c_regulador_mando"," "); m_eNetHelper->client()->CambiarValorClave("c_llave_atp"," "); m_eNetHelper->client()->CambiarValorClave("c_modo_conduccion"," "); Sleep(1000); emit closeApp(); } } else if(key.compare("i_estado_simulador") == 0){ if (value.compare("0") == 0){ qDebug() << "i_estado_simulador 0 recibido" ; m_eNetHelper->client()->CambiarValorClave("c_listo","0"); emit controlReset(); m_eNetHelper->client()->CambiarValorClave("c_rana","at"); m_eNetHelper->client()->CambiarValorClave("c_regulador_de_mando","0"); m_eNetHelper->client()->CambiarValorClave("c_traccion","0"); emit controlDisable(); m_eNetHelper->client()->CambiarValorClave("c_listo","1"); } else if(value.compare("1") == 0){ emit controlEnable(); } else if(value.compare("2") == 0){ emit controlDisable(); } } else if(key.compare("v_velocidad") == 0){ m_subte->updateSpeed(std::stod(value)); qDebug() << "Velocidad ingresa velocidad correcta." ; } else if(key.compare("v_voltaje") == 0){ try{ m_subte->updateVolt(std::stod(value)); } catch (...) { qDebug() << "voltaje incorrecta." ; } } else if(key.compare("v_voltaje") == 0){ try{ m_subte->updateVolt(std::stod(value)); } catch (...) { qDebug() << "voltaje incorrecta." ; } } else if(key.compare("v_esfuerzo") == 0){ try{ m_subte->updateAmm(std::stod(value)); } catch (...) { qDebug() << "esfuerzo incorrecta." ; } } else if(key.compare("v_estado_puertas") == 0){ try{ qDebug() << "cambio de estado de puertas"; QString message = value.c_str(); QStringList parameters = message.split(";"); std::string side = parameters.at(0).toStdString(); std::string state = parameters.at(1).toStdString(); if(side.compare("derecha") == 0){ if(state.compare("abierto") == 0){ m_subte->openRightDoors(); qDebug() << "puertas derechas abiertas"; } else if(state.compare("cerrado") == 0){ m_subte->closeRightDoors(); qDebug() << "puertas derechas cerradas"; } } else { if(state.compare("abierto") == 0){ m_subte->openLeftDoors(); qDebug() << "puertas izquierdas abiertas"; } else if(state.compare("cerrado") == 0){ m_subte->closeLeftDoors(); qDebug() << "puertas izquierdas cerrado"; } } } catch (...) { qDebug() << "valor puertas incorrecto." ; } } }