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 override |
| Check if controller is in Standby/Ready state. | |
| bool | IsOperational () const override |
| Check if controller is in Operational. | |
| bool | IsHwFailure () const override |
| Check if controller is in Hardware Failure. | |
| 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) 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 | 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< IDeviceConfig > | GetDeviceConfig () 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< IDeviceConfig > | m_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::DataContext & | m_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 |
|
inline |
|
inlinevirtual |
Executes the Disable RPC.
| an | exception if an error ocurrs. |
This RPC call shall bring the controller to Standby/Ready state.
Reimplemented from ifw::fcf::devmgr::common::DeviceLcsIf.
|
inlinevirtual |
Executes the Enable RPC.
| an | exception if an error ocurrs. |
This RPC call shall bring the controller to Operational state.
Reimplemented from ifw::fcf::devmgr::common::DeviceLcsIf.
|
inlinevirtual |
Get error message.
| error_code | Input error code |
| update | Flag that indicate to read the error code. |
This methods does a read to the PLC to obtain the error code.
Reimplemented from ifw::fcf::devmgr::common::DeviceLcsIf.
|
inlinevirtual |
Get associated message from the RPC error code.
| [in] | error_code |
Implements ifw::fcf::devmgr::common::DeviceLcsIf.
|
inlinevirtual |
Executes the Init RPC.
| an | exception if an error ocurrs. |
Reimplemented from ifw::fcf::devmgr::common::DeviceLcsIf.
|
inlineoverridevirtual |
Check if controller is in Hardware Failure.
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.
|
inlineoverridevirtual |
Check if controller is in Operational.
Reimplemented from ifw::fcf::devmgr::common::DeviceLcsIf.
|
inlineoverridevirtual |
Check if controller is in Standby/Ready state.
Reimplemented from ifw::fcf::devmgr::common::DeviceLcsIf.
|
inlinevirtual |
Callback for listening controller events.
| params | list of paramaters to be monitored. |
Abstract method to be implemented by specific classes.
Callback for OPC UA subscription notifications.
| note | one 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.
|
inline |
|
inlinevirtual |
Start monitoring of controller attributes.
| an | exception 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.
|
inlinevirtual |
Stop monitoring of controller attributes.
| an | exception 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.