Exemplo n.º 1
0
LWDAQ_Client::LWDAQ_Client(QString host, quint16 port, QObject *parent) : QObject(parent),
                                  hostName(host),
                                  portNo(port),
                                  currentState(UNSET),
                                  cmdNo(0),
                                  error(false),
                                  errorText("") {

    tcpSocket = new QTcpSocket(this);

    connect(tcpSocket, SIGNAL(connected()), this, SLOT(gotConnected()));
    connect(tcpSocket, SIGNAL(disconnected()), this, SLOT(gotDisconnected()));
    connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readStatus()));
    connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
                this, SLOT(displayError(QAbstractSocket::SocketError)));

    connectTimer = new QTimer(this);
    connectTimer->setInterval(RECONNECT_TIME*1000);
    connectTimer->setSingleShot(true);
    connect(connectTimer, SIGNAL(timeout()), this, SLOT(init()));

    statusTimer = new QTimer(this);
    statusTimer->setInterval(SLOW_UPDATE_TIME*1000);
    statusTimer->setSingleShot(false);
    connect(statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));

    runTimer = new QTimer(this);
    runTimer->setInterval(DEFAULT_RUN_TIME*1000);
    runTimer->setSingleShot(true);
    connect(runTimer, SIGNAL(timeout()), this, SLOT(stopRun()));
}
Exemplo n.º 2
0
void socketSendKey::run()
{
	if( !m_connected ){
		this->openConnection() ;
	}
	if( !m_connected ){
		emit keyNotSent() ;
	}else{
		emit gotConnected() ;
		::zuluCryptPluginManagerSendKey( m_connectionHandle,m_key.constData(),m_key.size() ) ;
		m_closeConnection = false ;
		::zuluCryptPluginManagerCloseConnection( m_connectionHandle ) ;
		emit keySent() ;
	}
}