ifw-ccf  1.0.0
Public Member Functions | Protected Attributes | List of all members
ccf::common::ComAdptBase Class Reference

Class to be used as parent for CCF Communication Adapters. More...

#include <comAdptBase.hpp>

Inheritance diagram for ccf::common::ComAdptBase:
ccf::common::Base ccf::common::test::ComAdptTest ccf::control::ComAdptSim ccf::protocols::aravis::ComAdptAravis

Public Member Functions

 ComAdptBase ()
 
virtual ~ComAdptBase ()
 
ccf::common::ConfigBaseCfg ()
 Return reference to general configuration object (singleton). More...
 
const std::string & GetCameraAddress () const
 Return the address of the camera from the configuration. More...
 
const std::string & GetId () const
 Get the ID of the associated camera. More...
 
void SetHostAdddress (const std::string &host_address)
 Set the address of the host (network interface) used for communicating with the camera. More...
 
const std::string & GetHostAddress ()
 Return the address of the host (network interface) used for communicating with the camera. More...
 
void SetIsSimAdapter (const bool is_sim)
 Set the Simulation Adapter Flag. More...
 
bool GetIsSimAdapter () const
 Return the Simulation Adapter Flag. More...
 
void SetProtocol (const std::string &protocol)
 Set the communication protocol used. More...
 
const std::string & GetProtocol () const
 Return the communication protocol used. More...
 
template<class TYPE >
TYPE GetCameraProperty (const std::string &property)
 
bool HasCameraProperty (const std::string &property, std::string &value)
 
double GetTheoreticFrameRate ()
 Render the theoritic, possible achievable frame rate (frame/s). More...
 
void LoadCameraNameMapping (const std::string &name_mapping_file)
 
void Initialise (const bool re_init=false)
 
void SetCameraAddress (const std::string &address)
 Set the internal address, e.g. URI, used for communicating with the camera. More...
 
void CheckConnection (bool &connected)
 Check if the connection to the camera is OK. More...
 
void CheckStatus (ccf::common::HwStatus &status, std::string &message)
 Check the status of the camera (health status). More...
 
bool IsConnected () const
 Returns true if the connection to the camera is established and valid. More...
 
void Connect ()
 
void Disconnect ()
 Disconnect from the camera. More...
 
void WriteAdapterProps ()
 
virtual void WriteAdapterPropsUser ()
 
void SetIsConnected (const bool connected)
 
bool GetAllowLostFrames () const
 Return flag (cfg par) indicating if lost frames shall be ignored silently. More...
 
uint64_t IncLostFramesCount ()
 Increment the counter of lost frames. The new value is returned. More...
 
uint64_t GetLostFramesCount () const
 Return the number of lost frames currently registered. More...
 
void ResetLostFramesCount ()
 Reset the lost frames counter. More...
 
void Read (const std::string &name, ctd::param::Parameter &par)
 
void Read (const std::vector< std::string > &names, std::vector< ctd::param::Parameter > &pars)
 
std::string Read (const std::string &name)
 
template<class TYPE >
TYPE Read (const std::string &name)
 Template method to read a parameter, taking care of the conversion to the desired user representation. More...
 
void Write (const ctd::param::Parameter &par)
 
void Write (const std::vector< ctd::param::Parameter > &pars)
 
template<class TYPE >
void Write (const std::string &name, const TYPE &value)
 Template method to write a parameter, taking care of converting the user data into the internal type. More...
 
void Receive (ccf::common::DataFrame &frame, bool &frame_received, const double timeout, bool &timed_out)
 
void Scan (std::vector< ctd::param::Parameter > &pars)
 Scan the address of the associated camera and store the parameters in the vector. More...
 
void Start ()
 Start the image acquisition in the camera. More...
 
void Stop ()
 Stop the image acquisition in the camera. More...
 
void HandleSetup ()
 
void HandleParPreWrite (ctd::param::Parameter &par)
 
void HandleParPostWrite (ctd::param::Parameter &par)
 Invoked after writing to the camera in case additional processing and downloading of parameters is needed. More...
 
void HandleParPostRead (ctd::param::Parameter &par)
 Invoked before reading a parameter from the camera, in case speciel handling is needed. More...
 
