ifw-fcf  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE > Class Template Reference

Adc Local Control System (LCS) Interface (IF) class. More...

#include <adcLcsIf.hpp>

Inheritance diagram for fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >:
fcf::devmgr::common::DeviceLcsIf

Public Member Functions

 AdcLcsIf (std::shared_ptr< AdcConfig > config, fcf::devmgr::common::DataContext &data_ctx)
 adcLcsIf constructor. More...
 
virtual ~AdcLcsIf ()
 Default destructor. More...
 
virtual void Init ()
 Executes the Init RPC. More...
 
void MoveAbs (int axis_id, double position, double velocity)
 Executes the MoveAbs RPC. More...
 
void MoveRel (int axis_id, double position, double velocity)
 Executes the MoveRel RPC. More...
 
void MoveVel (int axis_id, double velocity)
 Executes the MoveVel RPC. More...
 
bool IsMoving ()
 Check if motor is moving. More...
 
bool IsStandstill ()
 Check if motor is on. More...
 
bool IsTracking ()
 Check if adc is tracking. More...
 
void ReadConfig ()
 Read the configuration. More...
 
std::string GetMotorMapValue (std::string motor, std::string category, std::string key)
 
void MoveAngle (double angle)
 Move adc to a position angle. More...
 
void StartTrack (double angle)
 Start ADC tracking. More...
 
void StopTrack ()
 StopTrack. More...
 
virtual void ReadStatus (AdcControllerData &status)
 Read status from the controller. More...
 
void StartTrackMonitoring ()
 
void StopMonitoring ()
 Stop monitoring of controller attributes. More...
 
void StopTrackMonitoring ()
 
void Listener (fcf::common::VectorVariant &params)
 Callback to manage changes on the monitored items. More...
 
virtual std::string GetRpcError (const short error_code) const
 
- Public Member Functions inherited from fcf::devmgr::common::DeviceLcsIf
 DeviceLcsIf (std::shared_ptr< IDeviceConfig > config, DataContext &data_ctx)
 DeviceLcsIf constructor. More...
 
virtual void RegisterComm (std::shared_ptr< fcf::common::IComm > comm_if, fcf::common::Dispatcher<> &failure, fcf::common::Dispatcher<> &normal)
 Register a communication interface. More...
 
virtual void Connect ()
 Connect to the controller or simulator. More...
 
virtual void Disconnect ()
 Disconnect from the controller of simulator. More...
 
virtual void ReadConfig (const std::vector< std::string > &stat_map_vector, const std::vector< std::string > &rpc_map_vector)
 Read the configuration. More...
 
virtual bool IsNotReady ()
 Check if controller is in Standby/NotReady state. More...
 
virtual bool IsReady ()
 Check if controller is in Standby/Ready state. More...
 
virtual bool IsDisabling ()
 Check if controller is in Disabling state. More...
 
virtual bool IsOperational ()
 Check if controller is in Operational. More...
 
virtual bool IsHwFailure ()
 Check if controller is in Hardware Failure. More...
 
virtual void Enable ()
 Executes the Enable RPC. More...
 
virtual void Disable ()
 Executes the Disable RPC. More...
 
virtual void Stop ()
 Executes the Stop RPC. More...
 
virtual void Reset ()
 Executes the Reset RPC. More...
 
virtual void StartMonitoring ()
 Start monitoring of controller attributes. More...
 
virtual std::string GetHwError (int &error_code, const bool update=false)
 Get error message. More...
 
std::string GetMapValue (std::string category, std::string key)
 Get mapping valLampConfigue. More...
 
fcf::common::Dispatcher
< fcf::common::VectorVariant & > & 
GetDispatcher ()
 
bool IsConfigLoaded () const
 Check if configuration was loaded. More...
 
bool IsConnected () const
 Check is the communication was established. More...
 
virtual std::shared_ptr
< IDeviceConfig
GetDeviceConfig ()
 Get a pointer of device configuration. More...
 

Protected Member Functions

void LoadConfig ()
 Load the YAML configuration. More...
 
- Protected Member Functions inherited from fcf::devmgr::common::DeviceLcsIf
void LoadConfig ()
 Load the YAML configuration. More...
 
void ExecuteRpc (const std::string &obj, const std::string &proc, fcf::common::VectorVariant &attr_list)
 
int ReadErrorCode ()
 
void GetStates (int &state, int &substate)
 Get states (state and substate) of the controller. More...
 
void StoreUaNames (const std::vector< std::pair< std::string, unsigned int >> &ualist)
 StoreUaNames. More...
 
void StoreAttribute (const std::string key, const fcf::common::Variant &value, int attribute)
 Store the updated into the DB. More...
 

Protected Attributes

std::vector< std::string > m_monitor_track_vector
 Special monitor vector of attributes to be monitored only in tracking mode. More...
 
std::unordered_map
< std::string, std::unique_ptr
< rad::cii::Publisher
< fcfif::MotorPositionTopic > > > 
m_motor_publisher_map
 
std::unique_ptr
< rad::cii::Publisher
< TOPIC_TYPE > > 
m_publisher
 
- Protected Attributes inherited from fcf::devmgr::common::DeviceLcsIf
YAML::Node m_config_node
 YAML node for the device mapping file. More...
 
std::shared_ptr
< fcf::common::IComm > 
m_comm
 Shared pointer to the communication object. More...
 
std::shared_ptr< IDeviceConfigm_config
 Shared pointer to the device config object. More...
 
