Skip to content

Commit bd6441c

Browse files
send ping without delay for coap
1 parent 13eaf30 commit bd6441c

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

iot-protocols/iotprotocol.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ void IotProtocol::setInternetProtocol(InternetProtocol *value)
4444
{
4545
internetProtocol = value;
4646
}
47+
48+
AccountEntity IotProtocol::getCurrentAccount() const
49+
{
50+
return currentAccount;
51+
}

iot-protocols/iotprotocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class IotProtocol : public QObject
4545
IotProtocol(AccountEntity account);
4646

4747
InternetProtocol *getInternetProtocol() const;
48+
AccountEntity getCurrentAccount() const;
4849
void setInternetProtocol(InternetProtocol *value);
4950

5051
bool getIsConnect() const;

timer/timersmap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void TimersMap::goPingTimer(int keepalive)
6060
}
6161

6262
this->ping = new TimerTask(this->iotProtocol->getPingreqMessage(), this->iotProtocol, keepalive * 1000);
63-
this->ping->start(false);
63+
this->ping->start(this->iotProtocol->getCurrentAccount().protocol.get().toInt() == COAP_PROTOCOL?false:true);
6464
}
6565

6666
void TimersMap::stopPingTimer()

0 commit comments

Comments
 (0)