void MapParForDevice (ctd::param::Parameter &par) const
 
void MapParFromDevice (ctd::param::Parameter &par) const
 
bool HasNameMapping (const std::string &name) const
 Return true if a mapping is defined in the Camera Name Mapping for the given name. More...
 
virtual void InitialiseUser ()
 
virtual void SetCameraAddressUser (const std::string &address)
 
virtual void CheckConnectionUser (bool &connected)
 
virtual void CheckStatusUser (ccf::common::HwStatus &status, std::string &message)
 
virtual bool HasCameraPropertyUser (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, ctd::param::Parameter &par)
 
virtual void ReadUser (const std::vector< std::string > &names, std::vector< ctd::param::Parameter > &pars)
 
virtual void ReceiveUser (ccf::common::DataFrame &frame, bool &frame_received, const double timeout, bool &timed_out)
 
virtual void ScanUser (std::vector< ctd::param::Parameter > &pars)
 
virtual void StartUser ()
 
virtual void StopUser ()
 
virtual void WriteUser (const ctd::param::Parameter &par)
 
virtual void WriteUser (const std::vector< ctd::param::Parameter > &pars)
 
virtual void HandleSetupUser ()
 
virtual void HandleParPreWriteUser (ctd::param::Parameter &par)
 
virtual void HandleParPostWriteUser (ctd::param::Parameter &par)
 
virtual void HandleParPostReadUser (ctd::param::Parameter &par)
 
- Public Member Functions inherited from ccf::common::Base
 Base ()
 
 ~Base ()
 
const std::string & GetClassName () const
 Return the allocated name of the class. More...
 

Protected Attributes

bool m_is_connected
 

Additional Inherited Members

- Static Public Member Functions inherited from ccf::common::Base
static ccf::mptk::ManagerMptk ()
 Return reference to internal MPTK instance (singleton). More...
 
static void SetLogLevel (const ccf::common::LogLevel log_level)
 Set the log level. More...
 
static ccf::common::LogLevel GetLogLevel ()
 Return the current CCF log level. More...
 
- Protected Member Functions inherited from ccf::common::Base
void SetClassName (const std::string &class_name)
 Set the name of the class in question. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ComAdptBase()

ccf::common::ComAdptBase::ComAdptBase ( )

◆ ~ComAdptBase()

ccf::common::ComAdptBase::~ComAdptBase ( )
virtual

Member Function Documentation

◆ Cfg()

ccf::common::ConfigBase & ccf::common::ComAdptBase::Cfg ( )

Return reference to general configuration object (singleton).

◆ CheckConnection()

void ccf::common::ComAdptBase::CheckConnection ( bool &  connected)

Check if the connection to the camera is OK.

◆ CheckConnectionUser()

void ccf::common::ComAdptBase::CheckConnectionUser ( bool &  connected)
virtual

Specific implementation of the connection check algorithm. See also "CheckConnection()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ CheckStatus()

void ccf::common::ComAdptBase::CheckStatus ( ccf::common::HwStatus status,
std::string &  message 
)

Check the status of the camera (health status).

◆ CheckStatusUser()

void ccf::common::ComAdptBase::CheckStatusUser ( ccf::common::HwStatus status,
std::string &  message 
)
virtual

Specific implementation of the status check algorithm. See also "CheckStatus()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ Connect()

void ccf::common::ComAdptBase::Connect ( )

◆ ConnectUser()

void ccf::common::ComAdptBase::ConnectUser ( )
virtual

Specific implementation of the connection algorithm to connect to the camera. See also "Connect()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ Disconnect()

void ccf::common::ComAdptBase::Disconnect ( )

Disconnect from the camera.

◆ DisconnectUser()

void ccf::common::ComAdptBase::DisconnectUser ( )
virtual

Specific implementation of the algorithm to disconnect from the camera. See also "Disconnect()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ GetAllowLostFrames()

bool ccf::common::ComAdptBase::GetAllowLostFrames ( ) const

Return flag (cfg par) indicating if lost frames shall be ignored silently.

◆ GetCameraAddress()

const std::string & ccf::common::ComAdptBase::GetCameraAddress ( ) const

