Main Page | Features | Central Services | csv-Files | Types | Transfer | Access | API-C | API-VB/ActiveX | API-Java | Examples | Downloads
Public Member Functions
tine::TEquipmentModule Class Reference

TEquipmentModule is the a TINE server's equipment module class. More...

Public Member Functions

int AppendAlarmInfoTable (ref ADS ads)
 Inserts an alarm definition into the alarm definition table.
int AppendAlarmWatchTable (string prp, string dev, Int32 siz, Int32 fmt, Int32 atyp, Int32 sev, Int32 sys, ref ALM_THRESHOLDS thr)
 Inserts a property to be monitored into the local alarm server's Watch Table.
int AppendHistoryInformation (string prp, string dev, Int32 len, Int32 fmt, Int32 idx, ref HistorySpecification hspec)
 Inserts a local history element into the local history server.
void ClearAlarm (Int32 devNr)
 Instructs the local alarm server table that the given alarm is to be cleared.
void ClearAlarm (string devName)
 Instructs the local alarm server table that the given alarm is to be cleared.
Int32 GetDeviceNumber (string device)
 Returns the registered device number for the device name given.
Int32 GetDeviceNumber (string device, string property)
 Returns the registered device number for the device name and property given.
Int32 GetPropertyId (string property)
 Returns the registered property identification number for the property entered.
int RegisterDeviceName (String devName, Int32 devNr)
 Assigns a device name to the specified device number.
int RegisterPropertyInformation (string property, TDataType dout, TDataType din, UInt16 acc, UInt16 atype, int rowLength, string dsc, int propId, string rdr)
 Assigns pertinent information for the specified property.
void RemoveAlarm (string devName, Int32 almCode)
 Instructs the local alarm server table that the given alarm is to be marked for removal.
Int32 ScheduleProperty (string property)
 Schedules the given property for immediate delivery to all attached clients.
Int32 ScheduleProperty (string property, Int32 scope)
 Schedules the given property for immediate delivery to all attached clients according scope specified.
int SetAlarm (string devName, Int32 almCode, object almData, byte almFlags)
 Inserts an alarm into the local alarm server table.
int SetAlarm (Int32 devNr, Int32 almCode, object almData, byte almFlags)
 Inserts an alarm into the local alarm server table.
int SetAlarm (Int32 devNr, Int32 almCode)
 Inserts an alarm into the local alarm server table.
 TEquipmentModule (string exp, string eqm, Int32 ndev, CallHandler hndlr, FcnDispatch ini, FcnDispatch bkg, Int32 bkgInterval, FcnDispatch exi)
 Primary constructor for an equipment module object.

Detailed Description

TEquipmentModule is the a TINE server's equipment module class.

An equipment module represents a device server. This is ideally a class which manages like instances of a set of devices. The equipment module is responsible for handling dispatch actions pertaining to registered properties ('READ' or 'WRITE' actions).


Constructor & Destructor Documentation

tine::TEquipmentModule::TEquipmentModule ( string  exp,
string  eqm,
Int32  ndev,
CallHandler  hndlr,
FcnDispatch  ini,
FcnDispatch  bkg,
Int32  bkgInterval,
FcnDispatch  exi 
) [inline]

Primary constructor for an equipment module object.

A FEC (front-end controller) process can contain more than one equipment module (which is exported as a device server or property server). However, a FEC process should contain at least one equipment module in order to be a useful element in the control system.

