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

A server handles all data requests through its equipment module. More...

List of all members.

Public Member Functions

int addAlarmDefinition (int code, TAlarmDefinition adef)
 Inserts an alarm definition into the alarm definition table.
int addAlarmDefinition (TAlarmDefinition adef)
 Inserts an alarm definition into the alarm definition table.
TDevice getDevice (String devName)
 Obtains a TDevice instance for the input device name.
TDevice getDevice (int devNumber)
 Obtains a TDevice instance for the input device number.
int addAlarmWatchTableEntry (String deviceName, String propertyName, int dataSize, int dataFormat, int alarmSystem, int alarmSeverity, int alarmCode, int alarmCodeHigh, int alarmCodeLow, TAlarmWatchThreshold alarmWatchThreshold)
 Inserts a property to be monitored into the local alarm server's Watch Table.
int addAlarmWatchTableEntry (String deviceName, String propertyName, int dataSize, int dataFormat, int alarmSeverity, int alarmCodeHigh, int alarmCodeLow, TAlarmWatchThreshold alarmWatchThreshold)
 Inserts a property to be monitored into the local alarm server's Watch Table.
int addAlarmWatchTableEntry (String deviceName, String propertyName, int dataSize, int dataFormat, int alarmSeverity, int alarmCode, TAlarmWatchThreshold alarmWatchThreshold)
 Inserts a property to be monitored into the local alarm server's Watch Table.
int addLocalHistoryRecord (int recordIndex, String device, String property, int dataSize, int dataFormat)
 Inserts a local history element into the local history server.
int addLocalHistoryRecord (int recordIndex, String device, String property, int dataSize, int dataFormat, int arrayType, THistorySpecification histSpec)
 Inserts a local history element into the local history server.
 TEquipmentModule ()
 Principal constructor.
void setEquipmentFunction (TEquipmentFunction eqpFunction)
 Assigns an equipment function.
void registerProperty (String prpName, TDataType dout, TDataType din, short acc, TPropertyDescription prpDesc, int prpId)
 Registers a property without a handler.
void registerProperty (TExportProperty prp, TPropertyHandler handler)
 Registers a property and assigns a handler.
void registerDevices (Collection< String[]> deviceCollection)
 Adds a collection of device names to the module's device list.
void registerDevice (TDevice device)
 Adds a device to the module's device list.
int registerDeviceName (String devName)
 Adds a device name to the module's device list.
LinkedList< String > getPropertyNames ()
 Returns all property names in a linked list.
LinkedList< String > getDeviceNames ()
 Returns all device names in a linked list.
boolean hasStockProperty (String propertyName)
 Returns true if this equipment module has registered a stock property of a given name.
short callStockProperty (String propertyName, String devName, TDataType dout, TDataType din, TAccess devAccess)
 Calls a stock property handler.
short callProperty (String propertyName, String devName, TDataType dout, TDataType din, TAccess devAccess)
 Finds a property and calls the property handler.
int scheduleProperty (String devPropertyList)
 An equipment module can schedule a property or set of properties for immediate execution and delivery.
int resetMultiChannelProperty (String devPropertyList)
 Sends (schedules) a 'reset_mca_property' signal to any listening client.
int registerCycleTrigger (TCycleTrigger trigger)
 Registers a cycle trigger callback dispatch function.
void setCycleNumberKey (String key)
 Sets the trigger cycler key to the value given.
String getCycleNumberKey ()
 Gets the trigger cycler key.
int unregisterCycleTrigger (TCycleTrigger trigger)
 Unregisters a previously registered cycle trigger callback dispatch function.
void setStateChangeTrigger (TStateChangeTrigger stateChangeTrigger)
 Establishes a state-change trigger callback for this equipment module.
void setStateChangeTrigger (TStateChangeTrigger stateChangeTrigger, String stateChangeKey)
 Establishes a state-change trigger callback for this equipment module.

Detailed Description

