exampleLink implements a PVRecord that uses pvAccess to access another channel.
For more information about EPICS generally, please refer to the home page of the Experimental Physics and Industrial Control System.
mrk> pwd /home/epicsv4/master/exampleJava/exampleLink/shell mrk> ./exampleLink
A pvaClient test is available to test exampleLink. Start the exampleLink and then:
mrk> pwd /home/epicsv4/master/exampleJava/exampleLink/shell/shell mrk> ./exampleLinkClient
The process routine of a PVRecord can access other PVRecords in two ways:
If pvAccess (provider pva or ca) is used then it handles data synchronization. This is done by making a copy of the data that is transferred between the two pvRecords. This is true if either remote or local pvAccess is used. Each get, put, etc request results in data being copied between the two records.
If the linked channel is a local pvRecord then, for scalar and structure arrays, raw data is NOT copied for gets. This is because pvData uses shared_vector to hold the raw data. Instead of copying the raw data the reference count is incremented.
For puts the linked array will force a new allocation of the raw data in the linked record, i. e. copy on write semantics are enforced. This is done automatically by pvData and not by pvDatabase.
As mentioned before a pvDatabase server can be either a separate process, i. e. a main program, or can be part of a V3IOC.
A main pvDatabase server issues the following calls:
...
PVDatabase master = PVDatabaseFactory.getMaster();
ChannelProvider channelProvider = ChannelProviderLocalFactory.getChannelServer();
PvaClient pva= PvaClient.get("providerList"); // only needed if records access other records via pva or ca
ServerContextImpl context = ServerContextImpl.startPVAServer(PVAConstants.PVA_ALL_PROVIDERS,0,true,null);
...
master.addRecord(...
...
context.destroy();
...
The options supported by exampleLinkMain are shown by:
mrk> pwd /home/epicsv4/master/exampleJava/exampleLink/shell mrk> ./exampleLinkMain -help provider exampleLinkRecordName . generateLinkedRecord default pva exampleLink doubleArray true mrk>
Thus to run it with default options:
./exampleLinkMain
exampleLinkMain creates an instance of ExampleLinkRecord. The record name is exampleLinkRecordName. The ExampleLinkRecord monitors linkedRecordName using the specified provider.
After exampleLinkMain is started then in another window:
pvget -m -r "field()" exampleLink
This can be kept running while exampleLinkMain is stopped and then restarted with other options as long as exampleLinkRecordName is doubleArray.
This makes changes to the record that exampleLink monitors. It has the options:
mrk> pwd /home/epicsv4/master/exampleJava/exampleLink/shell mrk> ./exampleLinkClient -help provider default pva
NOTE: If exampleLinkMain is stated with provider ca then exampleLinkClient must also be run with provider ca
exampleLinkClient only works if linkedRecordName is doubleArray.
This can be tested via:
./exampleLinkMain local
This can be done via the default options:
./exampleLinkMain
It can also be run with pva accessing a record in another IOC:
./exampleLinkMain pva exampleLink doubleArray false
But this only starts running when the following is also started:
mrk> pwd /home/epicsv4/master/exampleJava/exampleLink/shell mrk> ./doubleArrayMain
NOTE do not leave this running for other exampleLinkMain options.
This can be tested as follows:
./exampleLinkMain ca exampleLink doubleArray false
But a softIoc for record doubleArray must also be started:
mrk> pwd /home/epicsv4/master/exampleJava/exampleLink/v3IOC mrk> softIoc st.cmd