Пример #1
0
void ExtPlaneConnection::connectTo(QString host, unsigned int port) {
    close();
    _host = host;
    _port = port;
    abort();
    tryReconnect();
}
Пример #2
0
ExtPlaneConnection::ExtPlaneConnection(QObject *parent) : QTcpSocket(parent), updateInterval(0.333) {
    connect(this, SIGNAL(connected()), this, SLOT(socketConnected()));
    connect(this, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
    connect(this, SIGNAL(readyRead()), this, SLOT(readClient()));
    connect(&reconnectTimer, SIGNAL(timeout()), this, SLOT(tryReconnect()));
    server_ok = false;
    enableSimulatedRefs = false;
}
Пример #3
0
void DgMqttHelper::setup(Client& client, const char* clientId,
		const char * domain, uint16_t port) {
	_mqttClient = client;
	_topicPrefix = clientId;
	_clientId = clientId;
	_mqttClient.setClient(client);
	_mqttClient.setServer(domain, port);
	Serial.print("mqttClient state: ");
	Serial.println(_mqttClient.state());
	tryReconnect();
}
Пример #4
0
void DgMqttHelper::loop() {
	if (!_mqttClient.connected()) {
		tryReconnect();
	}
	_mqttClient.loop();
}