From a688e436f03309d5813b68a375f694412018ca0b Mon Sep 17 00:00:00 2001 From: Nikita Kostovsky Date: Thu, 26 Feb 2026 16:33:12 +0100 Subject: add sync moveSteps --- src/printerclient.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'src/printerclient.h') diff --git a/src/printerclient.h b/src/printerclient.h index d1266dd..189bfb5 100644 --- a/src/printerclient.h +++ b/src/printerclient.h @@ -1,11 +1,42 @@ #pragma once +#include +#include #include - #include class QSerialPort; +class IStand +{ +public: + virtual ~IStand() = default; + +public: + /*! + * \warning be careful when rounding mm to steps + */ + virtual bool moveMm(const double mm) = 0; + virtual bool moveSteps(const int steps) = 0; +}; + +// TODO: think if QObject is needed +class Esp32Stand : public QObject, public IStand +{ +public: + explicit Esp32Stand(const QHostAddress &address, const uint32_t port, const uint32_t stepsPerMm); + ~Esp32Stand() override = default; + +public: + bool moveMm(const double mm) override; + bool moveSteps(const int steps) override; + +private: + QString m_apiRoot; + uint32_t m_stepsPerMm{0}; + QNetworkAccessManager *m_manager{nullptr}; +}; + class PrinterClient : public QObject { // Q_OBJECT -- cgit v1.3