ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Enumerations | Functions | Variables
devmgr Namespace Reference

Namespaces

 common
 
 lamp
 
 motor
 
 sensor
 
 shutter
 

Enumerations

enum  { STAT_LOCAL = 1, STAT_ERROR = 2, STAT_STATE = 3, STAT_SUBSTATE = 4 }
 

Functions

virtual virtual void ReadConfig ()
 DeviceConfig constructor. More...
 
virtual void GetConfig (fcf::common::VectorVariant &params)
 Obtain the list of configuration parameters. More...
 
virtual std::string GetMapFile ()
 
virtual void GetConfigList (std::vector< std::string > &cfg_list, std::string prefix)
 Get configuration list. More...
 
 m_data_ctx (data_ctx)
 
virtual bool IsReady ()
 {{cookiecutter.device_name}}LcsIf constructor. More...
 
virtual bool IsOperational ()
 Check if controller is in Operational. More...
 
bool IsHwFailure ()
 Check if {{cookiecutter.device_name|capitalize()}} is in hardware error. More...
 
virtual void ReadStatus ({{cookiecutter.device_name|capitalize()}}ControllerData &status)
 Read status from the controller. More...
 
void StartMonitoring ()
 Start monitoring of controller attributes. More...
 
void StopMonitoring ()
 Stop monitoring of controller attributes. More...
 
void Listener (fcf::common::VectorVariant &params)
 Callback to manage changes on the monitored items. More...
 
virtual std::string GetRpcError (const short error_code) const
 
virtual std::string GetHwError ()
 Get error message. More...
 

Variables

const short SUBSTATE_INITIALISING = 101
 
const short SUBSTATE_STANDBY_FAILURE = 104
 
const std::string SUBSTATE_NOTREADY_STR = "NotReady"
 
const std::string SUBSTATE_INITIALISING_STR = "Initialising"
 
const std::unordered_map
< short, std::string > 
SubstateMap
 
const std::vector< std::string > cfgMapping
 
const std::vector< std::string > statMapping
 
const std::vector< std::string > rpcMapping
 
