ADApp/pluginSrc/NDPluginStats.cpp
asynStatus NDPluginStats::writeInt32(asynUser *pasynUser, epicsInt32 value)
{
    int function = pasynUser->reason;
    asynStatus status = asynSuccess;
    int i;
    int numPoints, currentPoint;
    static const char *functionName = "writeInt32";


    /* Set the parameter in the parameter library. */
    status = (asynStatus) setIntegerParam(function, value);

    if (function == NDPluginStatsCursorX) {
        this->cursorX = value;
        if (this->pArrays[0]) {
            doComputeProfiles(this->pArrays[0]);
        }
    } else if (function == NDPluginStatsCursorY) {
        this->cursorY = value;
        if (this->pArrays[0]) {
            doComputeProfiles(this->pArrays[0]);
        }
    } else if (function == NDPluginStatsTSNumPoints) {
        for (i=0; i<MAX_TIME_SERIES_TYPES; i++) {
            free(this->timeSeries[i]);
            timeSeries[i] = (double *)calloc(value, sizeof(double));
        }
    } else if (function == NDPluginStatsTSControl) {
        switch (value) {
            case TSEraseStart:
                setIntegerParam(NDPluginStatsTSCurrentPoint, 0);
                setIntegerParam(NDPluginStatsTSAcquiring, 1);
                getIntegerParam(NDPluginStatsTSNumPoints, &numPoints);
                for (i=0; i<MAX_TIME_SERIES_TYPES; i++) {
                    memset(this->timeSeries[i], 0, numPoints*sizeof(double));
                }
                break;
            case TSStart:
                getIntegerParam(NDPluginStatsTSNumPoints, &numPoints);
                getIntegerParam(NDPluginStatsTSCurrentPoint, &currentPoint);
                if (currentPoint < numPoints) {
                    setIntegerParam(NDPluginStatsTSAcquiring, 1);
                }
                break;
            case TSStop:
                setIntegerParam(NDPluginStatsTSAcquiring, 0);
                doTimeSeriesCallbacks();
                break;
            case TSRead:
                doTimeSeriesCallbacks();
                break;
        }
    } else {
        /* If this parameter belongs to a base class call its method */
        if (function < FIRST_NDPLUGIN_STATS_PARAM) 
            status = NDPluginDriver::writeInt32(pasynUser, value);
    }
    
    /* Do callbacks so higher layers see any changes */
    status = (asynStatus) callParamCallbacks();
    
    if (status) 
        epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, 
                  "%s:%s: status=%d, function=%d, value=%d", 
                  driverName, functionName, status, function, value);
    else        
        asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, 
              "%s:%s: function=%d, value=%d\n", 
              driverName, functionName, function, value);
    return status;
}
/** Called when asyn clients call pasynInt32->write().
  * This function performs actions for some parameters.
  * For all parameters it sets the value in the parameter library and calls any registered callbacks..
  * \param[in] pasynUser pasynUser structure that encodes the reason and address.
  * \param[in] value Value to write. */
