initial commit
This commit is contained in:
36
client/core/net/ModelServerClient.h
Normal file
36
client/core/net/ModelServerClient.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QNetworkReply>
|
||||
class QNetworkAccessManager;
|
||||
class QUrl;
|
||||
class QNetworkReply;
|
||||
|
||||
namespace core {
|
||||
|
||||
class ModelServerClient final : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ModelServerClient(QObject* parent = nullptr);
|
||||
|
||||
void setBaseUrl(const QUrl& baseUrl);
|
||||
QUrl baseUrl() const;
|
||||
|
||||
// 同步调用:向后端 POST /depth 发送背景图,成功返回 PNG(8-bit 灰度) 的二进制数据。
|
||||
// timeoutMs<=0 表示使用默认超时(30s)。
|
||||
bool computeDepthPng8(const QByteArray& imageBytes, QByteArray& outPngBytes, QString& outError, int timeoutMs = 30000);
|
||||
|
||||
// 异步调用:发起 POST /depth,返回 reply(由 Qt 管理生命周期;调用方负责连接 finished/错误处理)。
|
||||
// 返回 nullptr 表示参数/URL 非法导致无法发起。
|
||||
QNetworkReply* computeDepthPng8Async(const QByteArray& imageBytes, QString* outImmediateError = nullptr);
|
||||
|
||||
private:
|
||||
QNetworkAccessManager* m_nam = nullptr;
|
||||
QUrl m_baseUrl;
|
||||
};
|
||||
|
||||
} // namespace core
|
||||
|
||||
Reference in New Issue
Block a user