Return the address of the camera from the configuration.

◆ GetCameraProperty()

template<class TYPE >
TYPE ccf::common::ComAdptBase::GetCameraProperty ( const std::string &  property)
inline

Retrieve a property of the camera, e.g. the width of the detector chip (CFG_CAM_CHIP_WIDTH). If not available from the camera, it is taken from the configuration.

◆ GetHostAddress()

const std::string & ccf::common::ComAdptBase::GetHostAddress ( )

Return the address of the host (network interface) used for communicating with the camera.

◆ GetId()

const std::string & ccf::common::ComAdptBase::GetId ( ) const

Get the ID of the associated camera.

◆ GetIsSimAdapter()

bool ccf::common::ComAdptBase::GetIsSimAdapter ( ) const

Return the Simulation Adapter Flag.

◆ GetLostFramesCount()

uint64_t ccf::common::ComAdptBase::GetLostFramesCount ( ) const

Return the number of lost frames currently registered.

◆ GetProtocol()

const std::string & ccf::common::ComAdptBase::GetProtocol ( ) const

Return the communication protocol used.

◆ GetTheoreticFrameRate()

double ccf::common::ComAdptBase::GetTheoreticFrameRate ( )

Render the theoritic, possible achievable frame rate (frame/s).

◆ GetTheoreticFrameRateUser()

double ccf::common::ComAdptBase::GetTheoreticFrameRateUser ( )
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 ccf::protocols::aravis::ComAdptAravis.

◆ HandleParPostRead()

void ccf::common::ComAdptBase::HandleParPostRead ( ctd::param::Parameter &  par)

Invoked before reading a parameter from the camera, in case speciel handling is needed.

◆ HandleParPostReadUser()

void ccf::common::ComAdptBase::HandleParPostReadUser ( ctd::param::Parameter &  par)
virtual

Specific implementation of the algorithm to process a parameter after reading it from the camera. See also "HandleParPostRead()".

Reimplemented in ccf::common::test::ComAdptTest.

◆ HandleParPostWrite()

void ccf::common::ComAdptBase::HandleParPostWrite ( ctd::param::Parameter &  par)

Invoked after writing to the camera in case additional processing and downloading of parameters is needed.

◆ HandleParPostWriteUser()

void ccf::common::ComAdptBase::HandleParPostWriteUser ( ctd::param::Parameter &  par)
virtual

Specific implementation of the parameter processing after this is written to the camera. See also "HandleParPostWrite()".

Reimplemented in ccf::common::test::ComAdptTest.

◆ HandleParPreWrite()

void ccf::common::ComAdptBase::HandleParPreWrite ( ctd::param::Parameter &  par)

Invoked before writing a parameter to the camera if specific handling is required, e.g. converting the value to the camera representation.

◆ HandleParPreWriteUser()

void ccf::common::ComAdptBase::HandleParPreWriteUser ( ctd::param::Parameter &  par)
virtual

Specific implementation of the parameter processing before this is written to the camera. See also "HandleParPreWrite()".

Reimplemented in ccf::common::test::ComAdptTest.

◆ HandleSetup()

void ccf::common::ComAdptBase::HandleSetup ( )

Method invoked to handle set up parameters to be written to the camera. Is invoked when a Setup Request is received.

◆ HandleSetupUser()

void ccf::common::ComAdptBase::HandleSetupUser ( )
virtual

Specific implementation of the handling of new setup parameters. See also "HandleSetup()".

Reimplemented in ccf::control::ComAdptSim.

◆ HasCameraProperty()

bool ccf::common::ComAdptBase::HasCameraProperty ( const std::string &  property,
std::string &  value 
)

Check if a given camera 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.

Ignore and try to get the value from the cfg.

◆ HasCameraPropertyUser()

bool ccf::common::ComAdptBase::HasCameraPropertyUser ( const std::string &  property,
std::string &  value 
)
virtual

Specific implementation of the algorithm to check for a specific camera property. Need normally not to be provided for specific Communication Adapters. See also "HasCameraProperty()".

◆ HasNameMapping()

bool ccf::common::ComAdptBase::HasNameMapping ( const std::string &  name) const

