Rework after review
Signed-off-by: Martin Lukas <martin.lukas@chargebyte.com>
This commit is contained in:
parent
f90561fb26
commit
b88935bd2f
@ -768,30 +768,30 @@ void IntegrationPluginShelly::joinMulticastGroup()
|
||||
{
|
||||
if (m_coap->joinMulticastGroup()) {
|
||||
qCInfo(dcShelly()) << "Joined CoIoT multicast group";
|
||||
m_multicastRetryCnt = 0;
|
||||
m_multicastWarningPrintCount = 0;
|
||||
} else {
|
||||
uint retryTime = 0;
|
||||
uint mod = m_multicastWarningPrintCount % 120;
|
||||
|
||||
// FIXME: It would probably be better to monitor the network interfaces and re-join if necessary
|
||||
if (m_multicastRetryCnt < 12) {
|
||||
if (m_multicastWarningPrintCount < 12) {
|
||||
qCWarning(dcShelly()) << "Failed to join CoIoT multicast group. Retrying in 5 seconds...";
|
||||
retryTime = 5000;
|
||||
} else {
|
||||
qCWarning(dcShelly()) << "Failed to join CoIoT multicast group. Retrying in 10 minutes...";
|
||||
retryTime = 600000;
|
||||
}
|
||||
|
||||
QTimer::singleShot(retryTime, m_coap, [this](){
|
||||
if (m_multicastWarningPrintCount >= 12 && mod == 0) {
|
||||
qCWarning(dcShelly()) << "Failed to join CoIoT multicast group. Retrying in 10 minutes...";
|
||||
}
|
||||
|
||||
QTimer::singleShot(5000, m_coap, [this](){
|
||||
joinMulticastGroup();
|
||||
});
|
||||
m_multicastRetryCnt++;
|
||||
m_multicastWarningPrintCount++;
|
||||
}
|
||||
}
|
||||
|
||||
void IntegrationPluginShelly::onMulticastMessageReceived(const QHostAddress &source, const CoapPdu &pdu)
|
||||
{
|
||||
Q_UNUSED(source)
|
||||
// qCDebug(dcShelly()) << "Multicast message received" << source << pdu;
|
||||
// qCDebug(dcShelly()) << "Multicast message received" << source << pdu;
|
||||
if (pdu.reqRspCode() != 0x1e) {
|
||||
// Not a shelly CoIoT status message (ReqRsp code "0.30")
|
||||
return;
|
||||
@ -1555,17 +1555,17 @@ void IntegrationPluginShelly::setupGen1(ThingSetupInfo *info)
|
||||
});
|
||||
|
||||
// For testing and debugging, introspect the coap API. Allows introspecting the coap api on the device
|
||||
// url.clear();
|
||||
// url.setScheme("coap");
|
||||
// url.setHost(address.toString());
|
||||
// url.setPath("/cit/d");
|
||||
// url.clear();
|
||||
// url.setScheme("coap");
|
||||
// url.setHost(address.toString());
|
||||
// url.setPath("/cit/d");
|
||||
|
||||
// CoapRequest coapRequest(url);
|
||||
// CoapReply *coapReply = m_coap->get(coapRequest);
|
||||
// qCDebug(dcShelly) << "Coap request" << url;
|
||||
// connect(coapReply, &CoapReply::finished, thing, [=](){
|
||||
// qCDebug(dcShelly) << "Coap reply" << coapReply->error() << qUtf8Printable(QJsonDocument::fromJson(coapReply->payload()).toJson());
|
||||
// });
|
||||
// CoapRequest coapRequest(url);
|
||||
// CoapReply *coapReply = m_coap->get(coapRequest);
|
||||
// qCDebug(dcShelly) << "Coap request" << url;
|
||||
// connect(coapReply, &CoapReply::finished, thing, [=](){
|
||||
// qCDebug(dcShelly) << "Coap reply" << coapReply->error() << qUtf8Printable(QJsonDocument::fromJson(coapReply->payload()).toJson());
|
||||
// });
|
||||
|
||||
|
||||
// Handle thing settings of gateway devices
|
||||
|
||||
@ -94,7 +94,7 @@ private:
|
||||
PluginTimer *m_reconfigureTimer = nullptr;
|
||||
|
||||
Coap *m_coap = nullptr;
|
||||
uint m_multicastRetryCnt = 0;
|
||||
uint m_multicastWarningPrintCount = 0;
|
||||
|
||||
QHash<Thing*, ShellyJsonRpcClient*> m_rpcClients;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user