ChimeraTK-DeviceAccess  03.18.00
ChimeraTK::RebotBackend Class Reference

#include <RebotBackend.h>

+ Inheritance diagram for ChimeraTK::RebotBackend:
+ Collaboration diagram for ChimeraTK::RebotBackend:

Public Member Functions

 RebotBackend (std::string boardAddr, std::string port, const std::string &mapFileName="", uint32_t connectionTimeout_sec=DEFAULT_CONNECTION_TIMEOUT_sec)
 
 ~RebotBackend () override
 
void open () override
 The function opens the connection to the device. More...
 
void closeImpl () override
 All backends derrived from NumericAddressedBackend must implement closeImpl() instead of close. More...
 
void read (uint8_t bar, uint32_t addressInBytes, int32_t *data, size_t sizeInBytes) override
 
void write (uint8_t bar, uint32_t addressInBytes, int32_t const *data, size_t sizeInBytes) override
 
std::string readDeviceInfo () override
 Return a device information string containing hardware details like the firmware version number or the slot number used by the board. More...
 
size_t minimumTransferAlignment ([[maybe_unused]] uint64_t bar) const override
 Determines the supported minimum alignment for any read/write requests. More...
 
- Public Member Functions inherited from ChimeraTK::NumericAddressedBackend
 NumericAddressedBackend (const std::string &mapFileName="", std::unique_ptr< NumericAddressedRegisterCatalogue > registerMapPointer=std::make_unique< NumericAddressedRegisterCatalogue >())
 
 ~NumericAddressedBackend () override=default
 
virtual void read (uint64_t bar, uint64_t address, int32_t *data, size_t sizeInBytes)
 Read function to be implemented by backends. More...
 
virtual void write (uint64_t bar, uint64_t address, int32_t const *data, size_t sizeInBytes)
 Write function to be implemented by backends. More...
 
virtual void read ([[maybe_unused]] uint8_t bar, [[maybe_unused]] uint32_t address, [[maybe_unused]] int32_t *data, [[maybe_unused]] size_t sizeInBytes)
 Deprecated read function using 32bit address for backwards compatibility. More...
 
virtual void write ([[maybe_unused]] uint8_t bar, [[maybe_unused]] uint32_t address, [[maybe_unused]] int32_t const *data, [[maybe_unused]] size_t sizeInBytes)
 Deprecated write function using 32bit address for backwards compatibility. More...
 
virtual bool barIndexValid (uint64_t bar)
 Function to be implemented by the backends. More...
 
virtual bool canMergeRequests () const
 Determines whether the backend supports merging of requests (read or write) More...
 
RegisterCatalogue getRegisterCatalogue () const override
 Return the register catalogue with detailed information on all registers. More...
 
MetadataCatalogue getMetadataCatalogue () const override
 Return the device metadata catalogue. More...
 
NumericAddressedRegisterInfo getRegisterInfo (const RegisterPath &registerPathName)
 getRegisterInfo returns a NumericAddressedRegisterInfo object for the given register. More...
 
void activateAsyncRead () noexcept override
 Activate asyncronous read for all transfer elements where AccessMode::wait_for_new_data is set. More...
 
void close () final
 Deactivates all asynchronous accessors and calls closeImpl(). More...
 
virtual std::future< void > activateSubscription (uint32_t interruptNumber, boost::shared_ptr< async::DomainImpl< std::nullptr_t >> asyncDomain)
 Activate/create the subscription for a given interrupt (for instance by starting the according interrupt handling thread). More...
 
void setExceptionImpl () noexcept override
 Turn off the internal variable which remembers that async is active. More...
 
template<typename BackendSpecificUserType >
std::pair< BackendSpecificUserType, VersionNumbergetAsyncDomainInitialValue (size_t asyncDomainId)
 Get the initial value for a certain async::Domain. More...
 
template<typename BackendSpecificUserType >
std::pair< BackendSpecificUserType, VersionNumbergetAsyncDomainInitialValue ([[maybe_unused]] size_t asyncDomainId)
 
