minor fixes and additions
This commit is contained in:
parent
0957a913f8
commit
fea01cf503
3 changed files with 22 additions and 3 deletions
|
@ -87,6 +87,9 @@ public slots:
|
||||||
Q_INVOKABLE bool connectToHost();
|
Q_INVOKABLE bool connectToHost();
|
||||||
//function to connect to the base station
|
//function to connect to the base station
|
||||||
|
|
||||||
|
Q_INVOKABLE bool init();
|
||||||
|
Q_INVOKABLE void deInit();
|
||||||
|
|
||||||
Q_INVOKABLE void closeConnection();
|
Q_INVOKABLE void closeConnection();
|
||||||
|
|
||||||
void gotError(QAbstractSocket::SocketError err);
|
void gotError(QAbstractSocket::SocketError err);
|
||||||
|
|
|
@ -129,9 +129,9 @@ Window {
|
||||||
|
|
||||||
opacity: ( speedBackend.state < 3 ) ? 1:0
|
opacity: ( speedBackend.state < 3 ) ? 1:0
|
||||||
|
|
||||||
width: parent.width * 0.8
|
width: parent.width * 0.7
|
||||||
|
|
||||||
text: ""
|
text: qsTr("Click Start to start")
|
||||||
|
|
||||||
color: appTheme.style.textColor
|
color: appTheme.style.textColor
|
||||||
|
|
||||||
|
@ -147,6 +147,7 @@ Window {
|
||||||
Behavior on text {
|
Behavior on text {
|
||||||
FadeAnimation{
|
FadeAnimation{
|
||||||
target: topLa
|
target: topLa
|
||||||
|
fadeDuration: 200
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,13 +48,26 @@ bool BaseConn::connectToHost() {
|
||||||
// stop the timer as the connection has been established
|
// stop the timer as the connection has been established
|
||||||
timer.stop();
|
timer.stop();
|
||||||
connect(this->socket, &QTcpSocket::readyRead, this, &BaseConn::readyRead);
|
connect(this->socket, &QTcpSocket::readyRead, this, &BaseConn::readyRead);
|
||||||
this->connection_progress = 100;
|
this->connection_progress = 50;
|
||||||
|
|
||||||
|
if(!this->init()){
|
||||||
|
this->closeConnection();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
this->setState("connected");
|
this->setState("connected");
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BaseConn::init() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseConn::deInit() {
|
||||||
|
this->connections.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void BaseConn::closeConnection()
|
void BaseConn::closeConnection()
|
||||||
{
|
{
|
||||||
this->connections = QVariantList({});
|
this->connections = QVariantList({});
|
||||||
|
@ -72,6 +85,8 @@ void BaseConn::closeConnection()
|
||||||
default:
|
default:
|
||||||
socket->abort();
|
socket->abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->deInit();
|
||||||
setState("disconnected");
|
setState("disconnected");
|
||||||
// for(int i = 0; i < this->waitingRequests.length(); i++){
|
// for(int i = 0; i < this->waitingRequests.length(); i++){
|
||||||
// this->waitingRequests[i].reply = "ERR_NOT_CONNECTED";
|
// this->waitingRequests[i].reply = "ERR_NOT_CONNECTED";
|
||||||
|
|
Reference in a new issue