asynPortClient

C++ Base Class for Asyn Port Clients

January 26, 2019

Mark Rivers

University of Chicago

asynPortClient is a set of C++ classes that are designed to simplify the task of writing a client that directly communicates with an asyn port driver, without running an EPICS IOC. They handle the details of connecting to the driver, finding the required interfaces, etc. They only use the synchronous interfaces, so all calls are blocking. If clients need asynchronous operation then they can use the normal C interface with pasynManager->queueRequest.

asynPortClient provides a base class, asynParamClient, from which interface-specific class are derived. It also provides a class for each of the standard asyn interfaces, (asynInt32Client, asynFloat64Client, asynCommonClient, asynEnumClient, etc.).

The asynPortClient class connects to a specific asynPortDriver object. It creates an asynParamClient derived class for each of the parameters in that driver. It uses the std::map class to map between the parameter name key and the asynParamClient object for that parameter. It also defines generic write() and read() methods that take a paramName argument and the value to be written or pointer to read into. The data type of the value or pointer must match the parameter type or a run-time exception will be thrown.

The detailed documentation for asynPortClient is in these files (generated by doxygen):

The example driver in asyn (testAsynPortClient) is a simple example of how to use this class.

Another example can be found in ADSimDetector/iocs/simDetectorNoIOC found in the areaDetector module.

Example client - testAsynPortClient

An example client using the asynPortClientclass is provided in the testAsynPortClientApp application in asyn. This tests running C++ applications that communicate with asyn port drivers without running an IOC. This currently contains a single test application, testAsynIPPortClient.cpp. This program creates an asynIPPort driver, and uses the command line arguments to set the hostInfo string, a single command string to send to the server, and optionally the input and output EOS. It then prints out the response from the server. There are 3 example shell scipts that show how to use testAsynIPPortClient to communicate with a Web server, XPS motor controller, and a telnet host respectively.