#pragma once #include "ByteCommandQueue.h" #include "RestartCommand.h" namespace Incart::DeviceComplexCommands { class MicroMonRestartCommand final : public RestartCommand { private: Usb::ByteCommandQueue* const m_commandQueue; public: MicroMonRestartCommand(uint32_t uid, Usb::ByteCommandQueue* const commandQueue) : RestartCommand(uid) , m_commandQueue(commandQueue) { } public: std::shared_ptr execute() override { //JTerminal() << __PRETTY_FUNCTION__; std::shared_ptr command = std::make_shared("Restart", m_commandQueue->generateUid(), std::vector{ 0x7e, 0x02, 0x00, 0x06, 0x00, 0x08, 0xff, 0xff, 0xbd }); connect(command.get(), &Usb::ByteCommand::answerIsReady, this, &MicroMonRestartCommand::handleAnswerIsReady); m_commandQueue->enqueue(command); return std::make_shared(Usb::DeviceCommand::EStatus::OK); } private slots: void handleAnswerIsReady(std::shared_ptr /*command*/, std::vector answer, int32_t status) { emit answerIsReady(this, Usb::DeviceCommandStatusCreator::create(answer, status)); } }; } // namespace Incart::DeviceComplexCommands