A server handles all data requests through its equipment module.

An exported device server refers to one and only one equipment module. The equipment module will have a property list and a device list associated with it.

Author:
duval

Constructor & Destructor Documentation

de.desy.tine.server.equipment.TEquipmentModule.TEquipmentModule ( )

Principal constructor.

Use this constructor in most cases. This will attempt to determine a suitable local name for the equipment module.


Member Function Documentation

int de.desy.tine.server.equipment.TEquipmentModule.addAlarmDefinition ( int  code,
TAlarmDefinition  adef 
)

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:
codeis a specific alarm code to apply the alarm definition to. (Use the method without this parameter to simply apply the code registered in the TAlarmDefinition instance.)
adefis an instance of an Alarm Definition Structure (ADS) containing the alarm table information which is to be appended to the alarm definition table
Returns:
0 or a TINE error code.
int de.desy.tine.server.equipment.TEquipmentModule.addAlarmDefinition ( TAlarmDefinition  adef)

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:
adefis an instance of an Alarm Definition Structure (ADS) containing the alarm table information which is to be appended to the alarm definition table
Returns:
0 or a TINE error code.
int de.desy.tine.server.equipment.TEquipmentModule.addAlarmWatchTableEntry ( String  deviceName,
String  propertyName,
int  dataSize,
int  dataFormat,
int  alarmSystem,
int  alarmSeverity,
int  alarmCode,
int  alarmCodeHigh,
int  alarmCodeLow,
TAlarmWatchThreshold  alarmWatchThreshold 
)

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 definable 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:
deviceNameis the device name associated with the property to be called by the local alarm server.
propertyNameis the property which is to be called by the local alarm server.
dataSizeis the data array size to be called by the local alarm server.
dataFormatis the TINE data format to be called by the local alarm server
alarmSystemis the alarm system identifier to be associated with the alarm. The value of '0' signals the Central Alarm Server to apply the designated alarm system code for the server in question.
alarmSeverityis the severity of the alarm issued when the data returned by the call exceed the given thresholds.
alarmCodeis the designated alarm code to apply to any alarm condition. Pass a '0' to distinguish between the alarmCodeHigh and alarmCodeLow conditions (next 2 parameters).
alarmCodeHighis the alarm code to apply when the high threshold value is exceeded by the readback data. (parameter alarmCode must be '0'). If both alarmCode and alarmCodeHigh are '0', then the code TErrorList.value_too_high (or TErrorList.warn_too_high) is applied.
alarmCodeLowis the alarm code to apply when the low threshold value is exceeded by the readback data. (parameter alarmCode must be '0'). If both alarmCode and alarmCodeLow are '0', then the code TErrorList.value_too_low (or TErrorList.warn_too_low) is applied.
alarmWatchThresholdis an intance of a TAlarmWatchThreshold which defines the threshold conditions for applying an alarm.
Returns:
0 or an TINE error code (e.g. TErrorList.illegal_property).
int de.desy.tine.server.equipment.TEquipmentModule.addAlarmWatchTableEntry ( String  deviceName,
String  propertyName,
int  dataSize,
int  dataFormat,
int  alarmSeverity,
int  alarmCodeHigh,
int  alarmCodeLow,
TAlarmWatchThreshold  alarmWatchThreshold 
)

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 definable 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:
deviceNameis the device name associated with the property to be called by the local alarm server.
propertyNameis the property which is to be called by the local alarm server.
dataSizeis the data array size to be called by the local alarm server.
dataFormatis the TINE data format to be called by the local alarm server
alarmSeverityis the severity of the alarm issued when the data returned by the call exceed the given thresholds.
alarmCodeHighis the alarm code to apply when the high threshold value is exceeded by the readback data. If alarmCodeHigh is '0', then the code TErrorList.value_too_high (or TErrorList.warn_too_high) is applied.
alarmCodeLowis the alarm code to apply when the low threshold value is exceeded by the readback data. If alarmCodeLow is '0', then the code TErrorList.value_too_low (or TErrorList.warn_too_low) is applied.
alarmWatchThresholdis an intance of a TAlarmWatchThreshold which defines the threshold conditions for applying an alarm.
Returns:
0 or an TINE error code (e.g. TErrorList.illegal_property).
int de.desy.tine.server.equipment.TEquipmentModule.addAlarmWatchTableEntry ( String  deviceName,
String  propertyName,
int  dataSize,
int  dataFormat,
int  alarmSeverity,
int  alarmCode,
TAlarmWatchThreshold  alarmWatchThreshold 
)

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 definable 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:
deviceNameis the device name associated with the property to be called by the local alarm server.
propertyNameis the property which is to be called by the local alarm server.
dataSizeis the data array size to be called by the local alarm server.
dataFormatis the TINE data format to be called by the local alarm server
alarmSeverityis the severity of the alarm issued when the data returned by the call exceed the given thresholds.
alarmCodeis the designated alarm code to apply to any alarm condition. Pass a '0' to distinguish between the alarmCodeHigh and alarmCodeLow conditions (next 2 parameters).
alarmWatchThresholdis an intance of a TAlarmWatchThreshold which defines the threshold conditions for applying an alarm.
Returns:
0 or an TINE error code (e.g. TErrorList.illegal_property).
int de.desy.tine.server.equipment.TEquipmentModule.addLocalHistoryRecord ( int  recordIndex,
String  device,
String  property,
int  dataSize,
int  dataFormat 
)

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.

