EPICS exampleCPP

Release 4.3.0-SNAPSHOT - 2016.09.02

Abstract

This project provides a set of examples of client and server code for pvAccess. It also has a test that is run via:

make runtests

This release of exampleCPP is one of the components of EPICS V4 Release 4.6.

For more information about EPICS generally, please refer to the home page of the Experimental Physics and Industrial Control System.

Table of Contents


Overview

This project provides a set of examples of client and server code for pvAccess. Each example can be built separately by building in the example subdirectory. The complete set of examples, except for ChannelArchiverService can also be built by building in exampleCPP itself.

The main purpose of these examples is to understand and create new code for EPICS V4. This document assumes that the reader also looks at the source code for the examples. The reader should also be familiar with developerGuide

Each example is a template

Each example can be used as a template for building other applications:

Building via exampleCPP

This works if a proper RELEASE.local is present one directory level above exampleCPP.

Just type:

make

An example of a proper RELEASE.local is:

EPICS4_DIR=/home/epicsv4/release4_6
EXAMPLE=${EPICS4_DIR}/exampleCPP
PVDATABASE=${EPICS4_DIR}/pvDatabaseCPP
PVACLIENT=${EPICS4_DIR}/pvaClientCPP
PVASRV=${EPICS4_DIR}/pvaSrv
PVACCESS=${EPICS4_DIR}/pvAccessCPP
NORMATIVETYPES=${EPICS4_DIR}/normativeTypesCPP
PVDATA=${EPICS4_DIR}/pvDataCPP
PVCOMMON=${EPICS4_DIR}/pvCommonCPP

EPICS_BASE=/home/install/epics/base

Building an individual example

If a proper RELEASE.local is present one directory level above exampleCPP then in the example directory just type:

make

Each example has a README.md file. See it for how to build the example if a proper RELEASE.local does not exist or if the example has special requirements.

exampleCPP and exampleJava

Each example that appears in both exampleJava and exampleCPP are compatible, i. e. a client from one can communicate with a server from the other.

Brief summary of examples and links to documentation

database

Provides an EPICS IOC that has both EPICS V3 DBRecords, V4 PVRecords, and pvaSrv for accessing the DBRecords.

It can also create a standalone main that has a set of V4 PVRecords.

Documentation:database

exampleClient

Provides a set of examples that use pvaClientCPP.

Documentation:exampleClient

In order to run the examples, database must also be built and then the IOC database must be started as follows:

mrk> pwd
/home/epicsv4/master/exampleCPP/database/iocBoot/exampleDatabase
mrk> ../../bin/$EPICS_HOST_ARCH/exampleDatabase st.cmd

helloPutGet

Implements a PVRecord that is an example of a PVRecord intended to ba accessed via channelPutGet. It is a simple HelloWorld example.

Documentation:helloPutGet

helloRPC

This implements HelloWorld that is accessed via channelRPC.

Documentation:helloRPC

pvDatabaseRPC

An example of a pvDatabase PVRecord which also supports multiple RPC services.

It illustrates synchronous and asynchronous RPC services, selecting services based on the supplied pvRequest and using EPICS V4 to talk to an existing object which has no knowledge of EPICS and call its methods, so creating distributed objects.

It represents a device which has a 2D position setpoint and readback as well as a state. Each field has a time stamp, as does the record itself. The device can be controlled through a client using RPC commands to move through a sequence of points as well as conventionally by putting to the setpoint. Commands are: configuring the set of points, starting a scan (blocking or non-blocking), pausing and resuming, rewinding and stopping/aborting.

A client ("control") for calling the services is supplied.

Documentation:pvDatabaseRPC

exampleLink

This implements a server that has records exampleGetLink, exampleMonitorLink, and examplePutLink. Each has a link to another record (default name is doubleArray). The other record can be in the same server or in another server including a V3 IOC DBRecord.

The example records can use provider local, pva, dbPv, or ca to connect to doubleArray.

exampleLink can be stated as a main program or as part of a V3 IOC.

Documentation:exampleLink

powerSupply

This is an example of creating a PVRecord that uses a somewhat complicated top level PVStructure. It simulates a power supply.

The example also has an example pvaClient for accessing the PVRecord.

Documentation:powerSupply

arrayPerformance

This is an example that shows performance for an array of longs.

Documentation:arrayPerformance

arrayPerformanceMain implement a PVRecord that is a long array. It has a process method with code that causes the array to be updated at selectable rates and sizes.!

It also has pvaClient examples that can get, put, and monitor the long array record.

ChannelArchiverService

The ChannelArchiver Service is an EPICS V4 client and server which can be used to query the data archived by an EPICS Channel Archiver. It includes a bash script, gethist, which can parse a wide range of dates and times and process the corresponding data. However the service can be queried by any client issuing a pvAccess RPC request, such as eget. Requests and responses use EPICS V4 normative types. Requests are in the form of an NTURI normative type and the results are returned as an NTTable.

Documentation:channelArchiverService

test

This is not an embeded top level but just a subdirectory of exampleCPP.

This is an example that tests pvDatabase and pvaClient. This example requires that database must also be built.

It is meant to be used to execute:

make runtests

The test starts the example database and then executes various client tests.