Parameters:
expis the equipment module's exported device or property server name (maximum 32 characters). This name must be unique within a given context. If a 'null' parameter is passed, then the exported name must be given by an underlying configuration file such as 'export.csv' or 'fec.xml'
eqmis the equipment module's internal 'local' name (maximum 6-characters). This name must be unique within the process only, and is used for internal de-referencing.
ndevgives the maximum device capacity (maximum number of device instances supported by this device server.
hndlris the equipment module's dispatch call handler. This must be a function of the form: int CallHandler(string dev, string prp, TDataType dout, TDataType din, UInt16 acc, TEquipmentModule eqm);
iniis an optional initialization routine for the equipment module. This must be a function of the form: void FcnDispatch();
bkgis an optional background routine for the equipment module, which will be called at the given background task interval. This must be a function of the form: void FcnDispatch();
bkgIntervalis the background task interval in play if a background task is registered.
exiis an optional background routine for the equipment module, which will be called at the given background task interval. This must be a function of the form: void FcnDispatch();

/b Example: /include eg_RegisterEqm.cs


Member Function Documentation

int tine::TEquipmentModule::AppendAlarmInfoTable ( ref ADS  ads) [inline]

Inserts an alarm definition into the alarm definition table.

As an alternative to the <local name>="">-alarms.csv configuration file, the front end server can make use of this API call in order to fill in the alarm definition table describing locally generated alarms. This is particularly useful for embedded platforms where there is no file system, or where a TINE server is used as a translation layer and needs to map a given alarm system onto the TINE alarm system.

Parameters:
adsis a pointer to an Alarm Definition Structure (ADS) containing the alarm table information which is to be appended to the alarm definition table.
Returns:
0 upon success, otherwise a TINE error code.
int tine::TEquipmentModule::AppendAlarmWatchTable ( string  prp,
string  dev,
Int32  siz,
Int32  fmt,
Int32  atyp,
Int32  sev,
Int32  sys,
ref ALM_THRESHOLDS  thr 
) [inline]

Inserts a property to be monitored into the local alarm server's Watch Table.

Certain alarms are to be set whenever the value of a property exceeds a defineable threshold. Such alarms can be managed automatically by the local alarm server if the alarm criteria are entered into the alarm watch table. This can be achieved by calling this routine (or supplying a startup configuration file almwatch.csv).

Parameters:
prpis the property which is to be called by the local alarm server.
devis the device name associated with the property to be called by the local alarm server.
sizis the data array size to be called by the local alarm server.
fmtis the TINE data format to be called by the local alarm server.
atypis the TINE data array type to be applied to the property called by the local alarm server.
sevis the severity of the alarm issued when the data returned by the call exceed the given thresholds.
sysis the alarm system identifier to be associated with the alarm.
thris an ALM_THRESHOLDS object specifying the threshold criteria for setting the alarm.
Returns:
0 upon success, otherwise a TINE error code.
int tine::TEquipmentModule::AppendHistoryInformation ( string  prp,
string  dev,
Int32  len,
Int32  fmt,
Int32  idx,
ref HistorySpecification  hspec 
) [inline]

Inserts a local history element into the local history server.

A server can instruct the local history server to keep a history of the given property by utilizing this call. The local history server will periodically call the property as specified according to the following input parameters. /remarks>

Parameters:
prpis the requested property for which a history is to be kept.
devis the device name to be associated with the property name supplied as the second parameter.
lenis the length of the local history call.
fmtis the TINE format of the local history call.
idxis the local history index to be identified with this local history element (Note: this must be unique with this server process and within the history data repository).
hspecis a pointer to a HistorySpecification structure, where the relevant filtering criteria are given.
Returns:
0 upon success, otherwise a TINE error code.

/note In lieu of calling AppendHistoryInformation(), it is recommended to make use of the startup configuration file 'history.csv', in which all local history critieria can be introduced. This has the advantage that no information is hard-coded. Indeed by introducing a 'history.csv' file one can immediately instruct a server to maintain local history information (even if the server is developed and maintained by someone else!). /b Example: /include eg_AppendHistory.cs

void tine::TEquipmentModule::ClearAlarm ( string  devName) [inline]

Instructs the local alarm server table that the given alarm is to be cleared.

A server can clear alarms for specific device by giving its device name. Note that all alarms for the device specified are cleared. Also note, that "clearing" an alarm means that its "clear" counter is incremented. It is not removed immediately from the local alarm list. For further information, please see the discussion of the local alarm server.

Parameters:
devNameis the registered device name of the device for which all alarms is to be cleared.
void tine::TEquipmentModule::ClearAlarm ( Int32  devNr) [inline]

Instructs the local alarm server table that the given alarm is to be cleared.

A server can clear alarms for specific device by giving its device number. Note that all alarms for the device specified are cleared. Also note, that "clearing" an alarm means that its "clear" counter is incremented. It is not removed immediately from the local alarm list. For further information, please see the discussion of the local alarm server.

Parameters:
devNris the device number of the device for which all alarms is to be cleared.
Int32 tine::TEquipmentModule::GetDeviceNumber ( string  device,
string  property 
) [inline]

Returns the registered device number for the device name and property given.

A pure device server will maintain a list of registered devices, each of which may support any particular given property. In such cases the 'property' parameter is irrelevant, as any associated device number is independent of the property.

On the other hand, a 'property' server will treat properties as the more relevant identifier, whereby each property may support an independent set of 'device' names (or more probably 'keyword' names). In such cases the property name entered is of paramount importance in determining the registered device (or keyword) number.

Parameters:
deviceis the device name whose assigned device number is desired. If the device name entered does not correspond to a registered device the value '-1' is returned.
propertyis the property whose device set is being queried.
Returns:
The corresponding device number or '-1' on error.

/b Example: /include eg_GetPropId.cs

Int32 tine::TEquipmentModule::GetDeviceNumber ( string  device) [inline]

Returns the registered device number for the device name given.

Parameters:
deviceis the device name whose assigned device number is desired. If the device name entered does not correspond to a registered device the value '-1' is returned.
Returns:
The corresponding device number or '-1' on error.
Int32 tine::TEquipmentModule::GetPropertyId ( string  property) [inline]

Returns the registered property identification number for the property entered.

Parameters:
propertyis the property whose assigned property identification is desired
Returns:
The property identication number of -1 on error.
int tine::TEquipmentModule::RegisterDeviceName ( String  devName,
Int32  devNr 
) [inline]

Assigns a device name to the specified device number.

Many servers handle instances of a given device type, such as a set of vacuum pumps, beam position monitors, magnet power supply controllers, etc. It is frequently very efficient to code in terms of device numbers which might be an index into an array, but to specify modules in calls by their human-readable names. For such purposes a device name can be assigned to a number at initialization via a call to RegisterDeviceName() (alias: RegisterModuleName()). An alternative is to provide a startup database file 'devices.csv' containing a cross-reference for numbers and names. Internally, a hash table is maintained for fast lookups inside equipment module routines.

Parameters:
devNameUp to 64 characters device name to be assigned
devNrThe device number associated with the device name specified.
Returns:
0 if successful, otherwise a TINE completion code

Example:

  myeqm = new TEquipmentModule("DotNetSine", "DNTEQM", 10, sineqm, sinini, sinbkg, 1000, sinexi);

  TDataType dtout = new TDataType(8192,Formats.CF_FLOAT,null);

  myeqm.RegisterPropertyInformation("Sine", dtout, null, Access.CA_READ, ArrayType.AT_TRACE, 8192, "[-512:512 V]Sine Curve", PRP_SINE, "");
  dtout = new TDataType(10, Formats.CF_FLOAT, null);

  TDataType dtin = new TDataType(1, Formats.CF_FLOAT, null);
  myeqm.RegisterPropertyInformation("Amplitude", dtout, dtin, Access.CA_READ | Access.CA_WRITE, ArrayType.AT_CHANNEL, 10, "[-512:512 V]Sine Curve Amplitude", PRP_AMPLITUDE, "");
  myeqm.RegisterPropertyInformation("Frequency", dtout, dtin, Access.CA_READ | Access.CA_WRITE, ArrayType.AT_CHANNEL, 10, "[1:20 Hz]Sine Curve Frequency", PRP_FREQUENCY, "");
  myeqm.RegisterPropertyInformation("Phase", dtout, dtin, Access.CA_READ | Access.CA_WRITE, ArrayType.AT_CHANNEL, 10, "[0:6.28]Sine curve Phase", PRP_PHASE, "");
  myeqm.RegisterPropertyInformation("Noise", dtout, dtin, Access.CA_READ | Access.CA_WRITE, ArrayType.AT_CHANNEL, 10, "[0:50 V]Sine curve Noise", PRP_NOISE, "");

  for (int i = 0; i < 10; i++)
  { // put in some device names
    myeqm.RegisterDeviceName("SineGen" + i, i);
  }
int tine::TEquipmentModule::RegisterPropertyInformation ( string  property,
TDataType  dout,
TDataType  din,
UInt16  acc,
UInt16  atype,
int  rowLength,
string  dsc,
int  propId,
string  rdr 
) [inline]

Assigns pertinent information for the specified property.

Servers export their behavior through Properties, which can be thought of as 'properties' in the Object Oriented sense with Get and Set methods. That is, any read or write access for a given property will call into the associated equipment module and be handled there. The general behavior of the property (including descriptions) can be specified with this call. Properties can also be (and frequently are) registered via the presence of an 'exports.csv' startup database file. Note: Properties which are overloaded can and should be registered more than once with the appropriate characteristics supplied in the registration call.

Parameters:
prpNameProperty name in question (up to 32 characters, preferably 16 or less).
dtOutAtemplate data object giving the default format size, and structure tag (if any) of the output data set to be returned by the server to the caller.
dtInA template data object giving the default format size, and structure tag (if any) of the input data set to be supplied by the caller.
accessModethe data 'access' (e.g. CA_READ or CA_WRITE) accepted by the server. This parameter can be used to coerce client-side links into using preferred link attributes. For example, by applying the CA_NETWORK flag (CA_READ|CA_NETWORK) to the access, asynchronous NETWORK (i.g. multicast acquisition) will be enforced at the client side. Applying the CA_XREAD access flag will likewise allow exclusive READ access regarding the registered property (i.e. the same security rules applied to CA_WRITE will be in force for READ acquisitions, either permanently - no CA_READ flag, or temporarily in case of an applied access lock - if both CA_READ and CA_XREAD are applied). Applying the CA_SAVERESTORE flag will apply the internal save-and-restore logic to the registered property (restoring the last property settings upon server startup, and saving any changed property settings).
arrayTypeData 'array type' (AT_SCALAR, AT_SINGLE, etc.) associated with the returned data.
rowLengthif > 0 gives the row length of the returned array data. This is most relevant for double arrays, where the number of rows is then given by the output data size divided by the row length.
prpDescriptionThe 64-character description of what the property reads or writes.
prpIdThe property identifier to be associated with the property name returned in calls to GetPropertyId()
redirectionTargetA redirection string, if the property is to be redirected to another server. Most properties are not redirected, and this parameter is usually NULL. If used, it will be parsed according to device server/device name (device property), where the 'device name' and 'device property' are optional. If 'device name' is not present, all devices will be redirected to the specified device server. If 'device property' is not present then the identical property name as registered will be redirected to the device server specified. If on the other hand, the device property is present in the string to be parsed, then the property registered will be redirected to the device server specified as well as to the device property specified.
Returns:
The (positive) associated property identifier if successful, otherwise the negative of a TINE return code.

Example:

  myeqm = new TEquipmentModule("DotNetSine", "DNTEQM", 10, sineqm, sinini, sinbkg, 1000, sinexi);

  TDataType dtout = new TDataType(8192,Formats.CF_FLOAT,null);

  myeqm.RegisterPropertyInformation("Sine", dtout, null, Access.CA_READ, ArrayType.AT_TRACE, 8192, "[-512:512 V]Sine Curve", PRP_SINE, "");
  dtout = new TDataType(10, Formats.CF_FLOAT, null);

  TDataType dtin = new TDataType(1, Formats.CF_FLOAT, null);
  myeqm.RegisterPropertyInformation("Amplitude", dtout, dtin, Access.CA_READ | Access.CA_WRITE, ArrayType.AT_CHANNEL, 10, "[-512:512 V]Sine Curve Amplitude", PRP_AMPLITUDE, "");
  myeqm.RegisterPropertyInformation("Frequency", dtout, dtin, Access.CA_READ | Access.CA_WRITE, ArrayType.AT_CHANNEL, 10, "[1:20 Hz]Sine Curve Frequency", PRP_FREQUENCY, "");
  myeqm.RegisterPropertyInformation("Phase", dtout, dtin, Access.CA_READ | Access.CA_WRITE, ArrayType.AT_CHANNEL, 10, "[0:6.28]Sine curve Phase", PRP_PHASE, "");
  myeqm.RegisterPropertyInformation("Noise", dtout, dtin, Access.CA_READ | Access.CA_WRITE, ArrayType.AT_CHANNEL, 10, "[0:50 V]Sine curve Noise", PRP_NOISE, "");
void tine::TEquipmentModule::RemoveAlarm ( string  devName,
Int32  almCode 
) [inline]

Instructs the local alarm server table that the given alarm is to be marked for removal.

A server can remove alarms for specific device by giving its registered device name. Note that only the alarm specified for the device specified is removed. Also note, that "removing" an alarm means that termination bit will be set. It is subsequently marked for removal from the local alarm list. For further information, please see the discussion of the local alarm server.

Parameters:
devName
almCode
Int32 tine::TEquipmentModule::ScheduleProperty ( string  property) [inline]

Schedules the given property for immediate delivery to all attached clients.

When clients are attached to a particular property, they have specified a polling rate, which defines the maximum latency for receiving updates at the client side. This is usually fine. However, if a server knows that important data have changed and which properties depend on these data, it can signal the scheduler to call the given properties immediately and send the data to all attached callers, regardless of their registered polling rates. In this way, a server can signal an event to its attached clients. In this simple call, clients from all listening subsystems will be scheduled (i.e. the local history and alarm subsystem as well as any remote clients).

Parameters:
propertyis (comma separated) list of properties which are to be scheduled.
Returns:
Int32 tine::TEquipmentModule::ScheduleProperty ( string  property,
Int32  scope 
) [inline]

Schedules the given property for immediate delivery to all attached clients according scope specified.

When clients are attached to a particular property, they have specified a polling rate, which defines the maximum latency for receiving updates at the client side. This is usually fine. However, if a server knows that important data have changed and which properties depend on these data, it can signal the scheduler to call the given properties immediately and send the data to all attached callers, regardless of their registered polling rates. In this way, a server can signal an event to its attached clients. In this extended call, the caller can specify the 'scope' of the call : CA_NETWORK (all listening clients), CA_HIST (the local history subsystem) or CA_ALARM (the local alarm server).

Parameters:
propertyis (comma separated) list of properties which are to be scheduled.
scopeis any of CA_NETWORK, CA_HIST, or CA_ALARM ORed together.
Returns:
0 upon success or a TINE error code.
int tine::TEquipmentModule::SetAlarm ( Int32  devNr,
Int32  almCode,
object  almData,
byte  almFlags 
) [inline]

Inserts an alarm into the local alarm server table.

A server can set an alarm for a specific device by giving its device number. This methods also allows passing associated alarm data and specific alarm flags. For further information, please see the discussion of the local alarm server.

Parameters:
devNris the device number of the device for which the alarm is to be set.
almCodeis the registered alarm code which defines the alarm.
almDatais (up to 64-byte) the optional alarm data set, which supplies additional information for the alarm.
almFlagsis the optional set of alarm flags which is used in the alarm descriptor information.
Returns:
int tine::TEquipmentModule::SetAlarm ( string  devName,
Int32  almCode,
object  almData,
byte  almFlags 
) [inline]

Inserts an alarm into the local alarm server table.

A server can set an alarm for a specific device by giving its device name (as opposed to its device number). This methods also allows passing associated alarm data and specific alarm flags. For further information, please see the discussion of the local alarm server.

Parameters:
devNameis the device name for which the alarm is to be set.
almCodeis the registered alarm code which defines the alarm.
almDatais (up to 64-byte) the optional alarm data set, which supplies additional information for the alarm.
almFlagsis the optional set of alarm flags which is used in the alarm descriptor information.
Returns:
int tine::TEquipmentModule::SetAlarm ( Int32  devNr,
Int32  almCode 
) [inline]

Inserts an alarm into the local alarm server table.

A server can set an alarm for a specific device by giving its device number. For further information, please see the discussion of the local alarm server.

Parameters:
devNris the device number of the device for which the alarm is to be set.
almCodeis the registered alarm code which defines the alarm.
Returns:

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

Generated for TINE API by  doxygen 1.5.8