Parameters:
recordIndexis 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).
deviceis the device name to be associated with the property name supplied as the second parameter.
propertyis the requested property for which a history is to be kept
dataSizeis the length of the local history call.
dataFormatis the TINE format of the local history call.
Note:
This call will use the default history acquision specifications of 1 Hz polling and archive intervals, 5 minutes short term and 1 month long term depths, 30 minutes archive heartbeat and 10 percent tolerance.
Returns:
int de.desy.tine.server.equipment.TEquipmentModule.addLocalHistoryRecord ( int  recordIndex,
String  device,
String  property,
int  dataSize,
int  dataFormat,
int  arrayType,
THistorySpecification  histSpec 
)

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.

Parameters:
recordIndexis 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).
deviceis the device name to be associated with the property name supplied as the second parameter.
propertyis the requested property for which a history is to be kept
dataSizeis the length of the local history call.
dataFormatis the TINE format of the local history call.
arrayTypeis the input property's array type. Passing a value of '0' (AT_UNKNOWN) will instruct the subsystem to determine the property's array type from the property registry.
histSpecis an instance of t THistorySpecification object which instructs the local history subsystem how to maintain the local history information (e.g. short and long term storage depths, filtering conditions, polling and archive intervals).
Returns:
short de.desy.tine.server.equipment.TEquipmentModule.callProperty ( String  propertyName,
String  devName,
TDataType  dout,
TDataType  din,
TAccess  devAccess 
)

Finds a property and calls the property handler.

If no property handler is installed, the equipment function is called instead.

Parameters:
propertyName
devName
dout
din
devAccess
Returns:
Return code of property handler/equipment function. TErrorList.non_existent_elem if no property handler and no equipment function could be found.
short de.desy.tine.server.equipment.TEquipmentModule.callStockProperty ( String  propertyName,
String  devName,
TDataType  dout,
TDataType  din,
TAccess  devAccess 
)

Calls a stock property handler.

Parameters:
propertyName
devName
dout
din
devAccess
Returns:
String de.desy.tine.server.equipment.TEquipmentModule.getCycleNumberKey ( )

Gets the trigger cycler key.

By default a CYCLER is a server called "CYCLER" in the same context as the initializing device server and produces a keyword (property) called "CycleNumber". This gives rise to the Cycle Key: "/\<context\>/CYCLER/CycleNumber". This default value can also be set via the environment (set TINE_CYCLE_KEY) or via API.

