|
ifw-ccf
3.0.0-pre2
|
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. More... | |
| const int16_t | GetDeviceWidth () const |
| Return the width of the data array from the configuration. More... | |
| const int16_t | GetDeviceHeight () const |
| Return the height of the data array from the configuration. More... | |
| const int8_t | GetDeviceResolution () const |
| Return the resolution of the data elements. from the configuration. More... | |
| const std::string & | GetId () const |
| Get the ID of the associated device. More... | |
| double | GetMaxFrameRate () const |
| Get Maximim frame rate (Hz). More... | |
| void | SetHostAdddress (const std::string &host_address) |
| Set the address of the host (network interface) used for communication. More... | |
| virtual const std::string & | GetHostAddress () |
| Return the address of the host (network interface) used for communicating with the device. More... | |
| void | SetIsSimAdapter (const bool is_sim) |
| Set the Simulation Adapter Flag. More... | |
| bool | GetIsSimAdapter () const |
| Return the Simulation Adapter Flag. More... | |
| const std::string & | GetProtocol () const |
| Return the communication protocol used. More... | |
| 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). More... | |
| 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. More... | |
| void | CheckConnection (bool &connected) |
| Check if the connection to the device is OK. More... | |
| void | CheckStatus (ccf::HwStatus &status, std::string &message) |
| Check the status of the device (health status). More... | |
| bool | IsConnected () const |
| Returns true if the connection to the device is established and valid. More... | |
| void | CheckIfConnected () const |
| Check if the connection is established. If not, throw an exception. More... | |
| void | Connect () |
| void | AutoConnect (const uint8_t attempts=5, const double timeout=10) |
| void | Disconnect () |
| Disconnect from the device. More... | |
| 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. 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, core::utils::param::Parameter &par) |
| void | Read (const std::vector< std::string > &names, std::vector< core::utils::param::Parameter > &pars) |
| std::string | Read (const std::string &name) |
| template<class TYPE > | |
| TYPE | Read (const std::string &name) |
| void | Write (const core::utils::param::Parameter &par) |
| void | Write (const std::vector< core::utils::param::Parameter > &pars) |
| template<class TYPE > | |
| void | Write (const std::string &name, const TYPE &value) |
| void | Receive (ccf::common::DataFrame &frame, bool &frame_received, const double timeout, bool &timed_out) |
| void | Scan (std::vector< core::utils::param::Parameter > &pars) |
| Scan the address of the associated device and store the parameters in the vector. More... | |
| void | Start () |
| Start the image acquisition in the device. More... | |
| void | Stop () |
| Stop the image acquisition in the device. More... | |
| void | HandleSetup () |
| void | HandleParPreWrite (core::utils::param::Parameter &par) |
| void | HandleParPostWrite (core::utils::param::Parameter &par) |
| void | HandleParPostRead (core::utils::param::Parameter &par) |
| Invoked before reading a parameter from the device, in case speciel handling is needed. More... | |
| void | MapParForDevice (core::utils::param::Parameter &par) const |
| void | MapParFromDevice (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. More... | |
| virtual void | InitialiseUser () |
| virtual void | SetDeviceAddressUser (const std::string &address) |
| virtual void | CheckConnectionUser (bool &connected) |
| virtual void | CheckStatusUser (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, core::utils::param::Parameter &par) |
| virtual void | ReadUser (const std::vector< std::string > &names, std::vector< core::utils::param::Parameter > &pars) |
| virtual void | ReceiveUser (ccf::common::DataFrame &frame, bool &frame_received, const double timeout, bool &timed_out) |
| virtual void | ScanUser (std::vector< core::utils::param::Parameter > &pars) |
| virtual void | StartUser () |
| virtual void | StopUser () |
| virtual void | WriteUser (const core::utils::param::Parameter &par) |
| virtual void | WriteUser (const std::vector< core::utils::param::Parameter > &pars) |
| virtual void | HandleSetupUser () |
| virtual void | HandleParPreWriteUser (core::utils::param::Parameter &par) |
| virtual void | HandleParPostWriteUser (core::utils::param::Parameter &par) |
| virtual void | HandleParPostReadUser (core::utils::param::Parameter &par) |
Public Member Functions inherited from ccf::Base | |
| Base () | |
| ~Base () | |
| const std::string & | GetClassName () const |
| Return the allocated name of the class. More... | |
| log4cplus::Logger & | Loggger () |
| Return reference to logger used in this context. More... | |
Protected Attributes | |
| bool | m_is_connected |
Protected Attributes inherited from ccf::Base | |
| log4cplus::Logger | m_logger |
Additional Inherited Members | |
Static Public Member Functions inherited from ccf::Base | |
| static ccf::mptk::Manager & | Mptk () |
| Return reference to internal MPTK instance (singleton). More... | |
| static void | SetLogLevel (const ccf::LogLevel log_level) |
| Set the log level. More... | |
| static ccf::LogLevel | GetLogLevel () |
| Return the current CCF log level. More... | |
Protected Member Functions inherited from ccf::Base | |
| void | SetClassName (const std::string &class_name) |
| Set the name of the class in question. More... | |
| void | SetLogger (log4cplus::Logger &logger) |
| Set reference to logger used in this context. More... | |
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.
| ccf::common::ComAdptBase::ComAdptBase | ( | ) |
|
virtual |
| void 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 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 ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
| void ccf::common::ComAdptBase::CheckIfConnected | ( | ) | const |
Check if the connection is established. If not, throw an exception.
| void ccf::common::ComAdptBase::CheckStatus | ( | 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 ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
| void ccf::common::ComAdptBase::Connect | ( | ) |
|
virtual |
Specific implementation of the connection algorithm to connect to the device. See also "Connect()".
Reimplemented in ccf::protocols::rtms::ComAdptRtms, ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
| void ccf::common::ComAdptBase::Disconnect | ( | ) |
Disconnect from the device.
|
virtual |
Specific implementation of the algorithm to disconnect from the device. See also "Disconnect()".
Reimplemented in ccf::protocols::rtms::ComAdptRtms, ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
| bool ccf::common::ComAdptBase::GetAllowLostFrames | ( | ) | const |
Return flag (cfg par) indicating if lost frames shall be ignored silently.
| const std::string & ccf::common::ComAdptBase::GetDeviceAddress | ( | ) | const |
Return the address from the configuration.
| const int16_t 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 ccf::common::ComAdptBase::GetDeviceResolution | ( | ) | const |
Return the resolution of the data elements. from the configuration.
| const int16_t ccf::common::ComAdptBase::GetDeviceWidth | ( | ) | const |
Return the width of the data array from the configuration.
|
virtual |
Return the address of the host (network interface) used for communicating with the device.
| const std::string & ccf::common::ComAdptBase::GetId | ( | ) | const |
Get the ID of the associated device.
| bool ccf::common::ComAdptBase::GetIsSimAdapter | ( | ) | const |
Return the Simulation Adapter Flag.
| uint64_t ccf::common::ComAdptBase::GetLostFramesCount | ( | ) | const |
Return the number of lost frames currently registered.
| double ccf::common::ComAdptBase::GetMaxFrameRate | ( | ) | const |
Get Maximim frame rate (Hz).
| const std::string & ccf::common::ComAdptBase::GetProtocol | ( | ) | const |
Return the communication protocol used.
| double 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 ccf::protocols::aravis::ComAdptAravis.
| void ccf::common::ComAdptBase::HandleParPostRead | ( | 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 ccf::protocols::envision::ComAdptEnvision, and ccf::common::test::ComAdptTest.
| void ccf::common::ComAdptBase::HandleParPostWrite | ( | 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 ccf::protocols::envision::ComAdptEnvision, and ccf::common::test::ComAdptTest.
| void ccf::common::ComAdptBase::HandleParPreWrite | ( | 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 ccf::protocols::envision::ComAdptEnvision, and ccf::common::test::ComAdptTest.
| void 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 ccf::control::ComAdptSim.
| bool 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 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 ccf::common::ComAdptBase::IncLostFramesCount | ( | ) |
Increment the counter of lost frames. The new value is returned.
| void ccf::common::ComAdptBase::Initialise | ( | const bool | re_init = false | ) |
Load the specified Device Name Mapping. The Device Name Mapping maps the internal names used in CCF into the actual names defined by the device. 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 ccf::protocols::rtms::ComAdptRtms, ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
| bool 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 ccf::protocols::aravis::ComAdptAravis, and ccf::common::test::ComAdptTest.
| void ccf::common::ComAdptBase::MapParForDevice | ( | 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 ccf::common::ComAdptBase::MapParFromDevice | ( | 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 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 ccf::common::ComAdptBase::Read | ( | const std::string & | name, |
| 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 ccf::common::ComAdptBase::Read | ( | const std::vector< std::string > & | names, |
| std::vector< 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.
|
virtual |
Specific implementation of the reading of single parameter from the device. See also "Read(single)".
Reimplemented in ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
|
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 ccf::common::ComAdptBase::Receive | ( | 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 ccf::protocols::rtms::ComAdptRtms, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
| void ccf::common::ComAdptBase::ResetLostFramesCount | ( | ) |
Reset the lost frames counter.
| void ccf::common::ComAdptBase::Scan | ( | std::vector< 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 ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
| void 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 ccf::protocols::envision::ComAdptEnvision.
| void ccf::common::ComAdptBase::SetHostAdddress | ( | const std::string & | host_address | ) |
Set the address of the host (network interface) used for communication.
| 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!
| void ccf::common::ComAdptBase::SetIsSimAdapter | ( | const bool | is_sim | ) |
Set the Simulation Adapter Flag.
| void 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 ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
| void 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 ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
| void ccf::common::ComAdptBase::Write | ( | const 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 ccf::common::ComAdptBase::Write | ( | const std::vector< 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 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 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 ccf::protocols::envision::ComAdptEnvision, ccf::protocols::aravis::ComAdptAravis, ccf::control::ComAdptSim, and ccf::common::test::ComAdptTest.
|
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 |