- Public Member Functions inherited from ChimeraTK::DeviceBackendImpl
bool isOpen () override
 Return whether a device has been opened or not. More...
 
bool isConnected () final
 Deprecated since 2022-03-03. More...
 
void checkActiveException () final
 Function to be called by backends when needing to check for an active exception. More...
 
void setException (const std::string &message) noexcept final
 Set the backend into an exception state. More...
 
bool isFunctional () const noexcept final
 Return whether a device is working as intended, usually this means it is opened and does not have any errors. More...
 
std::string getActiveExceptionMessage () noexcept
 
- Public Member Functions inherited from ChimeraTK::DeviceBackend
virtual ~DeviceBackend ()=default
 Every virtual class needs a virtual desctructor. More...
 
template<typename UserType >
boost::shared_ptr< NDRegisterAccessor< UserType > > getRegisterAccessor (const RegisterPath &registerPathName, size_t numberOfWords, size_t wordOffsetInRegister, AccessModeFlags flags)
 Get a NDRegisterAccessor object from the register name. More...
 
 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE (getRegisterAccessor_impl, boost::shared_ptr< NDRegisterAccessor< T >>(const RegisterPath &, size_t, size_t, AccessModeFlags))
 

Static Public Member Functions

static boost::shared_ptr< DeviceBackendcreateInstance (std::string address, std::map< std::string, std::string > parameters)
 

Protected Member Functions

void heartbeatLoop (const boost::shared_ptr< ThreadInformerMutex > &threadInformerMutex)
 
- Protected Member Functions inherited from ChimeraTK::DeviceBackendImpl
void setOpenedAndClearException () noexcept
 Backends should call this function at the end of a (successful) open() call. More...
 

Protected Attributes

std::string _boardAddr
 
std::string _port
 
boost::shared_ptr< ThreadInformerMutex_threadInformerMutex
 
boost::shared_ptr< Rebot::Connection_connection
 
std::unique_ptr< RebotProtocolImplementor_protocolImplementor
 
boost::chrono::steady_clock::time_point _lastSendTime
 The time when the last command (read/write/heartbeat) was send. More...
 
unsigned int _connectionTimeout
 
boost::thread _heartbeatThread
 
- Protected Attributes inherited from ChimeraTK::NumericAddressedBackend
std::unique_ptr< NumericAddressedRegisterCatalogue_registerMapPointer
 
NumericAddressedRegisterCatalogue_registerMap
 
MetadataCatalogue _metadataCatalogue
 metadata catalogue More...
 
std::mutex _unalignedAccess
 mutex for protecting unaligned access More...
 
friend NumericAddressedLowLevelTransferElement
 
friend TriggeredPollDistributor
 
- Protected Attributes inherited from ChimeraTK::DeviceBackendImpl
std::atomic< bool > _opened {false}
 flag if backend is opened More...
 
async::DomainsContainer _asyncDomainsContainer
 Container for async::Domains to support wait_for_new_data. More...
 

Static Protected Attributes

const static uint32_t DEFAULT_CONNECTION_TIMEOUT_sec {5}
 

Detailed Description

Definition at line 44 of file RebotBackend.h.

Constructor & Destructor Documentation

◆ RebotBackend()

ChimeraTK::RebotBackend::RebotBackend ( std::string  boardAddr,
std::string  port,
const std::string &  mapFileName = "",
uint32_t  connectionTimeout_sec = DEFAULT_CONNECTION_TIMEOUT_sec 
)

Definition at line 68 of file RebotBackend.cc.

◆ ~RebotBackend()

ChimeraTK::RebotBackend::~RebotBackend ( )
override

Definition at line 76 of file RebotBackend.cc.

Member Function Documentation

◆ closeImpl()

void ChimeraTK::RebotBackend::closeImpl ( )
overridevirtual

All backends derrived from NumericAddressedBackend must implement closeImpl() instead of close.

Like this it is assured that the deactivation of the asynchronous accessors is always executed.

Reimplemented from ChimeraTK::NumericAddressedBackend.

Definition at line 129 of file RebotBackend.cc.

◆ createInstance()