Returns:
the current setting of the cycler trigger key.
See also:
setCycleNumberKey, registerCycleTrigger
TDevice de.desy.tine.server.equipment.TEquipmentModule.getDevice ( String  devName)

Obtains a TDevice instance for the input device name.

Parameters:
devNameis the device name for which the TDevice instance is desired
Returns:
a TDevice Instance or null
TDevice de.desy.tine.server.equipment.TEquipmentModule.getDevice ( int  devNumber)

Obtains a TDevice instance for the input device number.

Parameters:
devNumberis the device number for which the TDevice instance is desired
Returns:
a TDevice Instance or null
LinkedList<String> de.desy.tine.server.equipment.TEquipmentModule.getDeviceNames ( )

Returns all device names in a linked list.

Returns:
LinkedList<String> de.desy.tine.server.equipment.TEquipmentModule.getPropertyNames ( )

Returns all property names in a linked list.

Returns:
boolean de.desy.tine.server.equipment.TEquipmentModule.hasStockProperty ( String  propertyName)

Returns true if this equipment module has registered a stock property of a given name.

Parameters:
propertyName
Returns:
int de.desy.tine.server.equipment.TEquipmentModule.registerCycleTrigger ( TCycleTrigger  trigger)

Registers a cycle trigger callback dispatch function.

If a CYCLER is running in a server's context, then the server will receive 'Cycle Number' events scheduled by the designated CYCLER server. The cycle number will make use of the 'System Data Stamp' to tag all data sets obtained from the server. A server can also register a trigger function dispatch routine (or routines) to be called when a 'Cycle Number' event occurs. The dispatch routines will be called prior to setting the 'System Stamp' to the new Cycle Number, which will be set following the execution of all dispatch routines. Optionally, the server can provide a property (or list of properties) to be scheduled following the dispatch execution. This will ensure that such properties will be called immediately following dispatch execution AND contain the most recent Cycle Number as the 'System Data Stamp'.

Parameters:
triggeris a reference to the dispatch handler to be called when a new cycle number arrives.
Returns:
0 upon success or TErrorList.already_assigned

Example:

  class MyCycleTrigger implements TCycleTrigger
  {
    long ts = 0;
    public void update(int cycleNumber, int status)
    {
      long tts = System.currentTimeMillis();
      if (ts == tts)
      { // 2 updates within the same millisecond ? (are there 2 CYCLERs?)
        return;
      }
      ts = tts;
      DbgLog.log("update","received cycle number : "+cycleNumber+" <"+status+">");
      // do something useful?  (maybe hardware IO)
    } 
  }
  private void initializeDeviceServer()
  {
    sineEqpModule = new SineEquipmentModule("SINEQM",(SineDevice[])sineDeviceSet.toArray(new SineDevice[0]));
    sineEqpModule.registerCycleTrigger(new MyCycleTrigger());
    // can alternatively be registered directly with the equipment module factory (e.g.):
    // TEquipmentModuleFactory.getInstance().registerCycleTrigger(new MyCycleTrigger());
    // Other iniatialization stuff omitted ...
    // ...
  }
void de.desy.tine.server.equipment.TEquipmentModule.registerDevice ( TDevice  device)

Adds a device to the module's device list.

Parameters:
deviceis the TDevice instance to register
int de.desy.tine.server.equipment.TEquipmentModule.registerDeviceName ( String  devName)

Adds a device name to the module's device list.

This method also creates a TDevice instance for the device name in question, which can be retrieved via a call to getDevice().

Parameters:
devNameis the device name to be assigned
Returns:
the assigned device number
void de.desy.tine.server.equipment.TEquipmentModule.registerProperty ( String  prpName,
TDataType  dout,
TDataType  din,
short  acc,
TPropertyDescription  prpDesc,
int  prpId 
)

Registers a property without a handler.

This property has to be handled by the equipment function.

