MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/application/drivers/SerialPacketReader.hh
2024-06-07 11:12:56 +03:00

56 lines
1.8 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* SerialPacketReader.hh
*
* Created on: 17 дек. 2021 г.
* Author: titov
*/
#ifndef UMLIBRARY_APPLICATION_DRIVERS_SERIALPACKETREADER_HH_
#define UMLIBRARY_APPLICATION_DRIVERS_SERIALPACKETREADER_HH_
#include "../ISetupStep.hh"
#include "../../peripheral/ISerialPort.hh"
#include "../../communication/IBinaryDataSubscriber.hh"
#include <memory_resource>
namespace application { namespace board {
/*!Модуль получает данные из последовательного порта и передает их в бинарном виде.
*
*/
struct SerialPacketReader : public ISetupStep {
peripheral::ISerialPort * serial_port = nullptr;
::communication::IBinaryDataSubscriber * binary_data = nullptr;
std::pmr::memory_resource * memory_resource = nullptr;
bool input( Environment & env );
void build( Environment & env );
struct Links {
Environment::Id serial_port; //!<Подключение к последовательному порту.
Environment::Id binary_data; //!<Интерфейс приемника бинарных данных.
Environment::Id data_memory; //!<Память для обработки кадра.
};
struct Setting {
uint32_t bit_size; //!<Размер кадра в битах.
uint16_t data_reverse; //!<Инверсия порядка байт в посылке (0 - прямой порядок, 1 - обратный порядок).
};
const Links & links;
const configuration::ProcessConfig & params;
const Setting & config;
SerialPacketReader( const Links & links, const Setting & config, const configuration::ProcessConfig & proc );
};
} /* namespace board */
} /* namespace application */
#endif /* UMLIBRARY_APPLICATION_DRIVERS_SERIALPACKETREADER_HH_ */