1
0
forked from BRT/arc
arc/services/DeviceScreener.h
slava 712b73316c Remove CommonBirbankScript and its derived classes from the codebase
Deleted `CommonBirbankScript` and its associated derived classes (`GetLastDaysHistoryBirbankScript`, `LoginAndCheckAccountsBirbankScript`, `PayByCardBirbankScript`). Removed dependencies on these scripts, including XML parsing, account handling, and transaction workflows related to the Birbank app.
2026-03-21 17:41:05 +07:00

49 lines
1.3 KiB
C++

#pragma once
#include <QObject>
#include <QNetworkAccessManager>
#include <dao/DeviceDAO.h>
#include <db/DeviceInfo.h>
class DeviceScreener final : public QObject {
Q_OBJECT
public:
explicit DeviceScreener(QObject *parent = nullptr);
~DeviceScreener() override;
public slots:
void start();
void stop();
signals:
void finished();
private:
bool m_running = true;
bool m_firstScan = true;
QString m_urlAppUpdate;
QString m_token;
QString m_apiBase;
QNetworkAccessManager *m_manager = nullptr;
QMap<QString, qint64> m_lastApiUpdate; // deviceId → unix timestamp последнего PATCH
static QList<QPair<QString, QString> > readAdbDevices();
static QByteArray takeScreenshot(const QString &deviceId);
static DeviceInfo readDeviceInfo(const QString &deviceId, bool isChecked);
void postDevicesData(const QList<DeviceInfo> &devices);
QJsonValue apiGet(const QString &path);
QJsonValue apiPost(const QString &path, const QJsonObject &body);
void apiPatch(const QString &path, const QJsonObject &body);
QString createDeviceOnApi(const DeviceInfo &device);
void updateDeviceOnApi(const DeviceInfo &device);
void postScreenshotToApi(const QString &apiId, const QByteArray &image);
void toggleBankProfilesOnApi(const QString &deviceId, bool enable);
};