fcf::common::Dispatcher
< fcf::common::VectorVariant & > 
m_dispatcher
 Dispatcher for managing subscription events. More...
 
fcf::common::Dispatcher m_failure
 Dispatcher for managing failures in the communication. More...
 
fcf::common::Dispatcher m_normal
 Dispatcher for managing recovery of communication failures. More...
 
short m_state
 Actual controller state. More...
 
short m_substate
 Actual controller substate. More...
 
bool m_config_loaded
 Flag indicating whether the configuration was successfully loaded. More...
 
bool m_connected
 Flag indicating whether the LCS is connected. More...
 
devmgr::common::DataContextm_data_ctx
 
std::string m_lcs_prefix
 Store the prefix for storing keys in the database. More...
 
elt::mal::Mal::Properties m_mal_properties
 
std::string m_pub_endpoint
 
std::unordered_map
< std::string, short > 
m_ua_status_map
 
std::vector< std::string > m_ua_monitor_vector
 
std::unordered_map< short,
std::string > 
m_hw_errors
 

Additional Inherited Members

- Public Types inherited from fcf::devmgr::common::DeviceLcsIf
enum  {
  STAT_LOCAL = 1, STAT_ERROR = 2, STAT_HW_STATUS = 3, STAT_STATE = 4,
  STAT_SUBSTATE = 5
}
 

Detailed Description

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
class fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >

Adc Local Control System (LCS) Interface (IF) class.

This class manages the Adc connection to the LCS encapsulating all basic communication with the controller or the simulator.

Each RPC call is synchronous but it only starts the action in the controller. The controller will return successfully if the action can be started, not that the action was completed.

The completion of the action must be monitored by reading the status of the controller but this is out of the scope of this class.

Constructor & Destructor Documentation

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::AdcLcsIf ( std::shared_ptr< AdcConfig config,
fcf::devmgr::common::DataContext data_ctx 
)

adcLcsIf constructor.

Parameters
[in,out]configShared pointer to the device configuration.
[in,out]data_ctxReference to the data context object.
template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
virtual fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::~AdcLcsIf ( )
inlinevirtual

Default destructor.

Member Function Documentation

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
std::string fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::GetMotorMapValue ( std::string  motor,
std::string  category,
std::string  key 
)
template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
virtual std::string fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::GetRpcError ( const short  error_code) const
virtual
Parameters
error_codeError code
Returns
Associated error text to the passed error code.

Implements fcf::devmgr::common::DeviceLcsIf.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
virtual void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::Init ( )
virtual

Executes the Init RPC.

Exceptions
anexception if an error ocurrs.

Reimplemented from fcf::devmgr::common::DeviceLcsIf.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
bool fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::IsMoving ( )

Check if motor is moving.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
bool fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::IsStandstill ( )

Check if motor is on.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
bool fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::IsTracking ( )

Check if adc is tracking.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::Listener ( fcf::common::VectorVariant &  params)
virtual

Callback to manage changes on the monitored items.

Parameters
[in]paramsVector containing the list of atributes that have changed

This method implement the actions associated to the events originated from the monitoring of attributes.

This method is storing in the database the values that have changed. It also publish the events for the clients via zeroMQ.

Implements fcf::devmgr::common::DeviceLcsIf.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::LoadConfig ( )
protected

Load the YAML configuration.

Exceptions
rad::Exceptionin case of error
template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::MoveAbs ( int  axis_id,
double  position,
double  velocity 
)

Executes the MoveAbs RPC.

Exceptions
anexception if an error ocurrs.

This RPC call make the motor move in absolute user units.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::MoveAngle ( double  angle)

Move adc to a position angle.

Parameters
angletarget position angle.
template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::MoveRel ( int  axis_id,
double  position,
double  velocity 
)

Executes the MoveRel RPC.

Exceptions
anexception if an error ocurrs.

This RPC call make the motor move in relative user units.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::MoveVel ( int  axis_id,
double  velocity 
)

Executes the MoveVel RPC.

Parameters
axis_idAxis identifier.
velocitySpeed in which the motor will be moved.
Exceptions
anexception if an error ocurrs.

This RPC call make the motor move in velocity mode.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::ReadConfig ( )

Read the configuration.

This class reads the mapping configuration of the device.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
virtual void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::ReadStatus ( AdcControllerData status)
virtual

Read status from the controller.

Parameters
statusstructure containing the status of the controller.
Warning
: The unpacking of the data shall follow the proper order or there is the risk of having an exception related to the boost conversion to variant.
template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::StartTrack ( double  angle)

Start ADC tracking.

Parameters
angleoffset position angle.
template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::StartTrackMonitoring ( )
template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::StopMonitoring ( )
virtual

Stop monitoring of controller attributes.

This method will inform the communication interface to stop monitoring the Adc attributes.

Reimplemented from fcf::devmgr::common::DeviceLcsIf.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::StopTrack ( )

StopTrack.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
void fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::StopTrackMonitoring ( )

Member Data Documentation

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
std::vector<std::string> fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::m_monitor_track_vector
protected

Special monitor vector of attributes to be monitored only in tracking mode.

template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
std::unordered_map<std::string, std::unique_ptr<rad::cii::Publisher<fcfif::MotorPositionTopic> > > fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::m_motor_publisher_map
protected
template<typename TOPIC_TYPE = fcfif::AdcTopicUnion>
std::unique_ptr<rad::cii::Publisher<TOPIC_TYPE> > fcf::devmgr::adc::AdcLcsIf< TOPIC_TYPE >::m_publisher
protected

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