Called when asyn clients call pasynInt32->write().
This function performs actions for some parameters.
For all parameters it sets the value in the parameter library and calls any registered callbacks
\param[in] pasynUser pasynUser structure that encodes the reason and address.
\param[in] value Value to write.
Called when asyn clients call pasynInt32 - > write () . This function performs actions for some parameters . For all parameters it sets the value in the parameter library and calls any registered callbacks \ param [ in ] pasynUser pasynUser structure that encodes the reason and address . \ param [ in ] value Value to write .
asynStatus NDPluginStats::writeInt32(asynUser *pasynUser, epicsInt32 value)
{
    int function = pasynUser->reason;
    asynStatus status = asynSuccess;
    int i;
    int numPoints, currentPoint;
    static const char *functionName = "writeInt32";
    status = (asynStatus) setIntegerParam(function, value);
    if (function == NDPluginStatsCursorX) {
        this->cursorX = value;
        if (this->pArrays[0]) {
            doComputeProfiles(this->pArrays[0]);
        }
    } else if (function == NDPluginStatsCursorY) {
        this->cursorY = value;
        if (this->pArrays[0]) {
            doComputeProfiles(this->pArrays[0]);
        }
    } else if (function == NDPluginStatsTSNumPoints) {
        for (i=0; i<MAX_TIME_SERIES_TYPES; i++) {
            free(this->timeSeries[i]);
            timeSeries[i] = (double *)calloc(value, sizeof(double));
        }
    } else if (function == NDPluginStatsTSControl) {
        switch (value) {
            case TSEraseStart:
                setIntegerParam(NDPluginStatsTSCurrentPoint, 0);
                setIntegerParam(NDPluginStatsTSAcquiring, 1);
                getIntegerParam(NDPluginStatsTSNumPoints, &numPoints);
                for (i=0; i<MAX_TIME_SERIES_TYPES; i++) {
                    memset(this->timeSeries[i], 0, numPoints*sizeof(double));
                }
                break;
            case TSStart:
                getIntegerParam(NDPluginStatsTSNumPoints, &numPoints);
                getIntegerParam(NDPluginStatsTSCurrentPoint, &currentPoint);
                if (currentPoint < numPoints) {
                    setIntegerParam(NDPluginStatsTSAcquiring, 1);
                }
                break;
            case TSStop:
                setIntegerParam(NDPluginStatsTSAcquiring, 0);
                doTimeSeriesCallbacks();
                break;
            case TSRead:
                doTimeSeriesCallbacks();
                break;
        }
    } else {
        if (function < FIRST_NDPLUGIN_STATS_PARAM) 
            status = NDPluginDriver::writeInt32(pasynUser, value);
    }
    status = (asynStatus) callParamCallbacks();
    if (status) 
        epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, 
                  "%s:%s: status=%d, function=%d, value=%d", 
                  driverName, functionName, status, function, value);
    else        
        asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, 
              "%s:%s: function=%d, value=%d\n", 
              driverName, functionName, function, value);
    return status;
}
asynStatus NDPluginStats :: writeInt32 ( asynUser * pasynUser , epicsInt32 value ) { int function = pasynUser -> reason ; asynStatus status = asynSuccess ; int i ; int numPoints , currentPoint ; static const char * functionName = " " ; status = ( asynStatus ) setIntegerParam ( function , value ) ; if ( function == NDPluginStatsCursorX ) { this -> cursorX = value ; if ( this -> pArrays [ 0 ] ) { doComputeProfiles ( this -> pArrays [ 0 ] ) ; } } else if ( function == NDPluginStatsCursorY ) { this -> cursorY = value ; if ( this -> pArrays [ 0 ] ) { doComputeProfiles ( this -> pArrays [ 0 ] ) ; } } else if ( function == NDPluginStatsTSNumPoints ) { for ( i = 0 ; i < MAX_TIME_SERIES_TYPES ; i ++ ) { free ( this -> timeSeries [ i ] ) ; timeSeries [ i ] = ( double * ) calloc ( value , sizeof ( double ) ) ; } } else if ( function == NDPluginStatsTSControl ) { switch ( value ) { case TSEraseStart : setIntegerParam ( NDPluginStatsTSCurrentPoint , 0 ) ; setIntegerParam ( NDPluginStatsTSAcquiring , 1 ) ; getIntegerParam ( NDPluginStatsTSNumPoints , & numPoints ) ; for ( i = 0 ; i < MAX_TIME_SERIES_TYPES ; i ++ ) { memset ( this -> timeSeries [ i ] , 0 , numPoints * sizeof ( double ) ) ; } break ; case TSStart : getIntegerParam ( NDPluginStatsTSNumPoints , & numPoints ) ; getIntegerParam ( NDPluginStatsTSCurrentPoint , & currentPoint ) ; if ( currentPoint < numPoints ) { setIntegerParam ( NDPluginStatsTSAcquiring , 1 ) ; } break ; case TSStop : setIntegerParam ( NDPluginStatsTSAcquiring , 0 ) ; doTimeSeriesCallbacks ( ) ; break ; case TSRead : doTimeSeriesCallbacks ( ) ; break ; } } else { if ( function < FIRST_NDPLUGIN_STATS_PARAM ) status = NDPluginDriver :: writeInt32 ( pasynUser , value ) ; } status = ( asynStatus ) callParamCallbacks ( ) ; if ( status ) epicsSnprintf ( pasynUser -> errorMessage , pasynUser -> errorMessageSize , " " , driverName , functionName , status , function , value ) ; else asynPrint ( pasynUser , ASYN_TRACEIO_DRIVER , " \n " , driverName , functionName , function , value ) ; return status ; }
Called when asyn clients call pasynInt32->write().
Called when asyn clients call pasynInt32 - > write () .
/* Set the parameter in the parameter library. */ /* If this parameter belongs to a base class call its method */ /* Do callbacks so higher layers see any changes */