testAsynPortDriver Class Reference

Class that demonstrates the use of the asynPortDriver base class to greatly simplify the task of writing an asyn port driver. More...

Inheritance diagram for testAsynPortDriver:

asynPortDriver

List of all members.

Public Member Functions

 testAsynPortDriver (const char *portName, int maxArraySize)
 Constructor for the testAsynPortDriver class.
virtual asynStatus writeInt32 (asynUser *pasynUser, epicsInt32 value)
 Called when asyn clients call pasynInt32->write().
virtual asynStatus writeFloat64 (asynUser *pasynUser, epicsFloat64 value)
 Called when asyn clients call pasynFloat64->write().
virtual asynStatus readFloat64Array (asynUser *pasynUser, epicsFloat64 *value, size_t nElements, size_t *nIn)
 Called when asyn clients call pasynFloat64Array->read().
virtual asynStatus drvUserCreate (asynUser *pasynUser, const char *drvInfo, const char **pptypeName, size_t *psize)
 Called by asynManager to pass a pasynUser structure and drvInfo string to the driver; assigns pasynUser->reason to one of the testParams enum value based on the value of the drvInfo string.
void simTask (void)
 Simulation task that runs as a separate thread.


Detailed Description

Class that demonstrates the use of the asynPortDriver base class to greatly simplify the task of writing an asyn port driver.

This class does a simple simulation of a digital oscilloscope. It computes a waveform, computes statistics on the waveform, and does callbacks with the statistics and the waveform data itself. I have made the methods of this class public in order to generate doxygen documentation for them, but they should really all be private.


Constructor & Destructor Documentation

testAsynPortDriver::testAsynPortDriver ( const char *  portName,
int  maxPoints 
)

Constructor for the testAsynPortDriver class.

Calls constructor for the asynPortDriver base class.

Parameters:
[in] portName The name of the asyn port driver to be created.
[in] maxPoints The maximum number of points in the volt and time arrays


Member Function Documentation

asynStatus testAsynPortDriver::writeInt32 ( asynUser *  pasynUser,
epicsInt32  value 
) [virtual]

Called when asyn clients call pasynInt32->write().

This function sends a signal to the simTask thread if the value of P_Run has changed. For all parameters it sets the value in the parameter library and calls any registered callbacks..

Parameters:
[in] pasynUser pasynUser structure that encodes the reason and address.
[in] value Value to write.

Reimplemented from asynPortDriver.

asynStatus testAsynPortDriver::writeFloat64 ( asynUser *  pasynUser,
epicsFloat64  value 
) [virtual]

Called when asyn clients call pasynFloat64->write().

This function sends a signal to the simTask thread if the value of P_UpdateTime has changed. For all parameters it sets the value in the parameter library and calls any registered callbacks.

Parameters:
[in] pasynUser pasynUser structure that encodes the reason and address.
[in] value Value to write.

Reimplemented from asynPortDriver.

asynStatus testAsynPortDriver::readFloat64Array ( asynUser *  pasynUser,
epicsFloat64 *  value,
size_t  nElements,
size_t *  nIn 
) [virtual]

Called when asyn clients call pasynFloat64Array->read().

Returns the value of the P_Waveform or P_TimeBase arrays.

Parameters:
[in] pasynUser pasynUser structure that encodes the reason and address.
[in] value Pointer to the array to read.
[in] nElements Number of elements to read.
[out] nIn Number of elements actually read.

Reimplemented from asynPortDriver.

asynStatus testAsynPortDriver::drvUserCreate ( asynUser *  pasynUser,
const char *  drvInfo,
const char **  pptypeName,
size_t *  psize 
) [virtual]

Called by asynManager to pass a pasynUser structure and drvInfo string to the driver; assigns pasynUser->reason to one of the testParams enum value based on the value of the drvInfo string.

Simply calls asynPortDriver::drvUserCreateParam with the parameter table for this driver.

Parameters:
[in] pasynUser pasynUser structure that driver modifies
[in] drvInfo String containing information about what driver function is being referenced
[out] pptypeName Location in which driver puts a copy of drvInfo.
[out] psize Location where driver puts size of param.
Returns:
Returns asynSuccess if a matching string was found, asynError if not found.

Reimplemented from asynPortDriver.

void testAsynPortDriver::simTask ( void   ) 

Simulation task that runs as a separate thread.

When the P_Run parameter is set to 1 to rub the simulation it computes a 1 kHz sine wave with 1V amplitude and user-controllable noise, and displays it on a simulated scope. It computes waveforms for the X (time) and Y (volt) axes, and computes statistics about the waveform.


The documentation for this class was generated from the following file:

Generated on Wed Aug 19 15:50:33 2009 for asyn by  doxygen 1.5.6