EPICS exampleCPP/helloPutGet

2016.08.30

Abstract

helloPutGet implements a simple channelRPC putGet.

Table of Contents


Overview

The example implements a simple putGet that has a top level pvStructure:

structure
    structure argument
        string value
    structure result
        string value
        time_t timeStamp
            long secondsPastEpoch
            int nanoseconds
            int userTag

It is designed to be accessed via a channelPutGet request. The client sets argument.value When the record processes it sets result.value to "Hello " concatenated with argument.value. Thus if the client sets argument.value equal to "World" result.value will be "Hello World". In addition the timeStamp is set to the time when process is called.

The example can be run on linux as follows:

Server

mrk> pwd
/home/epicsv4/master/exampleCPP/helloPutGet
mrk> bin/$EPICS_HOST_ARCH/helloPutGetMain

To start helloPutGet as part of a V3IOC:

mrk> pwd
/home/hg/exampleCPP/master/helloPutGet/iocBoot/helloPutGet
mrk> ../../../bin/$EPICS_HOST_ARCH/helloPutGet st.cmd

Client

mrk> pwd
/home/epicsv4/master/exampleCPP/helloPutGet
mrk> bin/$EPICS_HOST_ARCH/helloPutGetClient

Directory Layout

The directory layout is:

helloPutGet
    configure
       ExampleRELEASE.local
       ...
    src
       pv
          helloPutGetRecord.h
       helloPutGetRecord.cpp
       helloPutGetInclude.dbd
       helloPutGetMain.cpp
       helloPutGetRegister.cpp
       helloPutGetRegister.dbd
       helloPutGetClient.cpp
    ioc
       Db
          ...
       src
          helloPutGetInclude.dbd
          helloPutGetMain.cpp
   iocBoot
      helloPutGet
         st.cmd
         ...
where
ExampleRELEASE.local
If you make a copy of helloPutGet and use it to create a new server, This is the file that must be copied to RELEASE.local and edited.
helloPutGetRecord.h
The header file for helloPutGet.
helloPutGetRecord.cpp
The helloPutGet implementation.
helloPutGetMain.cpp
A main program that runs the example so that it can be accessed by a pvAccess client.
helloPutGetInclude.dbd
This has a register command so that the putGet can be started on a V3 IOC via iocsh.
helloPutGetRegister.cpp
This has the code to start the putGet via the following iocsh command.
helloPutGetCreateRecord helloPutGet
         
Multiple commands can be issued to create multiple putGet records.
helloPutGetRegister.dbd
This is the file that is used to create the shell command helloPutGetCreateRecord.
helloPutGetClient.cpp
Client code to test helloPutGet
ioc
This is for building a V3 IOC application.
ioc/Db
This has template files for creating V3 records.
ioc/src
The files for running a V3 IOC.
iocBoot/helloPutGet
A place to start helloPutGet as part of a V3IOC. It has a st.cmd file that starts the ioc and also starts pvAccess and the example.

If only a main program is desired then the directory layout is:

helloPutGet
    configure
       ExampleRELEASE.local
       ...
    src
       pv
          helloPutGetRecord.h
       code
          helloPutGetRecord.cpp
          helloPutGetMain.cpp

Thus if only a main program is required the directory layout is simple.

Also many sites will want to build the src directory in an area separate from where the iocs are build.