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

45 lines
1.4 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_DRIVER_SERIALPACKETREADER_HH_
#define UMLIBRARY_DRIVER_SERIALPACKETREADER_HH_
#include "../systemic/IProcess.hh"
#include "../peripheral/ISerialPort.hh"
#include "../communication/format/BinaryDataPublisher.hh"
namespace driver {
class SerialPacketReader : public systemic::IProcess {
public:
SerialPacketReader( peripheral::ISerialPort & serial_port, communication::IBinaryDataSubscriber & binary_data,
std::pmr::memory_resource * memory_resource, std::size_t bitsize, bool data_invers = false );
//!Основной фоновый метод, отвечающий за прием и чтение и разбор фрейма данных.
void process();
private:
std::vector< char, std::pmr::polymorphic_allocator<char> > data_frame;
peripheral::ISerialPort & serial_port; //!<Интерфейс последовательного порта, по которому будет производится получение пакета данных.
communication::IBinaryDataSubscriber & binary_data; //!<
const std::size_t bitsize; //!<Фиксированный размер посылки.
enum Phase {
request,
response
} phase = request;
bool data_invers;
};
}
#endif /* UMLIBRARY_DRIVER_SERIALPACKETREADER_HH_ */