#pragma once #include "ByteCommand.h" #include "ByteArrayProvider.h" #include "ByteCommandQueue.h" namespace Incart::DeviceComplexCommands { class WriteCalibrationPointCommandCreator { public: static std::shared_ptr create(Usb::ByteCommandQueue* commandQueue, bool isExternal, uint8_t channelType, uint8_t channelNumber, uint8_t pointIndex, uint32_t adcValue, int32_t physicValue, uint8_t range) { std::vector data{ 0x7e, 0x0c, 0x00, 0x00, 0x01, channelType, channelNumber, pointIndex, /*adcValue*/0x00, 0x00, 0x00, 0x00, /*physicValue*/ 0x00, 0x00, 0x00, range, 0xff, 0xff, 0xbd}; data[3] = (isExternal ? 0x22 : 0x21); Common::ByteArrayProvider::setDWordToArray(adcValue, &data[0], 8); Common::ByteArrayProvider::setIntThreeBytesToArray(&data[0], physicValue, 12); return std::make_shared("WriteCalibrationPoint", commandQueue->generateUid(), std::move(data), 19); } }; } // namespace Incart::DeviceComplexCommands