asyn 4-30
|
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>
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 | readEnum (asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements, size_t *nIn) |
Called when asyn clients call pasynEnum->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_TimePerDiv |
int | P_TimePerDivSelect |
int | P_VertGain |
int | P_VertGainSelect |
int | P_VoltsPerDiv |
int | P_VoltsPerDivSelect |
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 |
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.
testAsynPortDriver::testAsynPortDriver | ( | const char * | portName, |
int | maxPoints | ||
) |
Constructor for the testAsynPortDriver class.
Calls constructor for the asynPortDriver base class.
[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 |
asynStatus testAsynPortDriver::readEnum | ( | asynUser * | pasynUser, |
char * | strings[], | ||
int | values[], | ||
int | severities[], | ||
size_t | nElements, | ||
size_t * | nIn | ||
) | [virtual] |
Called when asyn clients call pasynEnum->read().
The base class implementation simply prints an error message. Derived classes may reimplement this function if required.
[in] | pasynUser | pasynUser structure that encodes the reason and address. |
[in] | strings | Array of string pointers. |
[in] | values | Array of values |
[in] | severities | Array of severities |
[in] | nElements | Size of value array |
[out] | nIn | Number of elements actually returned |
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.
[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.
[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..
[in] | pasynUser | pasynUser structure that encodes the reason and address. |
[in] | value | Value to write. |
Reimplemented from asynPortDriver.
int testAsynPortDriver::P_MaxPoints [protected] |
int testAsynPortDriver::P_MaxValue [protected] |
int testAsynPortDriver::P_MeanValue [protected] |
int testAsynPortDriver::P_MinValue [protected] |
int testAsynPortDriver::P_NoiseAmplitude [protected] |
int testAsynPortDriver::P_Run [protected] |
Values used for pasynUser->reason, and indexes into the parameter library.
int testAsynPortDriver::P_TimeBase [protected] |
int testAsynPortDriver::P_TimePerDiv [protected] |
int testAsynPortDriver::P_TimePerDivSelect [protected] |
int testAsynPortDriver::P_TriggerDelay [protected] |
int testAsynPortDriver::P_UpdateTime [protected] |
int testAsynPortDriver::P_VertGain [protected] |
int testAsynPortDriver::P_VertGainSelect [protected] |
int testAsynPortDriver::P_VoltOffset [protected] |
int testAsynPortDriver::P_VoltsPerDiv [protected] |
int testAsynPortDriver::P_VoltsPerDivSelect [protected] |
int testAsynPortDriver::P_Waveform [protected] |