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

Public Member Functions

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

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

Member Function Documentation

◆ Disable()

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

◆ Enable()

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

◆ GetError()

std::string testDeviceFacade::MyDeviceLcsIf::GetError ( )
inline

◆ GetHwError()

std::string testDeviceFacade::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 testDeviceFacade::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.

◆ Init()

void testDeviceFacade::MyDeviceLcsIf::Init ( )
inlinevirtual

Executes the Init RPC.

Exceptions
anexception if an error ocurrs.

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

◆ IsFailure()

bool testDeviceFacade::MyDeviceLcsIf::IsFailure ( ) const
inline

◆ IsHwFailure()

bool testDeviceFacade::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.

◆ IsNotReady()

bool testDeviceFacade::MyDeviceLcsIf::IsNotReady ( ) const
inlinevirtual

Check if controller is in Standby/NotReady state.

Returns
true if condition is met, false otherwise.

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

◆ IsOperational()

bool testDeviceFacade::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 testDeviceFacade::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.

◆ Listener()

void testDeviceFacade::MyDeviceLcsIf::Listener ( const ifw::fnd::defs::Notification & note)
inlinevirtual

Callback for listening controller events.

Parameters
paramslist of paramaters to be monitored.

Abstract method to be implemented by specific classes.

Callback for OPC UA subscription notifications.

Parameters
noteone notification (NodeId + value + status + timestamp)

Invoked from ualib's notification-dispatch worker (a background thread). The handler must be non-blocking and not throw. Each subscribed node delivers its own notifications one at a time — the old "VectorVariant batch arrived" model is replaced by one notification per call.

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

◆ ReadConfig()

void testDeviceFacade::MyDeviceLcsIf::ReadConfig ( )
inline

◆ StartMonitoring()

void testDeviceFacade::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 testDeviceFacade::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: