PvaClientChannel

Overview

pvaClientChannel is a synchronous wrapper for the pvAccess::Channel API, which is a callback based API. Thus it is easier to use than pvAccess::Channel itself.

An instance of PvaClientChannel connects to a single channel. An instance can only be created via class PvaClient which has both synchronous methods, which block, and non blocking methods. The synchrouous methods block until a connection is made to the channel and throw an exception if a timeout occurs while trying to make a connection. The non blocking methods leave connection to the caller.

PvaClientChannel has methods:

Connect to channel
These can be called indirectly by a blocking request to PvaClient or by the client if a non blocking request is made to PvaClient.
Channel state change requester
The client can provide a callback that is called each time the connection state of the channel changes.
Creating all of the following
PvaClientField      NOT IMPLEMENTED
PvaClientProcess
PvaClientGet
PvaClientPut
PvaClientPutGet
PvaClientMonitor
PvaClientArray      NOT IMPLEMENTED
PvaClientRPC

Connect: Blocking vs Non-Blocking

PvaClientChannel has methods:

connect
This calls issueConnect and then waitConnect. If waitConnect fails an exception is thrown. Since waitConnect is a blocking method so is this.
issueConnect
This is a request to connect to the channel. This is a non blocking call.
waitConnect
This waits for the server to respond to issueConnect. It blocks until the server responds or a timeout occurs.

Get and Put Caching

PvaClientChannel has methods:

PvaClientGetPtr get(std::string const & request);
PvaClientPutPtr put(std::string const & request);

Each of these caches. For example all calls to get with the same request will share the same PvaChannelGet

For example consider a client that makes multiple calls like:

double value;
value =  pva->channel(channelName)->get()->getData()->getDouble();
...
value =  pva->channel(channelName)->get()->getData()->getDouble();

Only the first call creates a new PvaClientChannel and a new PvaClientGet. The second call reuses the cached PvaClientChannel and PvaClientGet.