Return true if a mapping is defined in the Camera Name Mapping for the given name.

◆ IncLostFramesCount()

uint64_t ccf::common::ComAdptBase::IncLostFramesCount ( )

Increment the counter of lost frames. The new value is returned.

◆ Initialise()

void ccf::common::ComAdptBase::Initialise ( const bool  re_init = false)

Method encapsulating the user specific implementations. The method is invoked when the object is instantiated.

◆ InitialiseUser()

void ccf::common::ComAdptBase::InitialiseUser ( )
virtual

Specific implementation of the adapter/camera initialisation. See also "Initialise()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ IsConnected()

bool ccf::common::ComAdptBase::IsConnected ( ) const

Returns true if the connection to the camera is established and valid.

◆ IsConnectedUser()

bool ccf::common::ComAdptBase::IsConnectedUser ( ) const
virtual

Specific implementation of the algorithm to determine if a connection to the camera is established. See also "IsConnected()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, and ccf::common::test::ComAdptTest.

◆ LoadCameraNameMapping()

void ccf::common::ComAdptBase::LoadCameraNameMapping ( const std::string &  name_mapping_file)

Load the specified Camera Name Mapping. The Camera Name Mapping maps the internal names used in CCF into the actual names defined by the camera.

◆ MapParForDevice()

void ccf::common::ComAdptBase::MapParForDevice ( ctd::param::Parameter &  par) const

Map the parameter to the camera name, applying the Camera Name Mapping. If the parameter is not defined, the mapped parameter will be the same as the internal parameter.

◆ MapParFromDevice()

void ccf::common::ComAdptBase::MapParFromDevice ( ctd::param::Parameter &  par) const

Map a parameter name, received from the camera, applying the Camera Name Mapping. If the parameter is not defined, the mapped parameter will be the same as the internal parameter.

◆ Read() [1/4]

std::string ccf::common::ComAdptBase::Read ( const std::string &  name)

Read a parameter from the camera and return it. The name may be mapped from the camera to the internal level representation, if defined in the Camera Name Mapping.

◆ Read() [2/4]

template<class TYPE >
TYPE ccf::common::ComAdptBase::Read ( const std::string &  name)
inline

Template method to read a parameter, taking care of the conversion to the desired user representation.

◆ Read() [3/4]

void ccf::common::ComAdptBase::Read ( const std::string &  name,
ctd::param::Parameter &  par 
)

Read a parameter from the camera. The name may be mapped from the camera to the internal level representation, if defined in the Camera Name Mapping.

◆ Read() [4/4]

void ccf::common::ComAdptBase::Read ( const std::vector< std::string > &  names,
std::vector< ctd::param::Parameter > &  pars 
)

Read a set of parametera from the camera. The names may be mapped from the camera to the internal level representation, if defined in the Camera Name Mapping.

◆ ReadUser() [1/2]

void ccf::common::ComAdptBase::ReadUser ( const std::string &  name,
ctd::param::Parameter &  par 
)
virtual

Specific implementation of the reading of single parameter from the camera. See also "Read(single)".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ ReadUser() [2/2]

void ccf::common::ComAdptBase::ReadUser ( const std::vector< std::string > &  names,
std::vector< ctd::param::Parameter > &  pars 
)
virtual

Specific implementation of the algorithm to read multiple parameters from the camera. Need normally not to be provided for specific Communication Adapters. See also "Read(multiple)".

◆ Receive()

void ccf::common::ComAdptBase::Receive ( ccf::common::DataFrame frame,
bool &  frame_received,
const double  timeout,
bool &  timed_out 
)

Method to receive a frame from the camera. Only entire frames are handled. See also "ReceiveUser()".

Parameters
[out]frameFrame object, which will contain the frames, if one received.
[out]frame_receivedIndicates if a frame was received.
[in]timeoutTimeout in seconds to apply, waiting for the next frame.
[out]timed_outIndicates if the request for a frame timed out.

◆ ReceiveUser()

void ccf::common::ComAdptBase::ReceiveUser ( ccf::common::DataFrame frame,
bool &  frame_received,
const double  timeout,
bool &  timed_out 
)
virtual

