doorbird: Add Qt6 support

This commit is contained in:
Simon Stürz 2025-08-07 16:27:28 +02:00
parent e673a6fcea
commit 8809ca8d90
5 changed files with 14 additions and 15 deletions

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright 2013 - 2020, nymea GmbH * Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io * Contact: contact@nymea.io
* *
* This file is part of nymea. * This file is part of nymea.
@ -361,7 +361,7 @@ void Doorbird::connectToEventMonitor()
while (!m_readBuffer.isEmpty()) { while (!m_readBuffer.isEmpty()) {
// find next --ioboundary // find next --ioboundary
QString boundary = QStringLiteral("--ioboundary"); QString boundary = QStringLiteral("--ioboundary");
int startIndex = m_readBuffer.indexOf(boundary); int startIndex = m_readBuffer.indexOf(boundary.toUtf8());
if (startIndex == -1) { if (startIndex == -1) {
qCWarning(dcDoorBird) << "No meaningful data in buffer:" << m_readBuffer; qCWarning(dcDoorBird) << "No meaningful data in buffer:" << m_readBuffer;
if (m_readBuffer.size() > 1024) { if (m_readBuffer.size() > 1024) {
@ -387,7 +387,7 @@ void Doorbird::connectToEventMonitor()
// At this point we have the boundary and Content-Type. Remove all of that and take the entire string to either end or next boundary // At this point we have the boundary and Content-Type. Remove all of that and take the entire string to either end or next boundary
m_readBuffer.remove(0, contentTypeIndex + contentType.length()); m_readBuffer.remove(0, contentTypeIndex + contentType.length());
int nextStartIndex = m_readBuffer.indexOf(boundary); int nextStartIndex = m_readBuffer.indexOf(boundary.toUtf8());
QByteArray data; QByteArray data;
if (nextStartIndex == -1) { if (nextStartIndex == -1) {
data = m_readBuffer; data = m_readBuffer;

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright 2013 - 2020, nymea GmbH * Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io * Contact: contact@nymea.io
* *
* This file is part of nymea. * This file is part of nymea.
@ -37,8 +37,6 @@
#include <QUuid> #include <QUuid>
#include <QImage> #include <QImage>
#include "network/networkaccessmanager.h"
class Doorbird : public QObject class Doorbird : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -89,7 +87,7 @@ public:
void connectToEventMonitor(); void connectToEventMonitor();
private: private:
QHostAddress m_address; QHostAddress m_address;
QNetworkAccessManager *m_networkAccessManager; QNetworkAccessManager *m_networkAccessManager = nullptr;
QByteArray m_readBuffer; QByteArray m_readBuffer;
QList<QNetworkReply *> m_networkRequests; QList<QNetworkReply *> m_networkRequests;
@ -103,7 +101,7 @@ signals:
void requestSent(QUuid requestId, bool success); void requestSent(QUuid requestId, bool success);
void eventReveiced(EventType eventType, bool status); void eventReveiced(EventType eventType, bool status);
void favoritesReceived(QList<FavoriteObject> favourites); void favoritesReceived(QList<Doorbird::FavoriteObject> favourites);
void sessionIdReceived(const QString &sessionId); void sessionIdReceived(const QString &sessionId);
void liveImageReceived(QImage image); void liveImageReceived(QImage image);

View File

@ -1,6 +1,6 @@
include(../plugins.pri) include(../plugins.pri)
QT += network QT *= network gui
SOURCES += \ SOURCES += \
integrationplugindoorbird.cpp \ integrationplugindoorbird.cpp \

View File

@ -31,8 +31,8 @@
#include "integrationplugindoorbird.h" #include "integrationplugindoorbird.h"
#include "plugininfo.h" #include "plugininfo.h"
#include "platform/platformzeroconfcontroller.h" #include <platform/platformzeroconfcontroller.h>
#include "network/zeroconf/zeroconfserviceentry.h" #include <network/zeroconf/zeroconfserviceentry.h>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
@ -270,7 +270,7 @@ void IntegrationPluginDoorbird::onDoorBirdEvent(Doorbird::EventType eventType, b
case Doorbird::EventType::Motion: case Doorbird::EventType::Motion:
thing->setStateValue(doorBirdIsPresentStateTypeId, status); thing->setStateValue(doorBirdIsPresentStateTypeId, status);
if (status) { if (status) {
thing->setStateValue(doorBirdLastSeenTimeStateTypeId, QDateTime::currentDateTime().toTime_t()); thing->setStateValue(doorBirdLastSeenTimeStateTypeId, QDateTime::currentDateTime().toSecsSinceEpoch());
} }
break; break;
case Doorbird::EventType::Doorbell: case Doorbird::EventType::Doorbell:

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright 2013 - 2020, nymea GmbH * Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io * Contact: contact@nymea.io
* *
* This file is part of nymea. * This file is part of nymea.
@ -33,8 +33,9 @@
#include <QImage> #include <QImage>
#include "integrations/integrationplugin.h" #include <integrations/integrationplugin.h>
#include "network/zeroconf/zeroconfservicebrowser.h" #include <network/zeroconf/zeroconfservicebrowser.h>
#include "doorbird.h" #include "doorbird.h"
class QNetworkAccessManager; class QNetworkAccessManager;