int ERModel::addConnection( int componentID, int sourceNodeID, int destinationNodeID, string text ) { Component* sourceNode = searchComponent(sourceNodeID); Component* destinationNode = searchComponent(destinationNodeID); Component* newConnection; ComponentFactory* componentFactory = new ComponentFactory(); if (sourceNode == NULL || destinationNode == NULL ) return PARAMETER_ISERROR; _isModify = true; if (checkConnectionState(sourceNode, destinationNode) == TEXT_CONNECTION_CANCONNECT) { newConnection = static_cast<Component*>(componentFactory->creatComponent(componentID, PARAMETER_CONNECTOR, text, PARAMETER_TEXTUI_COORDINATES, PARAMETER_TEXTUI_COORDINATES)); _components.push_back(newConnection); static_cast<Connector*>(newConnection)->setConnectedNode(sourceNode, destinationNode); _connections.push_back(newConnection); connectionSetting(sourceNode, destinationNode, text); } else return PARAMETER_ISERROR; delete componentFactory; return newConnection->getID(); }
void Cooller_ModBusController::updateState(void) { checkConnectionState(); if (m_explorer && m_explorer->getState() == CoollerExplorer::Ready) { updateStateWidget(); } }
void ClientSocket::keepAlive() { m_isAlive = false; m_socket->putChar(KeepAlivePacket); QTimer::singleShot(TIMEOUT_LIMIT, this, SLOT(checkConnectionState())); }
// The method provides to textUI to get connection error message. string ERModel::getCheckConnectionStateMessage( int sourceNodeID, int destinationNodeID ) { Component* sourceNode = searchComponent(sourceNodeID); Component* desinationNode = searchComponent(destinationNodeID); return checkConnectionState(sourceNode, desinationNode); }