Specific implementation of the frame reception. See also "Receive()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ ResetLostFramesCount()

void ccf::common::ComAdptBase::ResetLostFramesCount ( )

Reset the lost frames counter.

◆ Scan()

void ccf::common::ComAdptBase::Scan ( std::vector< ctd::param::Parameter > &  pars)

Scan the address of the associated camera and store the parameters in the vector.

◆ ScanUser()

void ccf::common::ComAdptBase::ScanUser ( std::vector< ctd::param::Parameter > &  pars)
virtual

Specific implementation of the scanning of the defined parameters in the camera namespace. See also "Scan()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ SetCameraAddress()

void ccf::common::ComAdptBase::SetCameraAddress ( const std::string &  address)

Set the internal address, e.g. URI, used for communicating with the camera.

◆ SetCameraAddressUser()

void ccf::common::ComAdptBase::SetCameraAddressUser ( const std::string &  address)
virtual

Specific implementation of the handling of the camera addresss/URI. See also "SetCameraAddress()".

Reimplemented in ccf::common::test::ComAdptTest.

◆ SetHostAdddress()

void ccf::common::ComAdptBase::SetHostAdddress ( const std::string &  host_address)

Set the address of the host (network interface) used for communicating with the camera.

◆ SetIsConnected()

void 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!

◆ SetIsSimAdapter()

void ccf::common::ComAdptBase::SetIsSimAdapter ( const bool  is_sim)

Set the Simulation Adapter Flag.

◆ SetProtocol()

void ccf::common::ComAdptBase::SetProtocol ( const std::string &  protocol)

Set the communication protocol used.

◆ Start()

void ccf::common::ComAdptBase::Start ( )

Start the image acquisition in the camera.

◆ StartUser()

void ccf::common::ComAdptBase::StartUser ( )
virtual

Specific implementation of the algorithm to start the image acquisition in the camera. See also "Start()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ Stop()

void ccf::common::ComAdptBase::Stop ( )

Stop the image acquisition in the camera.

◆ StopUser()

void ccf::common::ComAdptBase::StopUser ( )
virtual

Specific implementation of the algorithm to stop the image acquisition in the camera. See also "Stop()".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ Write() [1/3]

void ccf::common::ComAdptBase::Write ( const ctd::param::Parameter &  par)

Write a parameter to the camera. The name may be mapped from the internal to the camera representation, if defined in the Camera Name Mapping.

◆ Write() [2/3]

template<class TYPE >
void ccf::common::ComAdptBase::Write ( const std::string &  name,
const TYPE &  value 
)
inline

Template method to write a parameter, taking care of converting the user data into the internal type.

◆ Write() [3/3]

void ccf::common::ComAdptBase::Write ( const std::vector< ctd::param::Parameter > &  pars)

Write a set of parameters to the camera. The name may be mapped from the internal to the camera representation, if defined in the Camera Name Mapping.

◆ WriteAdapterProps()

void ccf::common::ComAdptBase::WriteAdapterProps ( )

Write the Adapter Properties (cfg key: "cam.adapter.property#=<prop>=<val>") to the adapter (camera). Only the Adapter Properties defined in the Camera Name Mapping will be written to the camera.

◆ WriteAdapterPropsUser()

void ccf::common::ComAdptBase::WriteAdapterPropsUser ( )
virtual

Write the adapter properties (cfg key: "cam.adapter.property#=<prop>=<val>") to the adapter (camera). Default implementation: Only properties defined in the Camera Name Mapping are written to the adapter/camera. Specific implementation.

◆ WriteUser() [1/2]

void ccf::common::ComAdptBase::WriteUser ( const ctd::param::Parameter &  par)
virtual

Specific implementation of the algorithm to write single parameters to the camera. See also "Write(single)".

Reimplemented in ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.

◆ WriteUser() [2/2]

void ccf::common::ComAdptBase::WriteUser ( const std::vector< ctd::param::Parameter > &  pars)
virtual

Specific implementation of the algorithm to write a set of parameters to the camera. Need normally not to be provided for specific Communication Adapters. See also "Write(multiple)".

Member Data Documentation

◆ m_is_connected

bool ccf::common::ComAdptBase::m_is_connected
protected

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