class {
upper
 {{cookiecutter.device_name}} Configuration class More...
 
devmgr::common::MapCfgBool m_map_cfg_bool
 Map for {{cookiecutter.device_name}} boolean paramaters. More...
 
devmgr::common::MapCfgInt m_map_cfg_int
 Map for {{cookiecutter.device_name}} integer parameters. More...
 
devmgr::common::MapCfgUInt m_map_cfg_uint
 Map for {{cookiecutter.device_name}} unsigned int parameters. More...
 
const std::unordered_map
< short, std::string > 
hw_errors
 
class {
enum
 {{cookiecutter.device_name|capitalize()}} Local Control System (LCS) Interface (IF) class More...
 
std::unordered_map
< std::string, short > 
m_status_map
 
devmgr::common::DataContextm_data_ctx
 reference to the data context. More...
 
const std::unordered_map
< short, std::string > 
rpc_errors
 

Enumeration Type Documentation

anonymous enum
Enumerator
STAT_LOCAL 
STAT_ERROR 
STAT_STATE 
STAT_SUBSTATE 

Function Documentation

virtual void devmgr::GetConfig ( fcf::common::VectorVariant &  params)
virtual

Obtain the list of configuration parameters.

Parameters
[in,out]paramsoutput vector with the list of config parameters

This methods prepare a vector with all the configuration parameters of a {{cookiecutter.device_name}} with the purpose to write it into the controller.

virtual void devmgr::GetConfigList ( std::vector< std::string > &  cfg_list,
std::string  prefix 
)
virtual

Get configuration list.

Parameters
cfg_listList of all configuration parameters.
prefixPrefix to be added to the attributes names.

This method returs the complete of configuration parameters handled by this class. This method is used to dump the list into the DB.

virtual std::string devmgr::GetHwError ( )
virtual

Get error message.

Returns
error message associated to the error code read from the PLC.
virtual std::string devmgr::GetMapFile ( )
virtual
Returns
mapping file
virtual std::string devmgr::GetRpcError ( const short  error_code) const
virtual
Parameters
error_codeError code
Returns
Associated error text to the passed error code.
bool devmgr::IsHwFailure ( )

Check if {{cookiecutter.device_name|capitalize()}} is in hardware error.

virtual bool devmgr::IsOperational ( )
virtual

Check if controller is in Operational.

Returns
true if condition is met, false otherwise.
virtual bool devmgr::IsReady ( )
virtual

{{cookiecutter.device_name}}LcsIf constructor.

Parameters
[in,out]configShared pointer to the device configuration.
[in,out]data_ctxReference to the data context object. Check if controller is in Standby/Ready state
Returns
true if condition is met, false otherwise.
void devmgr::Listener ( fcf::common::VectorVariant &  params)

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.

devmgr::m_data_ctx ( data_ctx  )
void devmgr::ReadConfig ( )
virtual

DeviceConfig constructor.

Read the configuration.

Parameters
[in]filenamefilename of the device configuration file.
[in]nameDevice identifier. DeviceConfig destructor Read the configuration

This reads the {{cookiecutter.device_name}} configuration attributes in memory and check the presence of all attributes that are mandatory.

Exceptions
std::runtime_errorin case of an error

This class reads the mapping configuration of the device.

virtual void devmgr::ReadStatus ( {{cookiecutter.device_name|capitalize()}}ControllerData &  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.
void devmgr::StartMonitoring ( )

Start monitoring of controller attributes.

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.

void devmgr::StopMonitoring ( )

Stop monitoring of controller attributes.

This method will inform the communication interface to stop monitoring the {{cookiecutter.device_name|capitalize()}} attributes.

Variable Documentation

const std::vector<std::string> devmgr::cfgMapping
Initial value:
= {
}
class { ... } devmgr::enum
Initial value:
{
struct {{cookiecutter.device_name|capitalize()}}ControllerData : devmgr::common::DeviceControllerData {
public:
{{cookiecutter.device_name|capitalize()}}ControllerData();
virtual ~{{cookiecutter.device_name|capitalize()}}ControllerData();
inline std::string GetErrorText() const;
void SetData(const {{cookiecutter.device_name|capitalize()}}ControllerData& data);
protected:
}
The DeviceControllerData struct.
Definition: deviceLcsIf.hpp:30
#define cookiecutter
class My capitalize()}}
Definition: Test{{cookiecutter.device_name}}.cpp:89

{{cookiecutter.device_name|capitalize()}} Local Control System (LCS) Interface (IF) class

This class manages the {{cookiecutter.device_name|capitalize()}} 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 succesfully 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.

const std::unordered_map<short, std::string> devmgr::hw_errors
Initial value:
= {
{HW_ERR_HW_NOT_OP, "{{cookiecutter.device_name|capitalize()}} no in operational state"},
{HW_ERR_WRONG_CMD, "{{cookiecutter.device_name|capitalize()}} unknown command"},
{HW_ERR_INCONSISTENT, "{{cookiecutter.device_name|capitalize()}} inconsistent hardware signals"},
{HW_ERR_INIT_FAILURE, "{{cookiecutter.device_name|capitalize()}} init failure"},
{HW_ERR_ENABLE_FAILURE, "{{cookiecutter.device_name|capitalize()}} enable failure"},
{HW_ERR_DISABLE_FAILURE, "{{cookiecutter.device_name|capitalize()}} disable failure"},
}
Definition: lampHwErrors.hpp:21
Definition: sensorHwErrors.hpp:22
Definition: sensorHwErrors.hpp:26
Definition: lampHwErrors.hpp:22
Definition: sensorHwErrors.hpp:23
Definition: sensorHwErrors.hpp:25
devmgr::common::DataContext& devmgr::m_data_ctx

reference to the data context.

devmgr::common::MapCfgBool devmgr::m_map_cfg_bool

Map for {{cookiecutter.device_name}} boolean paramaters.

devmgr::common::MapCfgInt devmgr::m_map_cfg_int

Map for {{cookiecutter.device_name}} integer parameters.

devmgr::common::MapCfgUInt devmgr::m_map_cfg_uint

Map for {{cookiecutter.device_name}} unsigned int parameters.

std::unordered_map<std::string, short> devmgr::m_status_map
const std::unordered_map<short, std::string> devmgr::rpc_errors
Initial value:
= {
{RPC_ERR_NOT_OP, "Cannot disable {{cookiecutter.device_name|capitalize()}}. Not in OP state"},
{RPC_ERR_NOT_STANDBY_READY, "Cannot enable {{cookiecutter.device_name|capitalize()}}. Not in STANDBY_READY."},
{RPC_ERR_NOT_STANDBY_NOTREADY, "Cannot init {{cookiecutter.device_name|capitalize()}}. Not in STANDBY_NOTREADY or FAILURE."}
}
Definition: lampRpcErrors.hpp:23
Definition: lampRpcErrors.hpp:21
Definition: lampRpcErrors.hpp:22
const std::vector<std::string> devmgr::rpcMapping
Initial value:
= {
devmgr::common::RpcInit,
devmgr::common::RpcEnable,
devmgr::common::RpcDisable,
devmgr::common::RpcReset,
devmgr::common::RpcStop
}
const std::vector<std::string> devmgr::statMapping
Initial value:
= {
devmgr::common::StatSubstate,
devmgr::common::StatState
}
const short devmgr::SUBSTATE_INITIALISING = 101
const std::string devmgr::SUBSTATE_INITIALISING_STR = "Initialising"
const std::string devmgr::SUBSTATE_NOTREADY_STR = "NotReady"
const short devmgr::SUBSTATE_STANDBY_FAILURE = 104
const std::unordered_map<short, std::string> devmgr::SubstateMap
Initial value:
= {
}
const std::string SUBSTATE_INITIALISING_STR
Definition: deviceConfig.hpp:87
const short SUBSTATE_NOTREADY
Definition: deviceConfig.hpp:81
const short SUBSTATE_INITIALISING
Definition: deviceConfig.hpp:82
const std::string SUBSTATE_NOTREADY_STR
Definition: deviceConfig.hpp:86
class { ... } devmgr::upper

{{cookiecutter.device_name}} Configuration class

This class manages the configuration of a {{cookiecutter.device_name}}. It reads the configuration file and provides the methods to obtain the parameters used by the auxiliary classes.