#pragma once #include #include #include "JsonCommand.h" namespace Incart::Net::WebApi { class JsonWebApiCommandWrapper : public QObject { Q_OBJECT private: std::shared_ptr m_jsonCommand; QTcpSocket* m_socket; public: JsonWebApiCommandWrapper(std::shared_ptr jsonCommand, QTcpSocket* socket, QObject* parent = nullptr) : QObject(parent) , m_jsonCommand(jsonCommand) , m_socket(socket) { connect(m_jsonCommand.get(), &JsonCommand::answerIsReady, this, &JsonWebApiCommandWrapper::handleCommandAnswerIsReady); } signals: void answerIsReady(JsonWebApiCommandWrapper* command, QJsonDocument answer, std::shared_ptr status); private slots: void handleCommandAnswerIsReady(JsonCommand* /*command*/, QJsonDocument answer, std::shared_ptr status) { emit answerIsReady(this, answer, status); } public: std::string getName() { return m_jsonCommand->getName(); } uint32_t getUid() { return m_jsonCommand->uid; } QTcpSocket* getSocket() { return m_socket; } }; } // namespace Incart::Net::WebApi