Ejemplo n.º 1
0
void KMessageJabber::slotGroupChatPresence(const XMPP::Jid& jid, const XMPP::Status& status)
{
  kDebug() << jid.full() << status.status();
  if (jid.full() == mPeerJid && !status.isAvailable())
  {
    emit connectionBroken();
  }
}
Cooller_ModBusController::Cooller_ModBusController(CoolerStateWidget *view, ModBusDialog *config) :
    m_view(view), 
    m_configDialog(config),
    m_recheckTimer(new QTimer(this)),
    m_available(false),
    m_comunicationSpeedIndex(6), //9600
    m_currentDeviceID(1),
    m_connector(this),
    m_externalManager(this),
    m_modbus(this)
{
    connect(m_recheckTimer, SIGNAL(timeout()), this, SLOT(updateState()));
    m_recheckTimer->setInterval(500);
    m_recheckTimer->start();
    config->setExternalCommunicator(&m_connector);

    connect(m_configDialog, SIGNAL(speedChanged(int)), this, SLOT(newSpeed(int)));
    connect(m_configDialog, SIGNAL(portChanged(int)), this, SLOT(newPort(int)));
    connect(m_configDialog, SIGNAL(deviceIDChanged(int)), this, SLOT(newDevice(int)));
    connect(&m_connector, SIGNAL(connectionEstablished()), config, SLOT(connectionEstablished()));
    connect(&m_connector, SIGNAL(connectionEstablished()), this, SLOT(sendConfiguration()));
    connect(&m_connector, SIGNAL(connectionBroken()), config, SLOT(connectionBroken()));
    connect(&m_connector, SIGNAL(connectionErrorOccured(QString)), config, SLOT(connectionErrorOccured(QString)));
    connect(&m_externalManager, SIGNAL(stateChanged()), this, SLOT(externalStateChanged()));
    connect(&m_externalManager, SIGNAL(listChanged()), this, SLOT(externalListChanged()));
    connect(&m_modbus, SIGNAL(deviceListUpdated(void)), this, SLOT(deviceObserverWaked()));

    QString configsPath = Configurator::getConfigFilesPath();
    QDirIterator iter(configsPath, QStringList() << "*.xml", QDir::Files | QDir::NoDotAndDotDot, QDirIterator::NoIteratorFlags);
    int configsRed = 0;
    while (iter.hasNext())
    {
        iter.next();
        QString xmlFilePath = iter.filePath();
        if (readXMLConfig(xmlFilePath))
            configsRed++;
    }
    if (0 == configsRed )
    {
        emit newStatus(tr("No config files were found"));
    }
}
Ejemplo n.º 3
0
void KMessageClient::disconnect ()
{
  qCDebug(GAMES_PRIVATE_KGAME) << ": Disconnect:Deleting the connection object";

  emit aboutToDisconnect(id());
  delete d->connection;
  d->connection = 0;
  d->adminID = 0;
  emit connectionBroken();
  qCDebug(GAMES_PRIVATE_KGAME) << ": Disconnect:Deleting the connection object DONE";
}
Ejemplo n.º 4
0
void KMessageClient::removeBrokenConnection2 ()
{
  qCDebug(GAMES_PRIVATE_KGAME) << ": Broken:Deleting the connection object"<<this;

  emit aboutToDisconnect(id());
  delete d->connection;
  d->connection = 0;
  d->adminID = 0;
  emit connectionBroken();
  qCDebug(GAMES_PRIVATE_KGAME) << ": Broken:Deleting the connection object DONE";
}
Ejemplo n.º 5
0
void KMessageClient::disconnect ()
{
  kdDebug (11001) << k_funcinfo << ": Disconnect:Deleting the connection object" << endl;

  emit aboutToDisconnect(id());
  delete d->connection;
  d->connection = 0;
  d->adminID = 0;
  emit connectionBroken();
  kdDebug (11001) << k_funcinfo << ": Disconnect:Deleting the connection object DONE" << endl;
}
Ejemplo n.º 6
0
void KMessageClient::setServer (KMessageIO *connection)
{
  if (d->connection)
  {
    delete d->connection;
    kdDebug (11001) << k_funcinfo << ": We are changing the server!" << endl;
  }

  d->connection = connection;
  if (connection )
  {
    connect (connection, SIGNAL (received(const QByteArray &)),
             this, SLOT (processIncomingMessage(const QByteArray &)));
    connect (connection, SIGNAL (connectionBroken()),
             this, SLOT (removeBrokenConnection ()));
  }
}
void ConnectionParameters::setExternalComunicator(ExternalConnector * comunicator)
{
    m_connector = comunicator;
    connect(m_connector, SIGNAL(connectionEstablished()), this, SLOT(externalConnected()));
    connect(m_connector, SIGNAL(connectionBroken()), this, SLOT(externalDisconnected()));
}
void ExternalConnector::socketDisconnected()
{
    emit connectionBroken();
    m_active = false;
}