FASTApp/MPA3DetectorSrc/MPA3Detector.cpp
/**
This loop is designed to run about periodically ( 1 sec ?) so that a caqtdm cacamera widget can be displaying what the vendor software
is doing. A standard collect and acquire is expensive many, many second, so just displaying what it already has save a lot of time.
So do this when idle and hope for the best.
*/
This loop is designed to run about periodically ( 1 sec ?) so that a caqtdm cacamera widget can be displaying what the vendor software
is doing. A standard collect and acquire is expensive many, many second, so just displaying what it already has save a lot of time.
So do this when idle and hope for the best.
This loop is designed to run about periodically ( 1 sec ? ) so that a caqtdm cacamera widget can be displaying what the vendor software is doing . A standard collect and acquire is expensive many many second so just displaying what it already has save a lot of time . So do this when idle and hope for the best .
void MPA3Detector::mpaTaskBackground()
{
    int status = asynSuccess;
    NDArray *pImage;
    epicsTimeStamp startTime;
    int i;
    int value;
    const char *functionName = "mpaTaskBackground";
    while (1) {
       this->unlock();
	   epicsThreadSleep(1.0);
	   this->lock();
	   if (this->channelNum > 0) {
        status = getIntegerParam(P_RunTimeEnable, &value);
        if (value == 0) {
        computeArrays(0);
	status |= setIntegerParam(NDArraySizeX, 1024);
	status |= setIntegerParam(NDArraySizeY, 1024);
        pImage = this->pArrays[0];
        pImage->uniqueId = uniqueId_;
        epicsTimeGetCurrent(&startTime);
        pImage->timeStamp = startTime.secPastEpoch + startTime.nsec / 1.e9;
        updateTimeStamp(&pImage->epicsTS);
        this->getAttributes(pImage->pAttributeList);
        this->unlock();
        doCallbacksGenericPointer(pImage, NDArrayData, 0);
        this->lock();
        for (i=0; i<MAX_SIGNALS; i++) {
            callParamCallbacks(i);
        }
    }
	   }
	}
}
void MPA3Detector :: mpaTaskBackground ( ) { int status = asynSuccess ; NDArray * pImage ; epicsTimeStamp startTime ; int i ; int value ; const char * functionName = " " ; while ( 1 ) { this -> unlock ( ) ; epicsThreadSleep ( 1.0 ) ; this -> lock ( ) ; if ( this -> channelNum > 0 ) { status = getIntegerParam ( P_RunTimeEnable , & value ) ; if ( value == 0 ) { computeArrays ( 0 ) ; status |= setIntegerParam ( NDArraySizeX , 1024 ) ; status |= setIntegerParam ( NDArraySizeY , 1024 ) ; pImage = this -> pArrays [ 0 ] ; pImage -> uniqueId = uniqueId_ ; epicsTimeGetCurrent ( & startTime ) ; pImage -> timeStamp = startTime . secPastEpoch + startTime . nsec / 1.e9 ; updateTimeStamp ( & pImage -> epicsTS ) ; this -> getAttributes ( pImage -> pAttributeList ) ; this -> unlock ( ) ; doCallbacksGenericPointer ( pImage , NDArrayData , 0 ) ; this -> lock ( ) ; for ( i = 0 ; i < MAX_SIGNALS ; i ++ ) { callParamCallbacks ( i ) ; } } } } }
This loop is designed to run about periodically ( 1 sec ?)
This loop is designed to run about periodically ( 1 sec ? )
//    int numTimePoints; //    int arrayCounter; //    double timeStep; //printf("In mpaTaskBackground %d\n",channelNum); /* Loop forever */ //       printf("In the mpaTaskBackground loop %d\n",channelNum);	 //	status |= setIntegerParam(ADMinX, 0); //	status |= setIntegerParam(ADMinY, 0); //	status |= setIntegerParam(ADSizeX, 1024); //	status |= setIntegerParam(ADSizeY, 1024); /* Put the frame number and time stamp into the buffer */ /* Get any attributes that have been defined for this driver */ /* Call the NDArray callback */ /* Must release the lock here, or we can get into a deadlock, because we can
         * block on the plugin lock, and the plugin can be calling us */ /* Call the callbacks to update any changes */