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...

#include <testAsynPortDriver.h>

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().
void simTask (void)
 Simulation task that runs as a separate thread.

Protected Attributes

int P_Run
 Values used for pasynUser->reason, and indexes into the parameter library.
int P_MaxPoints
int P_TimePerDivision
int P_VoltsPerDivision
int P_VoltOffset
int P_TriggerDelay
int P_NoiseAmplitude
int P_UpdateTime
int P_Waveform
int P_TimeBase
int P_MinValue
int P_MaxValue
int P_MeanValue


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::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.

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.

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::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.


Member Data Documentation

int testAsynPortDriver::P_Run [protected]

Values used for pasynUser->reason, and indexes into the parameter library.


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

Generated on Wed Aug 3 10:34:41 2011 for asyn by  doxygen 1.5.7.1