Register Related Functions (to be used with fwHw)


Functions

 fwSpecs_setWriteReadTimeout (int tmout=30)
bool fwSpecs_write (dyn_string pRegistersList, dyn_dyn_anytype pDataList, dyn_int &pStatusList, bool pWaitFlag=true, dyn_dyn_anytype pMaskList=makeDynAnytype())
bool fwSpecs_read (dyn_string pRegistersList, dyn_dyn_anytype &pDataList, dyn_int &pStatusList, dyn_string pFileNames=make_dyn_string())
bool fwSpecs_writeRead (dyn_string pRegistersList, dyn_dyn_anytype pDataWriteList, dyn_dyn_anytype &pDataReadList, dyn_int &pStatusList, dyn_dyn_anytype pMaskList=makeDynAnytype())
bool fwSpecs_startMonitoring (dyn_string pRegistersList, dyn_int pRefreshRateList=makeDynInt(), dyn_bool pDataChangeList=makeDynBool())
bool fwSpecs_stopMonitoring (dyn_string pRegistersList)
bool fwSpecs_isMonitoring (dyn_string pRegistersList, dyn_bool &pStatusList, dyn_int &pRefreshRateList)

Detailed Description

List of common (not linked to a specific bus system) functions to operate with Specs. And also the following function: These functions are related to the fwHw library and are kept for historic reasons within this framework. Registers have to be created and subscribed via the fwHw library. After subscribtion all necessary DIM commands and services are created and the registers can be accessed via this set of functions.

NOTE: Previously also this library contained functions to create registers. It is not recommended to use these functions any longer!!! Although they would be still accessible and are just removed from the documentation. Registers created with these functions share a common datapoint for communication via DIM - which is not the case when using the fwHw library, where every register has its own datapoints for communication. The creation of registers inside this framework was just intended for debugging reasons.

Also historic reasons has the fact that when registers are not yet subscribed (see fwHw) the monitoring of registers can be started and a read service is automatically created by the server used for monitoring. However no write or read commands can be sent to this register - just the read service is launched which is regularly updated.

Link to the fwHw documentation: http://lhcb-online.web.cern.ch/lhcb-online/ecs/FWHW/default.html


Function Documentation

bool fwSpecs_isMonitoring ( dyn_string  pRegistersList,
dyn_bool &  pStatusList,
dyn_int &  pRefreshRateList 
)

This functions is obsolete, it used to return a list containing the status of the monitoring of registers.

Parameters:
[in] pRegistersList list containing the register(s) to check if they are being used for monitoring or not.
[out] pStatusList list containing the status of the monitoring of registers. If true, the register is being used for monitoring, otherwise (false) the register is not being used for monitoring.
[out] pRefreshRateList list containing the refresh rate monitoring of the register(s) (in seconds).
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_string registers;
  dyn_bool   status;
  dyn_int    refresh;
  int        i;

  dynAppend(registers, "myReg01");
  dynAppend(registers, "myReg02");

  if (fwSpecs_isMonitoring(registers, status, refresh))   // check if registers 'myReg01' and 'myReg02' are being used for monitoring
     for(i = 1; i <= dynlen(registers); i++)
        if (status[i])
           DebugTN("Register " + registers[i] + " is being used for monitoring with a refresh rate of " + refresh[i] + " second(s)");
        else
           DebugTN("Register " + registers[i] + " is not being used for monitoring"); 
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_read ( dyn_string  pRegistersList,
dyn_dyn_anytype &  pDataList,
dyn_int &  pStatusList,
dyn_string  pFileNames = make_dyn_string() 
)

Read data from the specified register(s), using the settings stored in that/those register(s).

Parameters:
[in] pRegistersList list containing the name of the register(s) where to get the settings and to store the data read.
[out] pDataList list with the data read from the specified register(s).
[out] pStatusList list with the returned value(s) of the reading(s). The return value can be: equal to 0 (no error found); greater than 0 (error found and related with SpecsUser; see error codes); equal to -1 (error found and related with PVSS).
[in] pFileNames (optional) A list of file names (format = file:<fname>) if the data should be written to file instead of read into PVSS.
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_dyn_char data;
  dyn_string   registers;
  dyn_int      status;
  int          i;

  dynAppend(registers, "myReg01");
  dynAppend(registers, "myReg02");

  if (fwSpecs_read(registers, data, status))   // read data from registers 'myReg01' and 'myReg02'
     for(i = 1; i <= dynlen(status); i++)
     {
        DebugTN("Data: " + data[i]);
        DebugTN("Status: " + status[i]);
     }
  else
     DebugTN("Error found!");
  (...)



fwSpecs_setWriteReadTimeout ( int  tmout = 30  ) 

Set the Timeout for fwSpecs_write, fwSpecs_read and fwSpecs_writeRead Operations. Can be used before any of these functions or before applying a recipe, for example fwHw_getApplyRecipe().