boost::shared_ptr< DeviceBackend > ChimeraTK::RebotBackend::createInstance ( std::string  address,
std::map< std::string, std::string >  parameters 
)
static

Definition at line 139 of file RebotBackend.cc.

◆ heartbeatLoop()

void ChimeraTK::RebotBackend::heartbeatLoop ( const boost::shared_ptr< ThreadInformerMutex > &  threadInformerMutex)
protected

Definition at line 161 of file RebotBackend.cc.

+ Here is the call graph for this function:

◆ minimumTransferAlignment()

size_t ChimeraTK::RebotBackend::minimumTransferAlignment ( [[maybe_unused] ] uint64_t  bar) const
inlineoverridevirtual

Determines the supported minimum alignment for any read/write requests.

If the backend expects a particular alignment for read()/write() calls it should return a value bigger than 1. The address and sizeInBytes arguments of the read()/write() calls will be always an integer multiple of this number. Any unaligned transfers will be changed to meet these criteria (additional padding data will be thrown away).

The default implementation returns 1, which means no special alignment is required.

Returns
Minimum alignment in bytes

Reimplemented from ChimeraTK::NumericAddressedBackend.

Definition at line 72 of file RebotBackend.h.

◆ open()

void ChimeraTK::RebotBackend::open ( )
overridevirtual

The function opens the connection to the device.

Implements ChimeraTK::DeviceBackend.

Definition at line 94 of file RebotBackend.cc.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

void ChimeraTK::RebotBackend::read ( uint8_t  bar,
uint32_t  addressInBytes,
int32_t *  data,
size_t  sizeInBytes 
)
override

Definition at line 105 of file RebotBackend.cc.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readDeviceInfo()

std::string ChimeraTK::RebotBackend::readDeviceInfo ( )
inlineoverridevirtual

Return a device information string containing hardware details like the firmware version number or the slot number used by the board.

The format and contained information of this string is completely backend implementation dependent, so the string may only be printed to the user as an informational output. Do not try to parse this string or extract information from it programmatically.

Implements ChimeraTK::DeviceBackend.

Definition at line 67 of file RebotBackend.h.

◆ write()

void ChimeraTK::RebotBackend::write ( uint8_t  bar,
uint32_t  addressInBytes,
int32_t const *  data,
size_t  sizeInBytes 
)
override

Definition at line 117 of file RebotBackend.cc.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _boardAddr

std::string ChimeraTK::RebotBackend::_boardAddr
protected

Definition at line 46 of file RebotBackend.h.

◆ _connection

boost::shared_ptr<Rebot::Connection> ChimeraTK::RebotBackend::_connection
protected

Definition at line 52 of file RebotBackend.h.

◆ _connectionTimeout

unsigned int ChimeraTK::RebotBackend::_connectionTimeout
protected

Definition at line 56 of file RebotBackend.h.

◆ _heartbeatThread

boost::thread ChimeraTK::RebotBackend::_heartbeatThread
protected

Definition at line 76 of file RebotBackend.h.

◆ _lastSendTime

boost::chrono::steady_clock::time_point ChimeraTK::RebotBackend::_lastSendTime
protected

The time when the last command (read/write/heartbeat) was send.

Definition at line 55 of file RebotBackend.h.

◆ _port

std::string ChimeraTK::RebotBackend::_port
protected

Definition at line 47 of file RebotBackend.h.

◆ _protocolImplementor

std::unique_ptr<RebotProtocolImplementor> ChimeraTK::RebotBackend::_protocolImplementor
protected

Definition at line 53 of file RebotBackend.h.

◆ _threadInformerMutex

boost::shared_ptr<ThreadInformerMutex> ChimeraTK::RebotBackend::_threadInformerMutex
protected

Definition at line 49 of file RebotBackend.h.

◆ DEFAULT_CONNECTION_TIMEOUT_sec

const static uint32_t ChimeraTK::RebotBackend::DEFAULT_CONNECTION_TIMEOUT_sec {5}
staticprotected

Definition at line 78 of file RebotBackend.h.


The documentation for this class was generated from the following files: