EPICS Data Server Introduction
It is often desirable to provide the HRIBF operators with various types of diagnostic information related to the delivery of beam to a target associated with some experiment. In the past, custom applications have supplied this information using X Windows as the delivery mechanism.
Another method now exists that can be used by an external agent to write directly into an EPICS database. The supplied information may thus be easily integrated into the control system displays according to the preferences of the operators.
Servers
Six servers are available on orib51. Each server may handle only one connection at a time so, currently, only six clients may be run at any point in time. A client connects to a server with a unique port. Available ports are 60000, 60001, 60002, 60003, 60004, and 60005.
Clients
Clients include dataServer.h and use routines contained in dslib.c to communicate with a server. The general structure of a client is given below.
Call
dsInit to connect to a server
Call dsAllocatePvs to allocate list of N EPICS PVs for write access
loop {
Obtain
N numeric diagnostic values
Encode these numeric values as a character string
call dsWriteAll to write EPICS PVs
call dsDelay to delay
}
until finished
call dsFreePvs to free the list of allocated PVs
call dsTerminate to close the connection with the server
EPICS PV Names
Legal PV names must conform to one of the following forms:
scal:acq1:cnt#
scal:acq2:cnt#
scal:acq3:cnt#
scal:rmsacq1:cnt#
scal:rmsacq2:cnt#
scal:rmsacq3:cnt#
scal:drsacq1:cnt#
scal:drsacq2:cnt#
scal:drsacq3:cnt#
# may be 0 through 9
Using any other name will result in an error.
Building Your Client
Example Make File
client
: client.o dslib.o
cc –o client –lm client.o dslib.o
client.o : client.c dataServer.h
cc –o client.o –c client.c
dslib.o : dslib.c dataServerPriv.h \
dataServer.h dataServer.version
cc –o dslib.o –c dslib.c