Parameters:
[in] tmout The timeout in seconds (default is 30 seconds).

bool fwSpecs_startMonitoring ( dyn_string  pRegistersList,
dyn_int  pRefreshRateList = makeDynInt(),
dyn_bool  pDataChangeList = makeDynBool() 
)

Start monitoring a set of register(s), using the settings stored in that/those register(s).

Parameters:
[in] pRegistersList list containing the registers(s) where to get the settings and to store the data coming from the monitoring.
[in] pRefreshRateList list containing the refresh rate monitoring (in seconds). Note: this parameter is optional (if not specified, it will take the value specified in the specific settings of the register).
[in] pDataChangeList list containing the data change enable/disable option. If true, the server will send data when it change, otherwise (false) the server will not send data (even if it change). Note: this parameter is optional (if not specified, it will take the value specified in the specific settings of the register).
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_string registers;
  dyn_int    refreshRate;
  dyn_bool   dataChange;

  dynAppend(registers, "myReg01");
  dynAppend(registers, "myReg02");
  dynAppend(refreshRate, 5);
  dynAppend(refreshRate, 10);
  dynAppend(dataChange, false);
  dynAppend(dataChange, true);

  if (fwSpecs_startMonitoring(registers, refreshRate, dataChange))   // start monitoring registers 'myReg01' and 'myReg02'
     (...)
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_stopMonitoring ( dyn_string  pRegistersList  ) 

Stop monitoring a set of registers.

Parameters:
[in] pRegistersList list containing the register(s) to stop monitoring.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_stopMonitoring(makeDynString("myReg01", "myReg02")))   // stop monitoring registers 'myReg01' and 'myReg02'
     (...)
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_write ( dyn_string  pRegistersList,
dyn_dyn_anytype  pDataList,
dyn_int &  pStatusList,
bool  pWaitFlag = true,
dyn_dyn_anytype  pMaskList = makeDynAnytype() 
)

Write data into the specified register(s), using the settings stored in that/those register(s).

Parameters:
[in] pRegistersList list containing the name of the register(s) where to get the settings and to write the specified data.
[in] pDataList list containing the data to be written in the specified register(s).
[out] pStatusList list with the returned value(s) of the writing(s). The return value can be: equal to 0 (no error found); greater than 0 (error found and related with SpecsUser; see error codes); equal to -1 (error found and related with PVSS).
[in] pWaitFlag if true, the function will wait for the return value, otherwise (false) the function will not wait for the return value (in this case, the return value will be always equal to 0 or -1). Note: this parameter is optional (if not specified, the default will be true).
[in] pMaskList (optional) list containing masks to be applied to the data.
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_dyn_char data;
  dyn_string   registers;
  dyn_int      status;
  int          i;

  dynAppend(registers, "myReg01");
  dynAppend(registers, "myReg02");
  data[1] = makeDynChar(41, 42, 43);
  data[2] = makeDynChar(61, 62, 63);

  if (fwSpecs_write(registers, data, status, true))   // write data into the registers 'myReg01' and 'myReg02'
     for(i = 1; i <= dynlen(status); i++)
        DebugTN("Status: " + status[i]);
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_writeRead ( dyn_string  pRegistersList,
dyn_dyn_anytype  pDataWriteList,
dyn_dyn_anytype &  pDataReadList,
dyn_int &  pStatusList,
dyn_dyn_anytype  pMaskList = makeDynAnytype() 
)

Write and, then, read data from the specified register(s), using the settings stored in that/those register(s). This function should be used whenever possible, since it will optimize speed. Note: if the write operation fails, then the read operation will not be performed.

Parameters:
[in] pRegistersList list containing the name of the register(s) where to get the parameters (settings) and to store the data read.
[in] pDataWriteList list containing the data to be written in the specified register(s).
[out] pDataReadList list with the data read from the specified register(s).
[out] pStatusList list with the returned value(s) of the reading(s). The return value can be: equal to 0 (no error found); greater than 0 (error found and related with SpecsUser; see error codes); equal to -1 (error found and related with PVSS).
[in] pMaskList (optional) list containing masks to be applied to the data when writing.
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_dyn_char dataWrite;
  dyn_dyn_char dataRead;
  dyn_string   registers;
  dyn_int      status;
  int          i;

  dynAppend(registers, "myReg01");
  dynAppend(registers, "myReg02");
  dataWrite[1] = makeDynChar(41, 42, 43);
  dataWrite[2] = makeDynChar(61, 62, 63);

  if (fwSpecs_writeRead(registers, dataWrite, dataRead, status))   // write and, then, read from registers 'myReg01' and 'myReg02'
     for(i = 1; i <= dynlen(status); i++)
     {
        DebugTN("Data: " + dataRead[i]);
        DebugTN("Status: " + status[i]);
     }
  else
     DebugTN("Error found!");
  (...)




Generated on Fri Mar 28 13:36:50 2008 for FwSpecs by  doxygen 1.4.7