Protected Member Functions | |
| afx_msg short | _ScheduleProperty (LPCTSTR PropertyList) |
| Schedules all contracts attached the any of the properties in the PropertyList for immediate delivery. | |
| afx_msg void | EqpClearAlarm (short devNumber) |
| Clears all alarms associated with the device number given. | |
| afx_msg void | EqpClearDeviceAlarm (LPCTSTR devName) |
| Clears all alarms associated with the device name given. | |
| afx_msg BSTR | EqpGetModuleName (short DevNumber) |
| retrieves the device name assigned to the device number passed | |
| afx_msg short | EqpGetModuleNumber (LPCTSTR DevName) |
| retrieves the device number assigned to the device name passed | |
| afx_msg short | EqpGetModuleNumberEx (LPCTSTR DevName, const VARIANT FAR &DevProperty) |
| retrieves the device number assigned to the device name and device property passed | |
| afx_msg short | EqpRecv (long data) |
| Retrieves incoming data from the TINE server engine. | |
| afx_msg short | EqpRecvData (const VARIANT FAR &data) |
| Retrieves incoming data from the TINE server engine. | |
| afx_msg short | EqpRegisterModule (LPCTSTR devName, short devNumber) |
| Device name registration call. | |
| afx_msg short | EqpRegisterProperty (LPCTSTR property, short size, short fmt, short access, LPCTSTR dsc) |
| Simple property registration call. | |
| afx_msg short | EqpRegisterPropertyEx (LPCTSTR devProperty, long inMaxArrayLength, short inFormat, LPCTSTR inStructureTag, long outMaxArrayLength, short outFormat, LPCTSTR outStructureTag, short access, LPCTSTR description) |
| Extended property registration call. | |
| afx_msg void | EqpRemoveAlarm (short devNumber, long almCode) |
| Removes the specified alarm if present in the local alarm list. | |
| afx_msg void | EqpRemoveDeviceAlarm (LPCTSTR devName, long almCode) |
| Removes the specified alarm if present in the local alarm list. | |
| afx_msg short | EqpSend (long data) |
| Submits outgoing data to the TINE server engine. | |
| afx_msg short | EqpSendData (const VARIANT FAR &data) |
| Submits outgoing data to the TINE server engine. | |
| afx_msg short | EqpSendDataEx (const VARIANT FAR &data, const VARIANT FAR &size) |
| Submits outgoing data to the TINE server engine. | |
| afx_msg short | EqpSetAlarm (short devNumber, long almCode, long almData, short almFlags) |
| Sets an alarm with the given alarm code, alarm data, and alarm flags associated with the device number given. | |
| afx_msg void | EqpSetCompletion (short CompCode, LPCTSTR CompString) |
| Set the completion code for the currently active call and advances the tail pointer in the local event queue. | |
| afx_msg short | EqpSetDeviceAlarm (LPCTSTR devName, long almCode, long almData, short almFlags) |
| Sets an alarm with the given alarm code, alarm data, and alarm flags associated with the device name given. | |
| void | FireCycleTrigger (long CycleNumber, short CycleStatus) |
| is the Cycle Number Trigger handler routine (ActiveX event) which processes occurs following the receipt of a new cycle number. | |
| void | FireEqpFcn (LPCTSTR devName, LPCTSTR devProperty, long outArrayLen, long inArrayLen, short devAccess) |
| is the Equipment Function handler routine (ActiveX event) which processes all command and requests for data. Inside Visual Basic, the name of the event will pre-pend the module's name, producing event routines such as Srv1_EqpFcn(), etc. | |
| afx_msg short | GetCallerInformation (const VARIANT FAR &ClientName, const VARIANT FAR &ClientAddress) |
| retrieves the identity of the caller accessing the property in question | |
| afx_msg double | GetDataTimeStamp () |
| Returns the current system time as a TINE data time stamp. | |
| afx_msg void | SetDataTimeStamp (double dataTime) |
| Sets the data time stamp according to the value given. | |
| afx_msg short | TriggerOnCycle (short enabled, LPCTSTR PropertyList) |
| If enable = TRUE, instructs the Server Control to Schedule those properties provided in the list following the receipt of a Cycle Number Trigger event. If enable = FALSE, disables cycle triggering. | |
Protected Attributes | |
| BOOL | m_enabled |
| Enables the Server ActiveX control when set to TRUE. This action begins server intialization. | |
| CString | m_eqpName |
| Sets the "local" Equipment Module Name for this ActiveX control. | |
| short | m_eqpNumberModules |
| Sets the size of the module device table bound to the server. | |
| CString | m_exportName |
| Sets the "exported" device server name bound to the Equipment Module. | |
The Methods, Events, and Properties documented here are refer to the TINE Server ActiveX control 'Srv.ocx'. Although the ActiveX control is language neutral, and can therefore be used in any container which supports ActiveX (such as Visual C++, LabView, HPVee, etc.) it is optimized for ease-of-use with Visual Basic.
| short _ScheduleProperty | ( | LPCTSTR | PropertyList | ) | [protected] |
Schedules all contracts attached the any of the properties in the PropertyList for immediate delivery.
Visual Basic:
ScheduleProperty(PropertyList As String ) As Integer
Under some circumstances, a server might want to reduce the latency between local data acquistion and delivery to clients interested in the data. By calling 'ScheduleProperty() you can ensure that all contracts involving the properties supplied in the argument list will be called immediately and the results sent immediately to all clients in the associated client lists.
| PropertyList | is a single string containing a comma separated list of properties which are to be 'scheduled' for immediate access. |
' Subroutine to acquire data Sub ReadBeamCurrent() ' read the data from the hardware ' ... ' Visual Basic 3.0 must ust the DLL function ' ScheduleProperty Srv1.EqpName, "CURRENT" 'ActiveX control provides a method: Srv1.ScheduleProperty "CURRENT" ' ... End Sub
References m_eqpName.
| void EqpClearAlarm | ( | short | devNumber | ) | [protected] |
Clears all alarms associated with the device number given.
Visual Basic:
EqpClearAlarm( devNumber As Integer)
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. Note that in Win32, this is a method of the Server ActiveX control, and consequently the "eqm" argument used in the Win16 VBX is not necessary
| devNumber | is the device number for which associated alarms are to be cleared. |
Dim i As Integer ' ... ' first clear alarms and see who comes back: For i = 0 To 9 Call Srv1.EqpClearAlarm(i) Next ' ...
References m_eqpName.
| void EqpClearDeviceAlarm | ( | LPCTSTR | devName | ) | [protected] |
Clears all alarms associated with the device name given.
Visual Basic:
EqpClearDeviceAlarm( devName As String)
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. Note that in Win32, this is a method of the Server ActiveX control, and consequently the "eqm" argument used in the Win16 VBX is not necessary
| devName | is the device name for which associated alarms are to be cleared. |
Dim i As Integer ' ... ' first clear alarms and see who comes back: Srv1.EqpClearDeviceAlarm ("DEVICE1") ' ...
References m_eqpName.
| BSTR EqpGetModuleName | ( | short | DevNumber | ) | [protected] |
retrieves the device name assigned to the device number passed
Visual Basic:
EqpGetModuleName(DevNumber As Integer ) As String
A server can register module names (i.e. device names) at initialization time, thereby assigning a number to a device name. As the number will actually be the index into the local device name table held by the TINE engine, it will always be between 0 and the number of device modules. It is stored as a hash table, so that lookups are fast as possible. In this simple version of the call, it is assumed that all registered properties share the same device list. Under some circumstance the server might wish to query what name was assigned to what number during initialization. For instance, device names can also be assigned via the startup configuration file <equipment name>-devices.csv, in which case the running server does not have device name hard coded and has no apriori knowledge as to what name has been matched to what number.
| DevNumber | is the device number for which the assigned device name is to be returned |
Dim DeviceName As String ' ... DeviceName = Srv1.GetModuleName(1) ' ...
References m_eqpName.
| short EqpGetModuleNumber | ( | LPCTSTR | DevName | ) | [protected] |
retrieves the device number assigned to the device name passed
Visual Basic:
EqpGetModuleNumber(DevName As String ) As Integer
A server can register module names (i.e. device names) at initialization time, thereby assigning a number to a device name. As the number will actually be the index into the local device name table held by the TINE engine, it will always be between 0 and the number of device modules. It is stored as a hash table, so that lookups are fast as possible. In this simple version of the call, it is assumed that all registered properties share the same device list.
| DevName | is the device name for which the assigned module number (i.e. device number) is to be returned |
Private Sub Srv1_EqpFcn(ByVal devName As String, ByVal devProperty As String, ByVal outArrayLen As Long, ByVal inArrayLen As Long, ByVal devAccess As Integer) Dim clnName As String * 16 Dim clnAddr As String * 16 Dim devNr As Integer, cc As Integer ' ... devNr = Srv1.EqpGetModuleNumber(devName) cc = Srv1.GetCallerInformation(clnName, clnAddr) ' ...
References m_eqpName.
| short EqpGetModuleNumberEx | ( | LPCTSTR | DevName, | |
| const VARIANT FAR & | DevProperty | |||
| ) | [protected] |
retrieves the device number assigned to the device name and device property passed
Visual Basic:
EqpGetModuleNumberEx(DevName As String [, DevProperty As String] ) As Integer
A server can register module names (i.e. device names) at initialization time, thereby assigning a number to a device name. Under some circumstances, some registered properties will have a different property list than others. When this is the case for specific property, it requires a registered 'meta' property to be handled by the server with the same name as the property but appended with ".NAM". The TINE engine will then make a one time query at initialization time of this property-specific device list and use it to ascertain name to number cross-references.
| DevName | is the device name for which the assigned module number (i.e. device number) is to be returned. | |
| DevProperty | [optional] is the device property for which the assigned device number is to be returned. If DevProperty is omitted, the call reverts to the behavior of EqpGetModuleNumber(). |
Private Sub Srv1_EqpFcn(ByVal devName As String, ByVal devProperty As String, ByVal outArrayLen As Long, ByVal inArrayLen As Long, ByVal devAccess As Integer) Dim clnName As String * 16 Dim clnAddr As String * 16 Dim devNr As Integer, cc As Integer ' ... devNr = Srv1.EqpGetModuleNumberEx(devName, devProperty) cc = Srv1.GetCallerInformation(clnName, clnAddr) ' ...
References m_eqpName.
| short EqpRecv | ( | long | data | ) | [protected] |
Retrieves incoming data from the TINE server engine.
Visual Basic:
EqpRecv( data As Long) As Integer
When data are sent to the server, the inArrayLen parameter will be greater than '0' and the server must retrieve the data sent by the caller inside the EqpFcn event routine. It is assumed that the data to be retrieved for the property in question have the format specified in the call to the RegisterProperty() or RegisterPropertyEx() methods. EqpRecv should be passed the address of the Visual Basic variable containing the data to be returned. This generally requires the helper function CADDR() which returns a pointer address cast as a long. CADDR() in term requires the first element.
| data | is the pointer to the data object to be submitted |
Dim mode As Integer ' ... Case "MODE" If inArrayLen > 0 Then Srv1.EqpRecv CADDR(mode) End If ' ...
| short EqpRecvData | ( | const VARIANT FAR & | data | ) | [protected] |
Retrieves incoming data from the TINE server engine.
Visual Basic:
EqpRecvData( data As Variant) As Integer
When data are sent to the server, the inArrayLen parameter will be greater than '0' and the server must retrieve the data sent by the caller inside the EqpFcn event routine. It is assumed that the data to be retrieved for the property in question have the format specified in the call to the RegisterProperty() or RegisterPropertyEx() methods. EqpRecvData should be passed the Visual Basic variable which is to be filled with the incoming data. The variable passed must be a fundemental OLE data type (i.e. short (integer), long, float (single), double, byte, or string. If composite or user-defined types are passed, then the first element of the user-type should be passed.
| data | is the data object to be filled with the incoming data. |
Dim mode As Integer ' ... Case "MODE" If inArrayLen > 0 Then Srv1.EqpRecvData mode End If ' ...
| short EqpRegisterModule | ( | LPCTSTR | devName, | |
| short | devNumber | |||
| ) | [protected] |
Device name registration call.
Visual Basic:
EqpRegisterModule(devName As String, devNumber As Integer) As Integer
Servers can also register their device names through a startup file. If used, the startup file is specified by the 6-char local (internal) equipment module name concatenated with "-device.csv" (e.g. "eqm1-devices.csv"). In cases where this is not practical, a call to RegisterModuleName() can be made. RegisterModuleName() can be called at any time after the enabled property of the Server ActiveX control has be set to TRUE. Note that in Win32, this is a method of the ActiveX control, and consequently the 'eqm' argument used in the Win16 VBX is not necessary.
| devName | is the device name to be assigned to the device number passed | |
| devNumber | is sthe device number whose name is being assigned. |
With Visual Basic 3.0 VBX controls there are no methods. Therefore this functionality is not present in the TINE server-side WINSRV.VBX. Instead you will have to call this function directly from the tinesv16.dll, passing an extra argument containing the local EqpName.
Dim rc As Integer ' ... rc = Srv1.EqpRegisterModule("WR197", 0) if rc then RPCERROR(rc) ' ...
References m_eqpName.
| short EqpRegisterProperty | ( | LPCTSTR | property, | |
| short | size, | |||
| short | fmt, | |||
| short | access, | |||
| LPCTSTR | dsc | |||
| ) | [protected] |
Simple property registration call.
Visual Basic:
EqpRegisterProperty(property As String, size As Integer, fmt As Integer, access As Integer, dsc As String) As Integer
Servers must register their properties by calling either RegisterProperty() or RegisterPropertyEx(). RegisterProperty() should be called after the enabled property of the Server ActiveX control has been set to TRUE. Note that the format parameter 'fmt' in RegisterProperty() defines the native format for both input and output data sets. Incoming data which reaches the EqpFcn event is guaranteed have the format specified. Note also that the maximum array size parameter 'siz' is used for both input and output data sets. If it is necessary to differentiate between input and output data sets regarding either native format or array size, then RegisterPropertyEx() should be used. Note that in Win32, this is a method of the Server ActiveX control, and consequently the 'eqm' argument used in the Win16 VBX is not necessary.
| property | is the property name to be registered | |
| size | is the maximum array size supported by this property | |
| fmt | is the native format supported by this property | |
| access | is the device access indicater (CA_READ or CA_WRITE or both) | |
| dsc | is the property description. Note that the maximum and minimum values of the property along with its engineering units and preferred graph type can be submitted with this parameter if this information is containing within brackets '[]'. This meta information will be parsed out of the description. |
Dim id As Integer ' ... id = Srv1.RegisterProperty ("SINE",1024,CF_FLOAT,CA_READ,"[0:1000 sec]Sine Curve") if id < 0 then RPCERROR(-id) ' ...
References m_eqpName.
| short EqpRegisterPropertyEx | ( | LPCTSTR | devProperty, | |
| long | inMaxArrayLength, | |||
| short | inFormat, | |||
| LPCTSTR | inStructureTag, | |||
| long | outMaxArrayLength, | |||
| short | outFormat, | |||
| LPCTSTR | outStructureTag, | |||
| short | access, | |||
| LPCTSTR | description | |||
| ) | [protected] |
Extended property registration call.
Visual Basic:
EqpRegisterPropertyEx(devProperty As String, inMaxArrayLength As Long, inFormat As Integer, inStructureTag As String, outMaxArrayLength As Long, outFormat As Integer, outStructureTag As String, access As Integer, description As String) As Integer
Servers must register their properties by calling either RegisterProperty() or RegisterPropertyEx(). RegisterPropertyEx() should be called after the enabled property of the Server ActiveX control has been set to TRUE. RegisterPropertyEx() differs from RegisterProperty() in that the input and output data sets are treated separately. Also structure tag registration is only possible through this call. Note that in Win32, this is a method of the Server ActiveX control, and consequently the 'eqm' argument used in the Win16 VBX is not necessary.
| devProperty | is the property name to be registered | |
| inMaxArrayLength | is the maximum array size for incoming data supported by this property | |
| inFormat | is the native format for incoming data supported by this property | |
| inStructureTag | (if not empty) is a structure 'tag' to be applied to associated with the incoming data in case the inFormat is of type CF_STRUCT (i.e. a user-defined structure). | |
| outMaxArrayLength | is the maximum array size for outgoing data supported by this property | |
| outFormat | is the native format for outgoing data supported by this property | |
| outStructureTag | (if not empty) is a structure 'tag' to be applied to associated with the outgoing data in case the outFormat is of type CF_STRUCT (i.e. a user-defined structure). | |
| access | is the device access indicater (CA_READ or CA_WRITE or both) | |
| description | is the property description. Note that the maximum and minimum values of the property along with its engineering units and preferred graph type can be submitted with this parameter if this information is containing within brackets '[]'. This meta information will be parsed out of the description. |
Dim id As Integer ' ... id = Srv1.EqpRegisterPropertyEx("SINE", 1, CF_FLOAT, "", 1024, CF_DOUBLE, "", CA_READ + CA_WRITE, "[0:1000 sec]Sine function (frequency as input)") if id < 0 then RPCERROR(-id) ' ...
References m_eqpName.
| void EqpRemoveAlarm | ( | short | devNumber, | |
| long | almCode | |||
| ) | [protected] |
Removes the specified alarm if present in the local alarm list.
Visual Basic:
EqpRemoveAlarm( devNumber As Integer, almCode As Long)
A server can remove alarms for a specific device number and alarm code by using this call. The alarm is then marked immediately as terminated and is scheduled for removal.
| devNumber | is the device number for which the alarm is to be removed | |
| almCode | is the alarm code for which the alarm is to be removed. |
References m_eqpName.
| void EqpRemoveDeviceAlarm | ( | LPCTSTR | devName, | |
| long | almCode | |||
| ) | [protected] |
Removes the specified alarm if present in the local alarm list.
Visual Basic:
EqpRemoveDeviceAlarm( devName As String, almCode As Long)
A server can remove alarms for a specific device name and alarm code by using this call. The alarm is then marked immediately as terminated and is scheduled for removal.
| devName | is the device name for which associated alarms are to be cleared. | |
| almCode | is the alarm code for which the alarm is to be removed. |
Dim i As Integer ' ... ' first clear alarms and see who comes back: Srv1.EqpClearDeviceAlarm ("DEVICE1") ' ...
References m_eqpName.
| short EqpSend | ( | long | data | ) | [protected] |
Submits outgoing data to the TINE server engine.
Visual Basic:
EqpSend( data As Long) As Integer
A server must specify the data it wishes to send to the caller inside the EqpFcn event routine. It is assumed that the data to be returned for the property in question have the format specified in the call to the RegisterProperty() or RegisterPropertyEx() methods. EqpSend should be passed the address of the Visual Basic variable containing the data to be returned. This generally requires the helper function CADDR() which returns a pointer address cast as a long. CADDR() in term requires the first element.
| data | is the pointer to the data object to be submitted |
Dim V(99) As Single
Dim i As Integer
' ...
Case "VALUES"
If outArrayLen > 0 Then
For i = 0 to 99: debug.print "sending " & V(i) & vbNewLine: Next
Srv1.EqpSend CADDR(V(0))
Srv1.SetCompletion 0, ""
Else
' ...
| short EqpSendData | ( | const VARIANT FAR & | data | ) | [protected] |
Submits outgoing data to the TINE server engine.
Visual Basic:
EqpSendData( data As Variant) As Integer
A server must specify the data it wishes to send to the caller inside the EqpFcn event routine. It is assumed that the data to be returned for the property in question have the format specified in the call to the RegisterProperty() or RegisterPropertyEx() methods. EqpSendData should be passed the Visual Basic variable containing the data to be returned. The variable passed must be a fundemental OLE data type (i.e. short (integer), long, float (single), double, byte, or string. If composite or user-defined types are passed, then the first element of the user-type should be passed.
| data | is the data object to be submitted. |
Dim V(99) As Single
Dim i As Integer
' ...
Case "VALUES"
If outArrayLen > 0 Then
For i = 0 to 99: debug.print "sending " & V(i) & vbNewLine: Next
Srv1.EqpSendData V
Srv1.SetCompletion 0, ""
Else
' ...
| short EqpSendDataEx | ( | const VARIANT FAR & | data, | |
| const VARIANT FAR & | size | |||
| ) | [protected] |
Submits outgoing data to the TINE server engine.
Visual Basic:
EqpSendDataEx( data As Variant [, size As Long] ) As Integer
A server must specify the data it wishes to send to the caller inside the EqpFcn event routine. It is assumed that the data to be returned for the property in question have the format specified in the call to the RegisterProperty() or RegisterPropertyEx() methods. EqpSendDataEx should be passed the Visual Basic variable containing the data to be returned. The variable passed must be a fundemental OLE data type (i.e. short (integer), long, float (single), double, byte, or string. If composite or user-defined types are passed, then the first element of the user-type should be passed. Using this call, you can truncate the amount of data being returned by specifying the size parameter to be less than the outArrayLen demanded by the client.
| data | is the data object to be submitted. | |
| size | [optional] is the size of the data object to be returned. If not supplied, then the value of 'outArrayLen' is assumed |
Dim scrnshot(MAX_IMAGE_SIZE) As Byte
Dim i As Integer
Dim scrnsiz As Long
' ...
Case "IMAGE"
If outArrayLen > 0 Then
scrnsiz = getCurrentImageSize()
Srv1.EqpSendDataEx V, scrnsiz
Srv1.SetCompletion 0, ""
Else
' ...
| short EqpSetAlarm | ( | short | devNumber, | |
| long | almCode, | |||
| long | almData, | |||
| short | almFlags | |||
| ) | [protected] |
Sets an alarm with the given alarm code, alarm data, and alarm flags associated with the device number given.
Visual Basic:
EqpSetAlarm( devNumber As Integer, almCode As Long, almData As Long, almFlags As Long)
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. Note that in Win32, this is a method of the Server ActiveX control, and consequently the "eqm" argument used in the Win16 VBX is not necessary
| devNumber | is the device number for which the alarm is to be set | |
| almCode | is the alarm code identifying the alarm which is being set | |
| almData | is a pointer which if non-NULL points to the optional 6-byte set of alarm data associated with the alarm which has been set. As the address is passed, you must make use of the CADDR() routine to get the address of a Visual Basic array. | |
| almFlags | is a bit pattern containing the alarm flags (such as almINSTANT, etc) to be applied to the alarm being set. (See discussion on the Local Alarm Server.) Under most circumstances you should simply pass a ‘0’ here. |
Dim rc As Integer, nr As Integer
Dim almData(2) as Integer
' ...
If ReadHardware(nr) Then
almData(0) = hdw(nr).line
almData(1) = hdw(nr).crate
almData(2) = hdw(nr).subaddr
Srv1.EqpSetAlarm nr, sedac_error%, CADDR(almData(0)), 0
End If
' ...
References m_eqpName.
| void EqpSetCompletion | ( | short | CompCode, | |
| LPCTSTR | CompString | |||
| ) | [protected] |
Set the completion code for the currently active call and advances the tail pointer in the local event queue.
Visual Basic:
EqpSetCompletion( CompCode As Integer, CompString As String)
A server must set the completion code for every call into its equipment module handler routine. Failing to do so will result in client calls failing with 'command not posted' as the return message. The completion code can be set to any of the system standard error codes or to a user-define error code beginning at 512. A server can also return a 32-character error status string to accompany a user-defined error. To do so, you should use this method. Note that supplying an error string to a TINE-system error code will have no effect, as the system error string will always be used in this case.
| CompCode | is the completion code to be applied to the call | |
| CompString | is the string description of the completion to accompany the integer value. |
With Visual Basic 3.0 VBX controls there are no methods. Therefore this functionality is not present in the TINE server-side WINSRV.VBX. Instead you will have to call this function directly from the tinesv16.dll, passing an extra argument containing the local EqpName. Or you can use the EqpStatus As Integer property to set the completion code, and use the ErrorString As String property to set an accompanying completion error string.
' ... Srv1.EqpSetCompletion 512, "This is a test error" Exit Sub ' ...
References m_eqpName.
| short EqpSetDeviceAlarm | ( | LPCTSTR | devName, | |
| long | almCode, | |||
| long | almData, | |||
| short | almFlags | |||
| ) | [protected] |
Sets an alarm with the given alarm code, alarm data, and alarm flags associated with the device name given.
Visual Basic:
EqpSetDeviceAlarm( devName As String, almCode As Long, almData As Long, almFlags As Long)
A server can set an alarm for a specific device by giving its device name. For further information, please see the discussion of the local alarm server. Note that in Win32, this is a method of the Server ActiveX control, and consequently the "eqm" argument used in the Win16 VBX is not necessary
| devName | is the device name for which the alarm is to be set | |
| almCode | is the alarm code identifying the alarm which is being set | |
| almData | is a pointer which if non-NULL points to the optional 6-byte set of alarm data associated with the alarm which has been set. As the address is passed, you must make use of the CADDR() routine to get the address of a Visual Basic array. | |
| almFlags | is a bit pattern containing the alarm flags (such as almINSTANT, etc) to be applied to the alarm being set. (See discussion on the Local Alarm Server.) Under most circumstances you should simply pass a ‘0’ here. |
Dim rc As Integer, nr As Integer ' ... Srv1.EqpSetDeviceAlarm "DEVICE1", hardware_error%, 0, 0 ' ...
References m_eqpName.
| void FireCycleTrigger | ( | long | CycleNumber, | |
| short | CycleStatus | |||
| ) | [inline, protected] |
is the Cycle Number Trigger handler routine (ActiveX event) which processes occurs following the receipt of a new cycle number.
Visual Basic:
_CycleTrigger(CycleNumber As Long, CycleStatus As Long)
In order to receive these event, the m_triggerOnCycle must be set to TRUE and a CYCLER must must exist for the CONTEXT in which the server is registered.
Example:
Private Sub initServer() Srv1.EqpName = "SINEQM" Srv1.ExportName = "VbSineServer" Srv1.EqpNumberModules = NUM_DEVICES ' enable the server Srv1.Enabled = True If Srv1.EqpStatus = 0 Then Label1.Caption = "Sine Generator Server is running" Label1.BackColor = vbGreen Else Label1.Caption = "Sine Generator Server not is running : " + RPCERROR(Srv1.EqpStatus) Label1.BackColor = vbRed End If ' now register the properties and devices ... cc = Srv1.EqpRegisterPropertyEx("Sine", 0, CF_NULL, "", NUM_VALUES, CF_FLOAT, "", CA_READ, "[-1000:1000 V][0:1000 ms]Sine Curve") ' other property and device registration omitted ... ' register a cycle trigger function and instruct the system to schedule property "Sine" following the event dispatch ... ' note: The 'PropertyList' parameter is not optional, but you can use an empty string "" if no property scheduling is desired ... Srv1.TriggerOnCycle True, "Sine" End Sub Private Sub Srv1_CycleTrigger(ByVal CycleNumber As Long, ByVal CycleStatus As Integer) ' do something useful in the dispatch routine (hardware io ?) Form1.Label1.Caption = "Cycle number " + STR(CycleNumber) + " <" + STR(CycleStatus) + ">" End Sub
| void FireEqpFcn | ( | LPCTSTR | devName, | |
| LPCTSTR | devProperty, | |||
| long | outArrayLen, | |||
| long | inArrayLen, | |||
| short | devAccess | |||
| ) | [inline, protected] |
is the Equipment Function handler routine (ActiveX event) which processes all command and requests for data. Inside Visual Basic, the name of the event will pre-pend the module's name, producing event routines such as Srv1_EqpFcn(), etc.
Visual Basic:
_EqpFcn(DevName As String, DevProperty As String, outArrayLen As Long, inArrayLen As Long, devAccess As Integer)
This corresponds to the Equipment Module handler routine (See the discussion on Equipment Modules). This routine handles all client user requests (either directly or indirectly). Note that when N different clients establish a data link for the same data request, only one event is generated (at the designated polling rate).
| devName | is a pointer to the 16-character device name requested by the caller. In many cases, equipment modules make use of device number rather than (or in addition to) device names. In such cases, a legitimate device "name" might be "#37" for example. | |
| devProperty | is a pointer to the 32-character device property requested by the caller. In order for the device property to be passed in this routine, it must be exported. A request from a caller for a property which has not been exported will automatically receive an "illegal_property" return code. | |
| outArrayLen | is the array length of the requested output data set. This is generally the number of elements in units of the native format specified in the call to the EqpRegisterProperty() or EqpRegisterPropertyEx() methods. Note that for format type CF_STRUCT (i.e. a user-defined structure), if the structure is un-tagged, then the value of outArrayLen& gives the total number of bytes. Likewise, for format CF_TEXT, it gives the string length. | |
| inArrayLen | is the array length of the incoming input data set. This is generally the number of elements in units of the native format specified in the call to the EqpRegisterProperty() or EqpRegisterPropertyEx() methods. (See above remarks for outArrayLen&). The incoming data set is guaranteed to have the format given in the property registration. | |
| devAccess | is the access code for the request (see the discussion on Data Access Codes). A server can check this value against CA_WRITE for instance to see if a write request is being made. The bits CA_FIRST and CA_LAST are also of some interest to determine if a data link is coming into or going out of scope. |
Private Sub SrvBpmeqm_EqpFcn(ByVal devName As String, ByVal devProperty As String, ByVal outArrayLen As Long, ByVal inArrayLen As Long, ByVal devAccess As Integer) Dim i As Integer Dim devNr As Integer ' If you're properties make use of the device number associated with the device name: devNr = SrvBpmeqm .EqpGetModuleNumber(devName) If devNr < 0 Then SrvBpmeqm.EqpSetCompletion illegal_equipment_number, "" Exit Sub End If ' check which property was asked for: Select Case devProperty Case "STATUS" If (devAccess And CA_WRITE) Then SrvBpmeqm.EqpSetCompletion illegal_read_write, "" Exit Sub End If If outArrayLen > 0 Then SrvBpmeqm.EqpSendData prpStatusBuffer End If Case "POSITION.Y" If (devAccess And CA_WRITE) Then SrvBpmeqm.EqpSetCompletion illegal_read_write, "" Exit Sub End If If outArrayLen > 0 Then SrvBpmeqm.EqpSendData prpPosition_yBuffer End If Case "POSITION.X" If (devAccess And CA_WRITE) Then SrvBpmeqm.EqpSetCompletion illegal_read_write, "" Exit Sub End If If outArrayLen > 0 Then SrvBpmeqm.EqpSendData prpPosition_xBuffer End If Case Else SrvBpmeqm.EqpSetCompletion illegal_property, "" End Select ' If it's made it this far, it's a success: SrvBpmeqm .EqpSetCompletion 0, "" End Sub
| short GetCallerInformation | ( | const VARIANT FAR & | ClientName, | |
| const VARIANT FAR & | ClientAddress | |||
| ) | [protected] |
retrieves the identity of the caller accessing the property in question
Visual Basic:
GetCallerInformation( [ClientName As String], [ ClientAddress As String] ) As Integer
A server can retrieve the caller name and address at the time the EqpFcn() equipment function event service routine is fired. The information returned corresponds to the first caller in the list of callers interested in the given contract. For single commands and reads, this is typically a list of one caller.
| ClientName | [optional] is the string variable into which the caller's client name is to be written | |
| ClientAddress | [optional] is the string variable into which the caller's network address is to be written |
Private Sub Srv1_EqpFcn(ByVal devName As String, ByVal devProperty As String, ByVal outArrayLen As Long, ByVal inArrayLen As Long, ByVal devAccess As Integer)
Dim clnName As String * 16
Dim clnAddr As String * 16
Dim devNr As Integer, cc As Integer
devNr = Srv1.EqpGetModuleNumber(devName)
cc = \b Srv1.GetCallerInformation(clnName, clnAddr)
' ...
References m_eqpName.
| double GetDataTimeStamp | ( | ) | [protected] |
Returns the current system time as a TINE data time stamp.
Visual Basic:
GetDataTimeStamp() As Double
A server can apply its own timestamp to a data request, for instance to indicate when the data were actually read out. A valid data time stamp can be obtained by calling GetDataTimeStamp().
| void SetDataTimeStamp | ( | double | dataTime | ) | [protected] |
Sets the data time stamp according to the value given.
Visual Basic:
SetDataTimeStamp(dataTime As Double )
A server can apply its own timestamp to a data request, for instance to indicate when the data were actually read out. If used, this method should be called prior to submitting the data via a call to one of the EqpSendData() methods. If not used, then the data time stamp will be the current time read from the system clock.
| dataTime | is the data timestamp to be assigned to the returned data. A valid data time stamp can be obtained by calling GetDataTimeStamp(). |
Data time stamp values under 1000 are ignored by the TINE engine.
| short TriggerOnCycle | ( | short | enabled, | |
| LPCTSTR | PropertyList | |||
| ) | [protected] |
If enable = TRUE, instructs the Server Control to Schedule those properties provided in the list following the receipt of a Cycle Number Trigger event. If enable = FALSE, disables cycle triggering.
Visual Basic:
TriggerOnCycle( enable As Boolen,PropertyList As String)
The Cycle Event will first be fired (in order to allow potentional data acquisition) and then those properties in the property list will be scheduled
| PropertyList | is the property or properties which are to be 'scheduled' following the execution of the dispatch routine. If more than a single property is to be scheduled, this should be a string containing a comma separated list. |
References m_eqpName.
BOOL m_enabled [protected] |
Enables the Server ActiveX control when set to TRUE. This action begins server intialization.
Visual Basic:
enabled
BOOL m_eqpName [protected] |
Sets the "local" Equipment Module Name for this ActiveX control.
Visual Basic:
EqpName As String
This is the process-specific name used by the TINE server engine to distinguish this device server from others bound to the same process. This name need only be unique within the application.
This property must be set prior to enabling the ActiveX control otherwise the server's information will not be correctly exported.
Referenced by _ScheduleProperty(), EqpClearAlarm(), EqpClearDeviceAlarm(), EqpGetModuleName(), EqpGetModuleNumber(), EqpGetModuleNumberEx(), EqpRegisterModule(), EqpRegisterProperty(), EqpRegisterPropertyEx(), EqpRemoveAlarm(), EqpRemoveDeviceAlarm(), EqpSetAlarm(), EqpSetCompletion(), EqpSetDeviceAlarm(), GetCallerInformation(), and TriggerOnCycle().
BOOL m_eqpNumberModules [protected] |
Sets the size of the module device table bound to the server.
Visual Basic:
EqpNumberModules As Integer
BOOL m_exportName [protected] |
Sets the "exported" device server name bound to the Equipment Module.
Visual Basic:
ExportName As String
This is the system-wide name used by all clients to address your server. This name therefore need to be unique system-wide. Note however that two different server can export the same device server name if they are registered on different contexts (see FEC registration). It is none the less a good idea to try to keep the export name unique even across diffent contexts in order to avoid confusion. Although the context is a part of the name space, clients may omit it, in which case the address resolution for a given device server name will return the first "match".
This property must be set prior to enabling the ActiveX control otherwise the server's information will not be correctly exported.
1.5.8