// _____________________________________________________________________ // Méthode appelée à chaque fois qu'un noeud change de status de communication // (passe de OK à KO ou l'inverse) void CXbeeNetworkMessenger::on_node_com_status_changed() { NodeBase **node_list = m_xbee_messenger.m_database.getNodesList(); for (int i=0; i<m_xbee_messenger.m_database.getNodeCount(); i++) { NodeBase *node = node_list[i]; if (node) { QString led_name= "led_XbeeMsngNodePresent." + QString(node->getName()); QLed *led = m_ihm.findChild<QLed *>(led_name); // recherche l'objet LED par son nom if (led) { led->setValue(node->isPresent()); } } } }
// _____________________________________________________________________ // Construit automatiquement la page de diagnostique de présenc // en fonction des informations renseignées sur les nodes dans la database void CXbeeNetworkMessenger::initDiagPresencePage() { int ligne=0; NodeBase **node_list = m_xbee_messenger.m_database.getNodesList(); for (int i=0; i<m_xbee_messenger.m_database.getNodeCount(); i++) { NodeBase *node = node_list[i]; if (node) { QString data_name= "XbeeMsngNodePresent." + QString(node->getName()); m_application->m_data_center->write(data_name, QVariant(node->isPresent())); CData *data = m_application->m_data_center->getData(data_name); if (data) { connect(data, SIGNAL(valueChanged(QVariant)), this, SLOT(on_node_com_status_changed())); } QLed *led; led = new QLed(m_ihm.ui.tab_diag); led->setObjectName("led_" + data_name); led->setMaximumSize(QSize(30, 30)); led->setMinimumSize(QSize(20, 20)); led->setValue(node->isPresent()); led->setOnColor(QLed::Green); led->setOffColor(QLed::Grey); led->setShape(QLed::Circle); led->setToolTip(data_name); m_ihm.ui.layout_led_presence->addWidget(led, ligne, 0, 1, 1); QLabel *label = new QLabel(m_ihm.ui.tab_diag); label->setObjectName("lbl_" + data_name); label->setText(node->getName()); label->setToolTip("Node ID=" + QString::number(node->getID())); m_ihm.ui.layout_led_presence->addWidget(label, ligne, 1, 1, 1); ligne++; } } }