Functions | |
| short | AttachServer (char *srvExportName, char *srvEQPName, int ndevices) |
| Attaches the TINE server DLL according to the input given. | |
| short | RegisterDeviceName (char *devName, short devNumber) |
| Device name registration call. | |
| short | RegisterBufferedProperty (char *prpName, long prpInSiz, short prpInFmt, long prpOutSiz, short prpOutFmt, float prpMax, float prpMin, char *prpEgu, short access, char *prpDsc) |
| Buffered Property registration call. | |
| short | pushBufferedData (char *prpName, char *devName, BYTE *prpData, long prpSiz, int prpSchedule) |
| Refreshes the contents of the data buffer associated with the given property. | |
| short | pullBufferedData (char *prpName, char *devName, BYTE *prpData, long prpSiz) |
| Retrieves the contents of the input data buffer associated with the given property. | |
| short | hasInputChanged (char *prpName) |
| Checks whether there are new input data for the given property. | |
| short | GetInputDeviceNumber (void) |
| Returns the device number associated with the WRITE call. | |
| short | RegisterServerCallback (char *prpName, void(*cb)(void)) |
| Registers a callback routine to be called when a WRITE access property is called. | |
| short | RegisterServerNotifier (char *prpName, void(*nf)(int)) |
| Registers a Notifier routine to be called when a WRITE access property is called. | |
| short AttachServer | ( | char * | srvExportName, | |
| char * | srvEQPName, | |||
| int | ndevices | |||
| ) |
Attaches the TINE server DLL according to the input given.
Visual Basic :
Declare Function AttachServer Lib "TBufferedSrv.dll" (ByVal srvExportName As String,ByVal srvEQPName As String,ByVal ndevices As Long) As Integer
| srvExportName | is the desired export name. If this is omitted (i.e. a zero-length string is passed, then the export name must be obtained from an associated 'exports.csv' in the local FEC database repository. | |
| srvEQPName | is the desired local equipment module name. If this is omitted (i.e. a zero-length string is passed, then the local equipment module name is extracted from an associated 'exports.csv' in the local FEC database repository. | |
| ndevices | is the number of devices (instances) associated with this device server. If this is omitted (i.e. 0 is passed), then the number of devices is extracted from an associated 'exports.csv' in the local FEC database repository. |
Private Sub init() Dim cc As Integer, ID As Integer Dim i As Integer, n As Integer Dim dn As String cc = AttachServer("BUFSINE", "", 0) i = RegisterServerCallback("MODE", AddressOf cb) Timer1.Enabled = True End Sub
Example: Attach to server and set the server's export name, local equipment module name and number of modules (does not read exports.csv file!):
Private Sub init() Dim cc As Integer, ID As Integer Dim i As Integer, n As Integer Dim dn As String cc = AttachServer("BUFSINE", "BUFEQM", 100) i = RegisterServerCallback("MODE", AddressOf cb) Timer1.Enabled = True End Sub
| short GetInputDeviceNumber | ( | void | ) |
Returns the device number associated with the WRITE call.
Visual Basic:
Declare Function GetInputDeviceNumber Lib "TBufferedSrv.dll" () As Integer
This call can be made inside the server's callback routine along with 'hasInputChanged' in order to ascertain which device was 'set'.
Sub cb() Form1.Label1.Caption = "callback was called" If hasInputChanged("MODE") Then pullBufferedData "MODE", "#0", sineMode, 1 pushBufferedData "MODE", "#0", sineMode, 1, 0 End If End Sub
| short hasInputChanged | ( | char * | prpName | ) |
Checks whether there are new input data for the given property.
Visual Basic:
Declare Function hasInputChanged Lib "TBufferedSrv.dll" (ByVal prpName As String) As Integer
| prpName | is the property name whose input data buffer is to be checked for changes. |
Sub cb() Form1.Label1.Caption = "callback was called" If hasInputChanged("MODE") Then pullBufferedData "MODE", "#0", sineMode, 1 pushBufferedData "MODE", "#0", sineMode, 1, 0 End If End Sub
| short pullBufferedData | ( | char * | prpName, | |
| char * | devName, | |||
| BYTE * | prpData, | |||
| long | prpSiz | |||
| ) |
Retrieves the contents of the input data buffer associated with the given property.
Visual Basic:
Declare Function pushBufferedData Lib "TBufferedSrv.dll" _
(ByVal prpName As String, ByVal devName As String, prpData As Any, ByVal prpSiz As Long) As Integer
| prpName | is the property name from whose input buffer the associated data are to be read. | |
| devName | is the device name giving the starting address i.e. entry point into the property's buffer from which the associated data are to be read. | |
| prpData | is a reference to the data buffer into which the incoming data should be read (pulled). | |
| prpSiz | is the number of elements to be read into the property's data buffer. |
Sub cb() Form1.Label1.Caption = "callback was called" If hasInputChanged("MODE") Then pullBufferedData "MODE", "#0", sineMode, 1 pushBufferedData "MODE", "#0", sineMode, 1, 0 End If End Sub
| short pushBufferedData | ( | char * | prpName, | |
| char * | devName, | |||
| BYTE * | prpData, | |||
| long | prpSiz, | |||
| int | prpSchedule | |||
| ) |
Refreshes the contents of the data buffer associated with the given property.
Visual Basic:
Declare Function pushBufferedData Lib "TBufferedSrv.dll" _
(ByVal prpName As String, ByVal devName As String, _
prpData As Any, ByVal prpSiz As Long, ByVal prpSchedule As Integer) As Integer
| prpName | is the property name into whose buffer the associated data are to be written | |
| devName | is the device name giving the starting address i.e. entry point into the property's buffer into which the associated data are to be written | |
| prpData | is a reference to the data to be written (pushed) into the property's data buffer. | |
| prpSiz | is the number of elements to be written into the property's data buffer. | |
| prpSchedule | is the schedule 'flag' determining whether the property is to be scheduled immediately ('true') or not. |
Private Sub Timer1_Timer()
Dim i As Integer
Dim S(99) As Single
Static delta As Single
For i = 0 To 99
S(i) = 500 + 300 * Sin((sineMode * delta + i * 6.2832) / 50) + 20 * Rnd
Next
pushBufferedData "SINE", "#0", S(0), 100, 0
delta = delta + 5
End Sub
| short RegisterBufferedProperty | ( | char * | prpName, | |
| long | prpInSiz, | |||
| short | prpInFmt, | |||
| long | prpOutSiz, | |||
| short | prpOutFmt, | |||
| float | prpMax, | |||
| float | prpMin, | |||
| char * | prpEgu, | |||
| short | access, | |||
| char * | prpDsc | |||
| ) |
Buffered Property registration call.
Visual Basic:
Declare Function RegisterBufferedProperty Lib "TBufferedSrv.dll" _
(ByVal prpName As String, ByVal prpInSiz As Long, ByVal prpInFmt As Integer _
ByVal prpOutSiz As Long, ByVal prpOutFmt As Integer, ByVal prpMax As Single, _
ByVal prpMin As Single, ByVal prpEgu As String, ByVal access As Integer, _
ByVal prpDesc As String) As Integer
Servers can also register their 'buffered' properties through the 'exports.csv' file. If the FEC Name can be unambiguously determined at startup time (e.g. there's only one entry in the fecid.csv, or the RegisterFecName() API call is used) then a startup file with the name '<FECNAME>-exports.csv' is first accessed for registration information, where '<FECNAME>' refers the the registered FEC name. If this file does not exist then 'exports.csv' is accessed. In cases where it is not practical to register property names in this manner, a call to RegisterBufferedProperty() can be made. RegisterBufferedProperty() can be called at any time after the AttachServer() has been called.
| prpName | is the property name to be exported and buffered | |
| prpInSiz | is the number of elements to be associated with the property when input data is sent to the server. | |
| prpInFmt | is the TINE data type associated with input data for this property | |
| prpOutSiz | is the number of elements to be associated with the property when output data is requested from the server. | |
| prpOutFmt | is the TINE data type associated with output data for this property | |
| prpMax | is the maximum valid value the property is allowed to contain. | |
| prpMin | is the minimum valid value the property is allowed to contain. | |
| prpEgu | is the engineering units associated with the propery | |
| access | is the bit-wise combination of TINE access codes (i.e. CA_READ and CA_WRITE) which determine the read/write access characteristics of the property. | |
| prpDesc | is a description of the property (up to 64 characters). |
Private Sub init() Dim cc As Integer, id As Integer Dim i As Integer, n As Integer Dim dn As String cc = AttachServer("BUFSINE", "BUFEQM", 100) id = RegisterBufferedProperty("SINE", 0, CF_NULL, 100, CF_FLOAT, 1000, 0, "bozos", CA_READ, "Another Sine property") id = RegisterBufferedProperty("TEST", 0, CF_NULL, 100, CF_INTEGER, 1000, 0, "vals", CA_READ, "Another Test property") id = RegisterBufferedProperty("MODE", 1, CF_INTEGER, 1, CF_INTEGER, 1, 0, "", CA_READ + CA_WRITE, "Sine Mode") For i = 0 To 99 dn = "DEVICE" + Trim$(str$(i)) id = RegisterDeviceName(dn, i) Next i = RegisterServerCallback("MODE", AddressOf cb) Timer1.Enabled = True End Sub
| short RegisterDeviceName | ( | char * | devName, | |
| short | devNumber | |||
| ) |
Device name registration call.
Visual Basic:
Declare Function RegisterDeviceName Lib "TBufferedSrv.dll" (ByVal devName As String,ByVal 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 RegisterDeviceName() can be made. RegisterDeviceName() can be called at any time after the AttachServer() has been called.
| devName | is the device name to be assigned to the device number passed | |
| devNumber | is the device number whose name is being assigned. |
Private Sub init() Dim cc As Integer, id As Integer Dim i As Integer, n As Integer Dim dn As String cc = AttachServer("BUFSINE", "BUFEQM", 100) For i = 0 To 99 dn = "DEVICE" + Trim$(str$(i)) id = RegisterDeviceName(dn, i) Next i = RegisterServerCallback("MODE", AddressOf cb) Timer1.Enabled = True End Sub
| short RegisterServerCallback | ( | char * | prpName, | |
| void(*)(void) | cb | |||
| ) |
Registers a callback routine to be called when a WRITE access property is called.
Visual Basic:
Declare Function RegisterServerCallback Lib "TBufferedSrv.dll" (ByVal prpName As String, cb As Any) As Integer
| prpName | ||
| cb |
Private Sub init() Dim cc As Integer, ID As Integer Dim i As Integer, n As Integer Dim dn As String cc = AttachServer("BUFSINE", "BUFEQM", 100) i = RegisterServerCallback("MODE", AddressOf cb) Timer1.Enabled = True End Sub
| short RegisterServerNotifier | ( | char * | prpName, | |
| void(*)(int) | nf | |||
| ) |
Registers a Notifier routine to be called when a WRITE access property is called.
Visual Basic:
Declare Function RegisterServerNotifier Lib "TBufferedSrv.dll" (ByVal prpName As String, cb As Any) As Integer
The difference between a callback and a notifier is that it is assumed that the callback completes all activity associated with the transaction while inside the callback routine. A notififier will call the notifier routine and expect the caller to call the SetBufferedCompletion() routine when the transaction is complete. This scenario is useful for development platforms such as LabView.
| prpName | the Property name for which the notifier is in effect | |
| nf | the notifier routine |
1.5.4