doorbird: Add Qt6 support

master
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
*
* This file is part of nymea.
@ -361,7 +361,7 @@ void Doorbird::connectToEventMonitor()
while (!m_readBuffer.isEmpty()) {
// find next --ioboundary
QString boundary = QStringLiteral("--ioboundary");
int startIndex = m_readBuffer.indexOf(boundary);
int startIndex = m_readBuffer.indexOf(boundary.toUtf8());
if (startIndex == -1) {
qCWarning(dcDoorBird) << "No meaningful data in buffer:" << m_readBuffer;
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
m_readBuffer.remove(0, contentTypeIndex + contentType.length());
int nextStartIndex = m_readBuffer.indexOf(boundary);
int nextStartIndex = m_readBuffer.indexOf(boundary.toUtf8());
QByteArray data;
if (nextStartIndex == -1) {
data = m_readBuffer;

View File

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

View File

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

View File

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

View File

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