ifw-fcf 8.0.2
 
Loading...
Searching...
No Matches
testDeviceLcsIf::MyDeviceLcsIf Class Reference
Inheritance diagram for testDeviceLcsIf::MyDeviceLcsIf:
ifw::fcf::devmgr::common::DeviceLcsIf

Public Member Functions

 MyDeviceLcsIf (std::shared_ptr< testDeviceLcsIf::MyDeviceConfig > config, ifw::fcf::devmgr::common::DataContext &data_ctx)
 
void ReadConfig ()
 
bool IsReady () const
 Check if controller is in Standby/Ready state.
 
bool IsOperational () const
 Check if controller is in Operational.
 
bool IsHwFailure () const
 Check if controller is in Hardware Failure.
 
void StartMonitoring ()
 Start monitoring of controller attributes.
 
void StopMonitoring ()
 Stop monitoring of controller attributes.
 
std::string GetRpcError (short error_code) const
 Get associated message from the RPC error code.
 
std::string GetHwError (int &, const bool=false)
 Get error message.
 
- Public Member Functions inherited from ifw::fcf::devmgr::common::DeviceLcsIf
 DeviceLcsIf (std::shared_ptr< IDeviceConfig > config, DataContext &data_ctx)
 DeviceLcsIf constructor.
 
virtual void InitObject ()
 Initialize object.
 
virtual void RegisterComm (std::shared_ptr< ifw::fnd::defs::ICommAdapter > comm_if, std::function< void()> on_failure, std::function< void()> on_normal)
 Register a communication interface.
 
virtual void Connect ()
 Connect to the controller or simulator.
 
virtual void Disconnect ()
 Disconnect from the controller of simulator.
 
virtual bool IsNotReady () const
 Check if controller is in Standby/NotReady state.
 
virtual bool IsDisabling () const
 Check if controller is in Disabling state.
 
virtual void Init ()
 Executes the Init RPC.
 
virtual void Enable ()
 Executes the Enable RPC.
 
virtual void Disable ()
 Executes the Disable RPC.
 
virtual void Stop ()
 Executes the Stop RPC.
 
virtual void Reset ()
 Executes the Reset RPC.
 
virtual void ReadStatus (DeviceControllerData &status)
 ReadStatus.
 
virtual void Listener (const ifw::fnd::defs::Notification &note)
 Callback for listening controller events.
 
std::string GetMapValue (const std::string &category, const std::string &key) const
 Get mapping value.
 
ifw::fnd::defs::SubscriptionHandler GetSubscriptionHandler ()
 Return the subscription handler this object hands to ualib::Client::Subscribe. Test code uses this to drive notifications synthetically (replaces the old GetDispatcher() return-by-reference pattern).
 
bool IsConfigLoaded () const
 Check if configuration was loaded.
 
bool IsConnected () const
 Check is the communication was established.
 
virtual std::shared_ptr< IDeviceConfigGetDeviceConfig () const
 Get a pointer of device configuration.
 
const elt::configng::CiiConfigInstanceNamespace & GetCfgInstance () const
 
virtual void GetStates (int &state, int &substate)
 Get states (state and substate) of the controller.
 

Additional Inherited Members

- Public Types inherited from ifw::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 ifw::fcf::devmgr::common::DeviceLcsIf
void LoadConfig ()
 Load the YAML configuration.
 
void ExecuteRpc (const std::string &obj, const std::string &proc, std::vector< ifw::fnd::defs::CallArgument > args)
 Call an RPC, parse the short reply, throw on non-zero.
 
int ReadErrorCode ()
 
void StoreUaNames (const std::vector< std::pair< std::string, unsigned int > > &ualist)
 StoreUaNames.
 
void StoreAttribute (const std::string &key, const ifw::fnd::defs::Value &value, int attribute)
 Store the updated into the DB.
 
void SetConfigLoad (bool flag)
 
- Static Protected Member Functions inherited from ifw::fcf::devmgr::common::DeviceLcsIf
static std::pair< std::string, std::string > DecodeRpcAddress (const std::string &proc, const std::string &obj_hint="")
 Split an FCF '#' RPC address into the OPC UA object + method node ids that the Call service needs.
 
- Protected Attributes inherited from ifw::fcf::devmgr::common::DeviceLcsIf
std::shared_ptr< IDeviceConfigm_config
 Shared pointer to the device config object.
 
std::unique_ptr< elt::configng::CiiConfigDocument > m_config_doc
 Config document for mapping file.
 
std::string m_lcs_prefix
 Store the prefix for storing keys in the database.
 
std::shared_ptr< ifw::fnd::defs::ICommAdapter > m_comm
 Shared pointer to the comm adapter (typically ualib::Client in production; mocked in unit tests).
 
std::function< void()> m_on_failure
 Callback invoked on failure-significant transitions (replaces the old Dispatcher<> failure fan-out).
 
std::function< void()> m_on_normal
 Callback invoked on recovery transitions (replaces the old Dispatcher<> normal fan-out).
 
ifw::fnd::defs::RegistrationToken m_state_token
 Keeps the connection-state observer registered for the lifetime of this device.
 
int m_state {}
 Actual controller state.
 
int m_substate {}
 Actual controller substate.
 
bool m_local {false}
 Actual local flag.
 
int m_error_code {false}
 Actual error code.
 
bool m_config_loaded {false}
 Flag indicating whether the configuration was successfully loaded.
 
bool m_connected {false}
 Flag indicating whether the LCS is connected.
 
ifw::fcf::devmgr::common::DataContextm_data_ctx
 
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()

testDeviceLcsIf::MyDeviceLcsIf::MyDeviceLcsIf ( std::shared_ptr< testDeviceLcsIf::MyDeviceConfig > config,
ifw::fcf::devmgr::common::DataContext & data_ctx )
inlineexplicit

Member Function Documentation

◆ GetHwError()

std::string testDeviceLcsIf::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 ifw::fcf::devmgr::common::DeviceLcsIf.

◆ GetRpcError()

std::string testDeviceLcsIf::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 ifw::fcf::devmgr::common::DeviceLcsIf.

◆ IsHwFailure()

bool testDeviceLcsIf::MyDeviceLcsIf::IsHwFailure ( ) const
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 ifw::fcf::devmgr::common::DeviceLcsIf.

◆ IsOperational()

bool testDeviceLcsIf::MyDeviceLcsIf::IsOperational ( ) const
inlinevirtual

Check if controller is in Operational.

Returns
true if condition is met, false otherwise.

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

◆ IsReady()

bool testDeviceLcsIf::MyDeviceLcsIf::IsReady ( ) const
inlinevirtual

Check if controller is in Standby/Ready state.

Returns
true if condition is met, false otherwise.

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

◆ ReadConfig()

void testDeviceLcsIf::MyDeviceLcsIf::ReadConfig ( )
inline

◆ StartMonitoring()

void testDeviceLcsIf::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 ifw::fcf::devmgr::common::DeviceLcsIf.

◆ StopMonitoring()

void testDeviceLcsIf::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 ifw::fcf::devmgr::common::DeviceLcsIf.


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