56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
/*
|
|
* BiSSCDataChannel.hh
|
|
*
|
|
* Created on: 31 îêò. 2021 ã.
|
|
* Author: titov
|
|
*/
|
|
|
|
#ifndef UMLIBRARY_DRIVER_BISSCDATACHANNEL_HH_
|
|
#define UMLIBRARY_DRIVER_BISSCDATACHANNEL_HH_
|
|
|
|
#include "../communication/format/BinaryDataPublisher.hh"
|
|
|
|
#include <memory_resource>
|
|
#include <vector>
|
|
|
|
namespace driver {
|
|
|
|
class BiSSCDataChannel: public communication::ISubscriberRegistrator,
|
|
public communication::IBinaryDataSubscriber {
|
|
|
|
public:
|
|
struct CrcInfo {
|
|
|
|
typedef uint16_t Bits;
|
|
|
|
enum CrcPolynom {
|
|
//only biss-c compatible
|
|
None,
|
|
};
|
|
|
|
Bits crc_value_size = 0;
|
|
Bits crc_value_offset = 0;
|
|
|
|
CrcPolynom crc_polynom = None;
|
|
|
|
};
|
|
|
|
BiSSCDataChannel( std::pmr::memory_resource * memory_resource, CrcInfo crc_params = CrcInfo() );
|
|
|
|
void addSubscriber( std::size_t bit_address, std::size_t bit_len, communication::IBinaryDataSubscriber * subscriber ) override;
|
|
void read( const void * data, std::size_t size);
|
|
|
|
const bool & fault();
|
|
|
|
private:
|
|
communication::format::BinaryDataPublisher fields; //!<Ïîëÿ àáîíåíòà.
|
|
|
|
//todo: add crc control.
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* UMLIBRARY_DRIVER_BISSCDATACHANNEL_HH_ */
|