Parameters:
prpNameis the property name
doutProvides output format specification
dinProvides input format specification
accAccess information
prpDescProperty description, parsed into a string description of the property as well as range values and units.
prpIdan assigned Property ID
Returns:
void de.desy.tine.server.equipment.TEquipmentModule.registerProperty ( TExportProperty  prp,
TPropertyHandler  handler 
)

Registers a property and assigns a handler.

Parameters:
prpis the TExportProperty instance to be registered
handleris the designated property dispatch handler
See also:
TPropertyHandler, TExportProperty, TPropertyDescription example
int de.desy.tine.server.equipment.TEquipmentModule.resetMultiChannelProperty ( String  devPropertyList)

Sends (schedules) a 'reset_mca_property' signal to any listening client.

A server with registered multi-channel array properties can inform any attached clients that the mutli-channel array configuration has changed (e.g. array elements have been added, removed, or otherwise edited) by using this call. Any listening clients with multi-channel array links will then return to the original client startup conditions and 're-learn' the new array indexing now in place.

Parameters:
devPropertyListis (comma separated) list of properties which are to be reset at the client side.
Note:
This routine will call scheduleProperty() to assure immediate notification at the client side.
Returns:
0 upon success, otherwise a TINE return code.
int de.desy.tine.server.equipment.TEquipmentModule.scheduleProperty ( String  devPropertyList)

An equipment module can schedule a property or set of properties for immediate execution and delivery.

Parameters:
devPropertyListA single string argument containing one or more properties to be scheduled for immediate execution. This should be a single string. If more than one property is to be scheduled, then the property list string should be a set of properties separated by commas or blanks
Author:
duval
void de.desy.tine.server.equipment.TEquipmentModule.setCycleNumberKey ( String  key)

Sets the trigger cycler key to the value given.

By default a CYCLER is a server called "CYCLER" in the same context as the initializing device server and produces a keyword (property) called "CycleNumber". This gives rise to the Cycle Key: "/\<context\>/CYCLER/CycleNumber". If it is known a priori, that the CYCLER exists in another context or uses another server name or property name, the cycle key can be set via this API call or via environment (set TINE_CYCLE_KEY=<key>).

Parameters:
keyis the desired CYCLER trigger key
See also:
registerCycleTrigger
void de.desy.tine.server.equipment.TEquipmentModule.setEquipmentFunction ( TEquipmentFunction  eqpFunction)

Assigns an equipment function.

Parameters:
eqpFunction
void de.desy.tine.server.equipment.TEquipmentModule.setStateChangeTrigger ( TStateChangeTrigger  stateChangeTrigger)

Establishes a state-change trigger callback for this equipment module.

If a GLOBLAS server is running and providing state information, then any detected state change will be passed to the callback function provided. The callback must implement the TStateChangeTrigger class. It will receive both the current state and previous state (as Strings).

Parameters:
stateChangeTriggeris a reference to the callback instance.
void de.desy.tine.server.equipment.TEquipmentModule.setStateChangeTrigger ( TStateChangeTrigger  stateChangeTrigger,
String  stateChangeKey 
)

Establishes a state-change trigger callback for this equipment module.

If a GLOBLAS server is running and providing state information, then any detected state change will be passed to the callback function provided. The callback must implement the TStateChangeTrigger class. It will receive both the current state and previous state (as Strings).

Parameters:
stateChangeTriggeris a reference to the callback instance.
stateChangeKeyis the GLOBALS keyword providing the declared state for the context associated with this equipment module. If 'null' then the default keyword "DeclaredState" is assumed.
int de.desy.tine.server.equipment.TEquipmentModule.unregisterCycleTrigger ( TCycleTrigger  trigger)

Unregisters a previously registered cycle trigger callback dispatch function.

If a cycle trigger event dispatch routine is no longer required, it can be unregistered using this routine.

Parameters:
triggeris a reference to the dispatch handler to be removed
Returns:
0 upon success or return TErrorList.un_allocated

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