ifw-fcf  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
MyDeviceLcsIf Class Reference
Inheritance diagram for MyDeviceLcsIf:
fcf::devmgr::common::DeviceLcsIf

Public Member Functions

 MyDeviceLcsIf (std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config, fcf::devmgr::common::DataContext &data_ctx)
 
void Init ()
 Executes the Init RPC. More...
 
void Enable ()
 Executes the Enable RPC. More...
 
void Disable ()
 Executes the Disable RPC. More...
 
void ReadConfig ()
 
bool IsReady ()
 Check if controller is in Standby/Ready state. More...
 
bool IsOperational ()
 Check if controller is in Operational. More...
 
bool IsHwFailure ()
 Check if controller is in Hardware Failure. More...
 
void StartMonitoring ()
 Start monitoring of controller attributes. More...
 
void StopMonitoring ()
 Stop monitoring of controller attributes. More...
 
void Listener (fcf::common::VectorVariant &params)
 Callback for listening controller events. More...
 
std::string GetRpcError (short error_code) const
 Get associated message from the RPC error code. More...
 
std::string GetHwError (int &error_code, const bool update=false)
 Get error message. More...
 
- 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 IsDisabling ()
 Check if controller is in Disabling state. More...
 
virtual void Stop ()
 Executes the Stop RPC. More...
 
virtual void Reset ()
 Executes the Reset RPC. 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...
 

Public Attributes

bool m_ready
 
bool m_not_ready
 
bool m_operational
 
bool m_is_disabling
 

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
}
 
- 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 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
 

Constructor & Destructor Documentation

MyDeviceLcsIf::MyDeviceLcsIf ( std::shared_ptr< fcf::devmgr::common::IDeviceConfig config,
fcf::devmgr::common::DataContext data_ctx 
)
inline

Member Function Documentation

void MyDeviceLcsIf::Disable ( )
inlinevirtual

Executes the Disable RPC.

Exceptions
anexception if an error ocurrs.

This RPC call shall bring the controller to Standby/Ready state.

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

void MyDeviceLcsIf::Enable ( )
inlinevirtual

Executes the Enable RPC.

Exceptions
anexception if an error ocurrs.

This RPC call shall bring the controller to Operational state.

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

std::string MyDeviceLcsIf::GetHwError ( int &  error_code,
const bool  update = false 
)
inlinevirtual

Get error message.

Parameters
error_codeInput error code
updateFlag that indicate to read the error code.
Returns
error message associated to the error code read from the PLC.

This methods does a read to the PLC to obtain the error code.

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

std::string MyDeviceLcsIf::GetRpcError ( short  error_code) const
inlinevirtual

Get associated message from the RPC error code.

Parameters
[in]error_code
Returns
string with the associated error message.

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

void MyDeviceLcsIf::Init ( )
inlinevirtual

Executes the Init RPC.

Exceptions
anexception if an error ocurrs.

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

bool MyDeviceLcsIf::IsHwFailure ( )
inlinevirtual

Check if controller is in Hardware Failure.

Returns
true if condition is met, false otherwise.

Sometimes the controller may enter into a failure state triggerd by a hardware error. The controller will enter into a specific state to signal this condition. This method is checking if this condition is met.

This method reads the substate attribute from the PLC.

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

bool MyDeviceLcsIf::IsOperational ( )
inlinevirtual

Check if controller is in Operational.

Returns
true if condition is met, false otherwise.

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

bool MyDeviceLcsIf::IsReady ( )
inlinevirtual

Check if controller is in Standby/Ready state.

Returns
true if condition is met, false otherwise.

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

void MyDeviceLcsIf::Listener ( fcf::common::VectorVariant &  params)
inlinevirtual

Callback for listening controller events.

Parameters
paramslist of paramaters to be monitored.

Abstract method to be implemented by specific classes.

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

void MyDeviceLcsIf::ReadConfig ( )
inline
void MyDeviceLcsIf::StartMonitoring ( )
inlinevirtual

Start monitoring of controller attributes.

Exceptions
anexception if an error ocurrs.

This methods take cares of registering the attributes that will be monitored by the communication class. Most of the communication will be OPCUA and this monitoring means OPCUA subscription.

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

void MyDeviceLcsIf::StopMonitoring ( )
inlinevirtual

Stop monitoring of controller attributes.

Exceptions
anexception if an error ocurrs.

This method will inform the communication interface to stop monitoring the shutter attributes. All OPCUA subscriptions will be removed.

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

Member Data Documentation

bool MyDeviceLcsIf::m_is_disabling
bool MyDeviceLcsIf::m_not_ready
bool MyDeviceLcsIf::m_operational
bool MyDeviceLcsIf::m_ready

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