ifw-ccf 5.0.2
|
Class to be used as parent for CCF Communication Adapters. More...
#include <comAdptBase.hpp>
Public Member Functions | |
ComAdptBase () | |
virtual | ~ComAdptBase () |
const std::string & | GetDeviceAddress () const |
Return the address from the configuration. | |
const int16_t | GetDeviceWidth () const |
Return the width of the data array from the configuration. | |
const int16_t | GetDeviceHeight () const |
Return the height of the data array from the configuration. | |
const int8_t | GetDeviceResolution () const |
Return the resolution of the data elements from the configuration. | |
const std::string & | GetId () const |
Get the ID of the associated device. | |
double | GetMaxFrameRate () const |
Get Maximim frame rate (Hz). | |
void | SetHostAdddress (const std::string &host_address) |
Set the address of the host (network interface) used for communication. | |
virtual const std::string & | GetHostAddress () |
Return the address of the host (network interface) used for communicating with the device. | |
void | SetIsSimAdapter (const bool is_sim) |
Set the Simulation Adapter Flag. | |
bool | GetIsSimAdapter () const |
Return the Simulation Adapter Flag. | |
const std::string & | GetProtocol () const |
Return the communication protocol used. | |
template<class TYPE > | |
TYPE | GetDeviceProperty (const std::string &property) |
bool | HasDeviceProperty (const std::string &property, std::string &value) |
double | GetTheoreticFrameRate () |
Render the theoritic, possible achievable frame rate (frame/s). | |
void | Initialise (const bool re_init=false) |
void | SetDeviceAddress (const std::string &address) |
Set the internal address, e.g. URI, used for communicating with the device. | |
void | CheckConnection (bool &connected) |
Check if the connection to the device is OK. | |
void | CheckStatus (ifw::ccf::HwStatus &status, std::string &message) |
Check the status of the device (health status). | |
bool | IsConnected () const |
Returns true if the connection to the device is established and valid. | |
void | CheckIfConnected () const |
Check if the connection is established. If not, throw an exception. | |
void | Connect () |
void | AutoConnect (const uint8_t attempts=5, const double timeout=10) |
void | Disconnect () |
Disconnect from the device. | |
void | WriteDeviceProps () |
virtual void | WriteDevicePropsUser () |
void | WriteDefaultSetup () |
virtual void | WriteDefaultSetupUser () |
void | SetIsConnected (const bool connected) |
bool | GetAllowLostFrames () const |
Return flag (cfg par) indicating if lost frames shall be ignored silently. | |
uint64_t | IncLostFramesCount () |
Increment the counter of lost frames. The new value is returned. | |
void | SetLostFramesCount (const int64_t count) |
uint64_t | GetLostFramesCount () const |
Return the number of lost frames currently registered. | |
uint64_t | GetFrameCounter () const |
Return the internal frame counter. | |
double | GetTimeForLastFrame () const |
void | ResetLostFramesCount () |
Reset the lost frames counter. | |
void | Read (const std::string &name, ifw::core::utils::param::Parameter &par) |
void | Read (const std::vector< std::string > &names, std::vector< ifw::core::utils::param::Parameter > &pars) |
std::string | Read (const std::string &name) |
template<class TYPE > | |
TYPE | Read (const std::string &name) |
void | Write (const ifw::core::utils::param::Parameter &par) |
void | Write (const std::vector< ifw::core::utils::param::Parameter > &pars) |
template<class TYPE > | |
void | Write (const std::string &name, const TYPE &value) |
void | Receive (ifw::ccf::common::DataFrame &frame, bool &frame_received, const double timeout, bool &timed_out) |
void | Scan (std::vector< ifw::core::utils::param::Parameter > &pars) |
Scan the address of the associated device and store the parameters in the vector. | |
void | Start () |
Start the image acquisition in the device. | |
void | Stop () |
Stop the image acquisition in the device. | |
void | HandleSetup () |
void | HandleParPreWrite (ifw::core::utils::param::Parameter &par) |
void | HandleParPostWrite (ifw::core::utils::param::Parameter &par) |
void | HandleParPostRead (ifw::core::utils::param::Parameter &par) |
Invoked before reading a parameter from the device, in case speciel handling is needed. | |
void | MapParForDevice (ifw::core::utils::param::Parameter &par) const |
void | MapParFromDevice (ifw::core::utils::param::Parameter &par) const |
bool | HasNameMapping (const std::string &name) const |
Return true if a mapping is defined in the Device Name Mapping for the given name. | |
virtual void | SetAcqTrigger (const AcqTrigger &acq_trigger) |
AcqTrigger & | GetAcqTrigger () |
ifw::ccf::common::TriggerType | GetAcqTriggerType () const |
virtual void | InitialiseUser () |
virtual void | SetDeviceAddressUser (const std::string &address) |
virtual void | CheckConnectionUser (bool &connected) |
virtual void | CheckStatusUser (ifw::ccf::HwStatus &status, std::string &message) |
virtual bool | HasDevicePropertyUser (const std::string &property, std::string &value) |
virtual double | GetTheoreticFrameRateUser () |
virtual void | ConnectUser () |
virtual void | DisconnectUser () |
virtual bool | IsConnectedUser () const |
virtual void | ReadUser (const std::string &name, ifw::core::utils::param::Parameter &par) |
virtual void | ReadUser (const std::vector< std::string > &names, std::vector< ifw::core::utils::param::Parameter > &pars) |
virtual void | ReceiveUser (ifw::ccf::common::DataFrame &frame, bool &frame_received, const double timeout, bool &timed_out) |
virtual void | AddMetaDataUser (ifw::ccf::common::DataFrame &frame) |
virtual void | ScanUser (std::vector< ifw::core::utils::param::Parameter > &pars) |
virtual void | StartUser () |
virtual void | StopUser () |
virtual void | WriteUser (const ifw::core::utils::param::Parameter &par) |
virtual void | WriteUser (const std::vector< ifw::core::utils::param::Parameter > &pars) |
virtual void | HandleSetupUser () |
void | ReadMutableSetupPars () |
Read setup parameters from the camera device, which may mutate. | |
virtual void | HandleParPreWriteUser (ifw::core::utils::param::Parameter &par) |
virtual void | HandleParPostWriteUser (ifw::core::utils::param::Parameter &par) |
virtual void | HandleParPostReadUser (ifw::core::utils::param::Parameter &par) |
const NameMapping & | GetNameMapping () const |
virtual void | SetAcqTriggerUser () |
Specific implementation of the algorithm to trigger an acquisition. | |
![]() | |
Base () | |
~Base () | |
const std::string & | GetClassName () const |
Return the allocated name of the class. | |
Protected Member Functions | |
virtual void | AdjustExpoTimeFrameRate () |
![]() | |
void | SetClassName (const std::string &class_name) |
Set the name of the class in question. | |
Protected Attributes | |
bool | m_is_connected |
AcqTrigger | m_acq_trigger |
Additional Inherited Members | |
![]() | |
static ifw::ccf::mptk::Manager & | Mptk () |
Return reference to internal MPTK instance (singleton). | |
Class to be used as parent for CCF Communication Adapters.
The adapter shall be used as parent class when implementing specific adapters. Methods to be provided by the specific implemented, have a name of the form "<action>User". Note, it may not be necessary to implement all 'user'/virtual methods.
ifw::ccf::common::ComAdptBase::ComAdptBase | ( | ) |
|
virtual |
|
virtual |
Can be implmented to add additional meta-data, e.g. FITS keys, which should be written to the generated output data products.
|
protectedvirtual |
void ifw::ccf::common::ComAdptBase::AutoConnect | ( | const uint8_t | attempts = 5, |
const double | timeout = 10 ) |
Check if a connection is established and is working. If yes, do nothing, else attempt to create it.
void ifw::ccf::common::ComAdptBase::CheckConnection | ( | bool & | connected | ) |
Check if the connection to the device is OK.
|
virtual |
Specific implementation of the connection check algorithm. See also "CheckConnection()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, and ifw::ccf::protocols::envision::ComAdptEnvision.
void ifw::ccf::common::ComAdptBase::CheckIfConnected | ( | ) | const |
Check if the connection is established. If not, throw an exception.
void ifw::ccf::common::ComAdptBase::CheckStatus | ( | ifw::ccf::HwStatus & | status, |
std::string & | message ) |
Check the status of the device (health status).
|
virtual |
Specific implementation of the status check algorithm. See also "CheckStatus()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, and ifw::ccf::protocols::envision::ComAdptEnvision.
void ifw::ccf::common::ComAdptBase::Connect | ( | ) |
|
virtual |
Specific implementation of the connection algorithm to connect to the device. See also "Connect()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, ifw::ccf::protocols::envision::ComAdptEnvision, and ifw::ccf::protocols::rtms::ComAdptRtms.
void ifw::ccf::common::ComAdptBase::Disconnect | ( | ) |
Disconnect from the device.
|
virtual |
Specific implementation of the algorithm to disconnect from the device. See also "Disconnect()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, ifw::ccf::protocols::envision::ComAdptEnvision, and ifw::ccf::protocols::rtms::ComAdptRtms.
AcqTrigger & ifw::ccf::common::ComAdptBase::GetAcqTrigger | ( | ) |
ifw::ccf::common::TriggerType ifw::ccf::common::ComAdptBase::GetAcqTriggerType | ( | ) | const |
bool ifw::ccf::common::ComAdptBase::GetAllowLostFrames | ( | ) | const |
Return flag (cfg par) indicating if lost frames shall be ignored silently.
const std::string & ifw::ccf::common::ComAdptBase::GetDeviceAddress | ( | ) | const |
Return the address from the configuration.
const int16_t ifw::ccf::common::ComAdptBase::GetDeviceHeight | ( | ) | const |
Return the height of the data array from the configuration.
|
inline |
Retrieve a property of the device, e.g. the width of the detector chip. If not available from the device, it is taken from the configuration.
const int8_t ifw::ccf::common::ComAdptBase::GetDeviceResolution | ( | ) | const |
Return the resolution of the data elements from the configuration.
const int16_t ifw::ccf::common::ComAdptBase::GetDeviceWidth | ( | ) | const |
Return the width of the data array from the configuration.
uint64_t ifw::ccf::common::ComAdptBase::GetFrameCounter | ( | ) | const |
Return the internal frame counter.
|
virtual |
Return the address of the host (network interface) used for communicating with the device.
const std::string & ifw::ccf::common::ComAdptBase::GetId | ( | ) | const |
Get the ID of the associated device.
bool ifw::ccf::common::ComAdptBase::GetIsSimAdapter | ( | ) | const |
Return the Simulation Adapter Flag.
uint64_t ifw::ccf::common::ComAdptBase::GetLostFramesCount | ( | ) | const |
Return the number of lost frames currently registered.
double ifw::ccf::common::ComAdptBase::GetMaxFrameRate | ( | ) | const |
Get Maximim frame rate (Hz).
const NameMapping & ifw::ccf::common::ComAdptBase::GetNameMapping | ( | ) | const |
const std::string & ifw::ccf::common::ComAdptBase::GetProtocol | ( | ) | const |
Return the communication protocol used.
double ifw::ccf::common::ComAdptBase::GetTheoreticFrameRate | ( | ) |
Render the theoritic, possible achievable frame rate (frame/s).
|
virtual |
Specific implementation of the algorithm to estimate the theoretic frame rate. Need normally not to be provided for specific Communication Adapters. See also "GetTheoreticFrameRate()".
Reimplemented in ifw::ccf::protocols::aravis::ComAdptAravis.
double ifw::ccf::common::ComAdptBase::GetTimeForLastFrame | ( | ) | const |
void ifw::ccf::common::ComAdptBase::HandleParPostRead | ( | ifw::core::utils::param::Parameter & | par | ) |
Invoked before reading a parameter from the device, in case speciel handling is needed.
|
virtual |
Specific implementation of the algorithm to process a parameter after reading it from the device. See also "HandleParPostRead()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, and ifw::ccf::protocols::envision::ComAdptEnvision.
void ifw::ccf::common::ComAdptBase::HandleParPostWrite | ( | ifw::core::utils::param::Parameter & | par | ) |
Invoked after writing to the device in case additional processing and downloading of parameters is needed.
|
virtual |
Specific implementation of the parameter processing after this is written to the device. See also "HandleParPostWrite()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, and ifw::ccf::protocols::envision::ComAdptEnvision.
void ifw::ccf::common::ComAdptBase::HandleParPreWrite | ( | ifw::core::utils::param::Parameter & | par | ) |
Invoked before writing a parameter to the device if specific handling is required, e.g. converting the value to the device representation.
|
virtual |
Specific implementation of the parameter processing before this is written to the device. See also "HandleParPreWrite()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, and ifw::ccf::protocols::envision::ComAdptEnvision.
void ifw::ccf::common::ComAdptBase::HandleSetup | ( | ) |
Method invoked to handle set up parameters to be written to the device. Is invoked when a Setup Request is received.
|
virtual |
Specific implementation of the handling of new setup parameters. See also "HandleSetup()".
Reimplemented in ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, and ifw::ccf::protocols::envision::ComAdptEnvision.
bool ifw::ccf::common::ComAdptBase::HasDeviceProperty | ( | const std::string & | property, |
std::string & | value ) |
Check if a given device property is defined, e.g. the width or height of the chip. Returns true if property exists and sets the value (as a string) in the "value" parameter. It is checked as follows for the given property:
Ignore and try to get the value from the cfg.
|
virtual |
Specific implementation of the algorithm to check for a specific device property. Need normally not to be provided for specific Communication Adapters. See also "HasDeviceProperty()".
bool ifw::ccf::common::ComAdptBase::HasNameMapping | ( | const std::string & | name | ) | const |
Return true if a mapping is defined in the Device Name Mapping for the given name.
uint64_t ifw::ccf::common::ComAdptBase::IncLostFramesCount | ( | ) |
Increment the counter of lost frames. The new value is returned.
void ifw::ccf::common::ComAdptBase::Initialise | ( | const bool | re_init = false | ) |
Method encapsulating the user specific implementations. The method is invoked when the object is instantiated.
|
virtual |
Specific implementation of the adapter/device initialisation. See also "Initialise()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, ifw::ccf::protocols::envision::ComAdptEnvision, ifw::ccf::protocols::rtms::ComAdptRtms, and ifw::ccf::protocols::rtms_llnetio::ComAdptRtms.
bool ifw::ccf::common::ComAdptBase::IsConnected | ( | ) | const |
Returns true if the connection to the device is established and valid.
|
virtual |
Specific implementation of the algorithm to determine if a connection to the device is established. See also "IsConnected()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, and ifw::ccf::protocols::aravis::ComAdptAravis.
void ifw::ccf::common::ComAdptBase::MapParForDevice | ( | ifw::core::utils::param::Parameter & | par | ) | const |
Map the parameter to the device name, applying the Device Name Mapping. If the parameter is not defined, the mapped parameter will be the same as the internal parameter.
void ifw::ccf::common::ComAdptBase::MapParFromDevice | ( | ifw::core::utils::param::Parameter & | par | ) | const |
Map a parameter name, received from the device, applying the Device Name Mapping. If the parameter is not defined, the mapped parameter will be the same as the internal parameter.
std::string ifw::ccf::common::ComAdptBase::Read | ( | const std::string & | name | ) |
Read a parameter from the device and return it. The name may be mapped from the device to the internal level representation, if defined in the Device Name Mapping.
|
inline |
Template method to read a parameter, taking care of the conversion to the desired user representation.
void ifw::ccf::common::ComAdptBase::Read | ( | const std::string & | name, |
ifw::core::utils::param::Parameter & | par ) |
Read a parameter from the device. The name may be mapped from the device to the internal level representation, if defined in the Device Name Mapping.
void ifw::ccf::common::ComAdptBase::Read | ( | const std::vector< std::string > & | names, |
std::vector< ifw::core::utils::param::Parameter > & | pars ) |
Read a set of parametera from the device. The names may be mapped from the device to the internal level representation, if defined in the Device Name Mapping.
void ifw::ccf::common::ComAdptBase::ReadMutableSetupPars | ( | ) |
Read setup parameters from the camera device, which may mutate.
|
virtual |
Specific implementation of the reading of single parameter from the device. See also "Read(single)".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, and ifw::ccf::protocols::envision::ComAdptEnvision.
|
virtual |
Specific implementation of the algorithm to read multiple parameters from the device. Need normally not to be provided for specific Communication Adapters. See also "Read(multiple)".
void ifw::ccf::common::ComAdptBase::Receive | ( | ifw::ccf::common::DataFrame & | frame, |
bool & | frame_received, | ||
const double | timeout, | ||
bool & | timed_out ) |
Method to receive a frame from the device. Only entire frames are handled. See also "ReceiveUser()".
[out] | frame | Frame object, which will contain the frames, if one received. |
[out] | frame_received | Indicates if a frame was received. |
[in] | timeout | Timeout in seconds to apply, waiting for the next frame. |
[out] | timed_out | Indicates if the request for a frame timed out. |
|
virtual |
Specific implementation of the frame reception. See also "Receive()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, ifw::ccf::protocols::envision::ComAdptEnvision, ifw::ccf::protocols::rtms::ComAdptRtms, and ifw::ccf::protocols::rtms_llnetio::ComAdptRtms.
void ifw::ccf::common::ComAdptBase::ResetLostFramesCount | ( | ) |
Reset the lost frames counter.
void ifw::ccf::common::ComAdptBase::Scan | ( | std::vector< ifw::core::utils::param::Parameter > & | pars | ) |
Scan the address of the associated device and store the parameters in the vector.
|
virtual |
Specific implementation of the scanning of the defined parameters in the device namespace. See also "Scan()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, and ifw::ccf::protocols::envision::ComAdptEnvision.
|
virtual |
|
virtual |
Specific implementation of the algorithm to trigger an acquisition.
void ifw::ccf::common::ComAdptBase::SetDeviceAddress | ( | const std::string & | address | ) |
Set the internal address, e.g. URI, used for communicating with the device.
|
virtual |
Specific implementation of the handling of the device addresss/URI. See also "SetDeviceAddress()".
Reimplemented in ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, and ifw::ccf::protocols::envision::ComAdptEnvision.
void ifw::ccf::common::ComAdptBase::SetHostAdddress | ( | const std::string & | host_address | ) |
Set the address of the host (network interface) used for communication.
void ifw::ccf::common::ComAdptBase::SetIsConnected | ( | const bool | connected | ) |
Method by which derived adapters can force the status to connected or not connected. To be used with care!
void ifw::ccf::common::ComAdptBase::SetIsSimAdapter | ( | const bool | is_sim | ) |
Set the Simulation Adapter Flag.
void ifw::ccf::common::ComAdptBase::SetLostFramesCount | ( | const int64_t | count | ) |
void ifw::ccf::common::ComAdptBase::Start | ( | ) |
Start the image acquisition in the device.
|
virtual |
Specific implementation of the algorithm to start the image acquisition in the device. See also "Start()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, ifw::ccf::protocols::envision::ComAdptEnvision, ifw::ccf::protocols::rtms::ComAdptRtms, and ifw::ccf::protocols::rtms_llnetio::ComAdptRtms.
void ifw::ccf::common::ComAdptBase::Stop | ( | ) |
Stop the image acquisition in the device.
|
virtual |
Specific implementation of the algorithm to stop the image acquisition in the device. See also "Stop()".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, ifw::ccf::protocols::envision::ComAdptEnvision, ifw::ccf::protocols::rtms::ComAdptRtms, and ifw::ccf::protocols::rtms_llnetio::ComAdptRtms.
void ifw::ccf::common::ComAdptBase::Write | ( | const ifw::core::utils::param::Parameter & | par | ) |
Write a parameter to the device. The name may be mapped from the internal to the device representation, if defined in the Device Name Mapping.
|
inline |
Template method to write a parameter, taking care of converting the user data into the internal type.
void ifw::ccf::common::ComAdptBase::Write | ( | const std::vector< ifw::core::utils::param::Parameter > & | pars | ) |
Write a set of parameters to the device. The name may be mapped from the internal to the device representation, if defined in the Device Name Mapping.
void ifw::ccf::common::ComAdptBase::WriteDefaultSetup | ( | ) |
Write the default (init) setup to the device. The Communication Adapter is in charge of deciding which parameters to use.
|
virtual |
Write the default (init) setup to the device. The Communication Adapter is in charge of deciding which parameters to use.
void ifw::ccf::common::ComAdptBase::WriteDeviceProps | ( | ) |
Write the Device Properties to the adapter (device). Only the Device Properties defined in the Device Name Mapping will be written to the device.
|
virtual |
Write the device properties to the adapter (device). Default implementation: Only properties defined in the Device Name Mapping are written to the adapter/device Specific implementation.
|
virtual |
Specific implementation of the algorithm to write single parameters to the device. See also "Write(single)".
Reimplemented in ifw::ccf::common::test::ComAdptTest, ifw::ccf::protocols::envision_llnetio::ComAdptEnvision, ifw::ccf::control::ComAdptSim, ifw::ccf::protocols::aravis::ComAdptAravis, and ifw::ccf::protocols::envision::ComAdptEnvision.
|
virtual |
Specific implementation of the algorithm to write a set of parameters to the device. Need normally not to be provided for specific Communication Adapters. See also "Write(multiple)".
|
protected |
|
protected |