Пример #1
0
/** Constructor for NDPluginFile; all parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when 
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxAddr The maximum  number of asyn addr addresses this driver supports. 1 is minimum.
  * \param[in] numParams The number of parameters supported by the derived class calling this constructor.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is 
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is 
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] interfaceMask Bit mask defining the asyn interfaces that this driver supports.
  * \param[in] interruptMask Bit mask definining the asyn interfaces that can generate interrupts (callbacks)
  * \param[in] asynFlags Flags when creating the asyn port driver; includes ASYN_CANBLOCK and ASYN_MULTIDEVICE.
  * \param[in] autoConnect The autoConnect flag for the asyn port driver.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginFile::NDPluginFile(const char *portName, int queueSize, int blockingCallbacks, 
                           const char *NDArrayPort, int NDArrayAddr, int maxAddr, int numParams,
                           int maxBuffers, size_t maxMemory, int interfaceMask, int interruptMask,
                           int asynFlags, int autoConnect, int priority, int stackSize)

    /* Invoke the base class constructor.
     * We allocate 1 NDArray of unlimited size in the NDArray pool.
     * This driver can block (because writing a file can be slow), and it is not multi-device.  
     * Set autoconnect to 1.  priority and stacksize can be 0, which will use defaults. */
    : NDPluginDriver(portName, queueSize, blockingCallbacks, 
                     NDArrayPort, NDArrayAddr, maxAddr, numParams+NUM_NDPLUGIN_FILE_PARAMS, maxBuffers, maxMemory, 
                     asynGenericPointerMask, asynGenericPointerMask,
                     asynFlags, autoConnect, priority, stackSize),
    pCapture(NULL), captureBufferSize(0)
{
    //const char *functionName = "NDPluginFile";
    
    this->useAttrFilePrefix = false;
    this->fileMutexId = epicsMutexCreate();
    /* Set the plugin type string */    
    setStringParam(NDPluginDriverPluginType, "NDPluginFile");

    /* Try to connect to the NDArray port */
    connectToArrayPort();
}
Пример #2
0
/** Constructor for NDPluginTransform; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * After calling the base class constructor this method sets reasonable default values for all of the
  * Transform parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *      NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *      at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *      0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *      of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *      allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *      allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginTransform::NDPluginTransform(const char *portName, int queueSize, int blockingCallbacks,
             const char *NDArrayPort, int NDArrayAddr, int maxBuffers, size_t maxMemory,
             int priority, int stackSize)
  /* Invoke the base class constructor */
  : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_TRANSFORM_PARAMS, maxBuffers, maxMemory,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   ASYN_MULTIDEVICE, 1, priority, stackSize)
{
  //static const char *functionName = "NDPluginTransform";
  int i;

  createParam(NDPluginTransformTypeString, asynParamInt32, &NDPluginTransformType_);

  for (i = 0; i < ND_ARRAY_MAX_DIMS; i++) {
    this->userDims_[i] = i;
  }
  
  /* Set the plugin type string */
  setStringParam(NDPluginDriverPluginType, "NDPluginTransform");
  setIntegerParam(NDPluginTransformType_, TransformNone);

  /* Try to connect to the array port */
  connectToArrayPort();
}
Пример #3
0
/** Constructor for NDPluginFile; all parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when 
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxAddr The maximum  number of asyn addr addresses this driver supports. 1 is minimum.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is 
  *            allowed to allocate. Set this to 0 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is 
  *            allowed to allocate. Set this to 0 to allow an unlimited amount of memory.
  * \param[in] interfaceMask Bit mask defining the asyn interfaces that this driver supports.
  * \param[in] interruptMask Bit mask definining the asyn interfaces that can generate interrupts (callbacks)
  * \param[in] asynFlags Flags when creating the asyn port driver; includes ASYN_CANBLOCK and ASYN_MULTIDEVICE.
  * \param[in] autoConnect The autoConnect flag for the asyn port driver.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] maxThreads The maximum number of threads this driver is allowed to use. If 0 then 1 will be used.
  */
NDPluginFile::NDPluginFile(const char *portName, int queueSize, int blockingCallbacks, 
                           const char *NDArrayPort, int NDArrayAddr, int maxAddr,
                           int maxBuffers, size_t maxMemory, int interfaceMask, int interruptMask,
                           int asynFlags, int autoConnect, int priority, int stackSize, int maxThreads)

    /* Invoke the base class constructor.
     * We allocate 1 NDArray of unlimited size in the NDArray pool.
     * This driver can block (because writing a file can be slow), and it is not multi-device.  
     * Set autoconnect to 1.  priority and stacksize can be 0, which will use defaults. */
    : NDPluginDriver(portName, queueSize, blockingCallbacks, 
                     NDArrayPort, NDArrayAddr, maxAddr, maxBuffers, maxMemory, 
                     asynGenericPointerMask, asynGenericPointerMask,
                     asynFlags, autoConnect, priority, stackSize, maxThreads),
    pCapture(NULL), captureBufferSize(0)
{
    //static const char *functionName = "NDPluginFile";

    this->ndArrayInfoInit = NULL;
    this->lazyOpen = false;

    this->useAttrFilePrefix = false;
    this->fileMutexId = epicsMutexCreate();
    /* Set the plugin type string */    
    setStringParam(NDPluginDriverPluginType, "NDPluginFile");

    // Disable ArrayCallbacks.  
    // This plugin currently does not do array callbacks, so make the setting reflect the behavior
    setIntegerParam(NDArrayCallbacks, 0);

    /* Try to connect to the NDArray port */
    connectToArrayPort();
}
Пример #4
0
adPvaServer::adPvaServer(
    const string & portName,
    const string & imageName,
    int queueSize,
    int blockingCallbacks,
    const string & NDArrayPort,
    int NDArrayAddr,
    int maxbuffers,
    int maxmemory)
: NDPluginDriver(portName.c_str(), queueSize, blockingCallbacks, 
      NDArrayPort.c_str(), NDArrayAddr, 1, NUM_AD_IMAGE_SERVER_PARAMS,
      maxbuffers, maxmemory,
      0,  // interfaceMask
      0,  // interruptMask,
      ASYN_CANBLOCK,
      1,  // autoconnect
      0,  // priority
      0), // stack-size
  imageName(imageName)
{
    createParam("arrayPVName", asynParamOctet, &arrayPVName);

    setStringParam(NDPluginDriverPluginType, "EPICS V4 AD Image Server");
    setStringParam(arrayPVName, imageName.c_str());

    callParamCallbacks();
 
    PVDatabasePtr master = PVDatabase::getMaster();
    record = NDArrayRecord::create(imageName);
    bool result = master->addRecord(record);
    if(!result) std::cerr << "recordname" << " not added" << std::endl;

    connectToArrayPort();
}
/** Constructor for NDPluginStdArrays; all parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * This plugin cannot block (ASYN_CANBLOCK=0) and is not multi-device (ASYN_MULTIDEVICE=0).
  * It allocates a maximum of 2 NDArray buffers for internal use.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when 
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is 
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginStdArrays::NDPluginStdArrays(const char *portName, int queueSize, int blockingCallbacks, 
                                     const char *NDArrayPort, int NDArrayAddr, size_t maxMemory,
                                     int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks, 
                   NDArrayPort, NDArrayAddr, 1, NUM_NDPLUGIN_STDARRAYS_PARAMS, 2, maxMemory,
                   
                   asynInt8ArrayMask | asynInt16ArrayMask | asynInt32ArrayMask | 
                   asynFloat32ArrayMask | asynFloat64ArrayMask,
                   
                   asynInt8ArrayMask | asynInt16ArrayMask | asynInt32ArrayMask | 
                   asynFloat32ArrayMask | asynFloat64ArrayMask,
                   
                   /* asynFlags is set to 0, because this plugin cannot block and is not multi-device.
                    * It does autoconnect */
                   0, 1, priority, stackSize)
{
    //static const char *functionName = "NDPluginStdArrays";
    
    createParam(NDPluginStdArraysDataString, asynParamGenericPointer, &NDPluginStdArraysData);

    /* Set the plugin type string */    
    setStringParam(NDPluginDriverPluginType, "NDPluginStdArrays");

    // Disable ArrayCallbacks.  
    // This plugin currently does not do array callbacks, so make the setting reflect the behavior
    setIntegerParam(NDArrayCallbacks, 0);

    /* Try to connect to the NDArray port */
    connectToArrayPort();
}
Пример #6
0
/** Constructor for NDPluginAttribute; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  *
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxAttributes The maximum number of attributes that this plugin will support
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginAttribute::NDPluginAttribute(const char *portName, int queueSize, int blockingCallbacks,
                                     const char *NDArrayPort, int NDArrayAddr, int maxAttributes,
                                     int maxBuffers, size_t maxMemory,
                                     int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, maxAttributes, maxBuffers, maxMemory,
                   asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
                   ASYN_MULTIDEVICE, 1, priority, stackSize, 1)
{
  int i;
  static const char *functionName = "NDPluginAttribute::NDPluginAttribute";

  maxAttributes_ = maxAttributes;
  if (maxAttributes_ < 1) maxAttributes_ = 1;
  /* parameters */
  createParam(NDPluginAttributeAttrNameString,       asynParamOctet,        &NDPluginAttributeAttrName);
  createParam(NDPluginAttributeResetString,          asynParamInt32,        &NDPluginAttributeReset);
  createParam(NDPluginAttributeValString,            asynParamFloat64,      &NDPluginAttributeVal);
  createParam(NDPluginAttributeValSumString,         asynParamFloat64,      &NDPluginAttributeValSum);
  createParam(NDPluginAttributeTSControlString,      asynParamInt32,        &NDPluginAttributeTSControl);
  createParam(NDPluginAttributeTSNumPointsString,    asynParamInt32,        &NDPluginAttributeTSNumPoints);
  createParam(NDPluginAttributeTSCurrentPointString, asynParamInt32,        &NDPluginAttributeTSCurrentPoint);
  createParam(NDPluginAttributeTSAcquiringString,    asynParamInt32,        &NDPluginAttributeTSAcquiring);
  createParam(NDPluginAttributeTSArrayValueString,   asynParamFloat64Array, &NDPluginAttributeTSArrayValue);

  /* Set the plugin type string */
  setStringParam(NDPluginDriverPluginType, "NDPluginAttribute");

  setIntegerParam(NDPluginAttributeTSNumPoints, DEFAULT_NUM_TSPOINTS);
  pTSArray_ = static_cast<epicsFloat64 **>(calloc(maxAttributes_, sizeof(epicsFloat64 *)));
  if (pTSArray_ == NULL) {
    perror(functionName);
    asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s: Error from calloc for pTSArray_.\n", functionName);
  }
  for (i=0; i<maxAttributes_; i++) {
    pTSArray_[i] = static_cast<epicsFloat64*>(calloc(DEFAULT_NUM_TSPOINTS, sizeof(epicsFloat64)));
    setDoubleParam(i, NDPluginAttributeVal, 0.0);
    setDoubleParam(i, NDPluginAttributeValSum, 0.0);
    setStringParam(i, NDPluginAttributeAttrName, "");
    if (pTSArray_[i] == NULL) {
      perror(functionName);
      asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s: Error from calloc for pTSArray_.\n", functionName);
    }
    callParamCallbacks(i);
  }

  // Disable ArrayCallbacks.  
  // This plugin currently does not do array callbacks, so make the setting reflect the behavior
  setIntegerParam(NDArrayCallbacks, 0);

  /* Try to connect to the array port */
  connectToArrayPort();

}
/** Constructor for NDPluginAttribute; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  *
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] maxTimeSeries The max size of the time series array
  * \param[in] attrName The name of the NDArray attribute
  */
NDPluginAttribute::NDPluginAttribute(const char *portName, int queueSize, int blockingCallbacks,
                                     const char *NDArrayPort, int NDArrayAddr,
                                     int maxBuffers, size_t maxMemory,
                                     int priority, int stackSize, 
                                     int maxTimeSeries, const char *attrName)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_NDPLUGIN_ATTR_PARAMS, maxBuffers, maxMemory,
                   asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
                   ASYN_MULTIDEVICE, 1, priority, stackSize)
{
    static const char *functionName = "NDPluginAttribute::NDPluginAttribute";

    /* parameters */
    createParam(NDPluginAttributeNameString,              asynParamOctet, &NDPluginAttributeName);
    createParam(NDPluginAttributeAttrNameString, asynParamOctet, &NDPluginAttributeAttrName);
    createParam(NDPluginAttributeResetString,          asynParamInt32, &NDPluginAttributeReset);
    createParam(NDPluginAttributeUpdateString,          asynParamInt32, &NDPluginAttributeUpdate);
    createParam(NDPluginAttributeValString,          asynParamFloat64, &NDPluginAttributeVal);
    createParam(NDPluginAttributeValSumString,          asynParamFloat64, &NDPluginAttributeValSum);
    createParam(NDPluginAttributeArrayString,          asynParamFloat64Array, &NDPluginAttributeArray);
    createParam(NDPluginAttributeDataTypeString,          asynParamInt32, &NDPluginAttributeDataType);
    createParam(NDPluginAttributeUpdatePeriodString,          asynParamFloat64, &NDPluginAttributeUpdatePeriod);
    
   
    /* Set the plugin type string */
    setStringParam(NDPluginDriverPluginType, "NDPluginAttribute");

    maxTimeSeries_ = maxTimeSeries;
    pTimeSeries_ = static_cast<epicsFloat64*>(calloc(maxTimeSeries_, sizeof(epicsFloat64)));
    if (pTimeSeries_ == NULL) {
      perror(functionName);
      asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s: Error from calloc for pTimeSeries_.\n", functionName);
    }

    currentPoint_ = 0;
    arrayUpdate_ = 1;
    valueSum_ = 0.0;

    /* Set the attribute name */
    /* This can be set at runtime too.*/
    setStringParam(NDPluginAttributeAttrName, attrName);

    setDoubleParam(NDPluginAttributeVal, 0.0);
    setDoubleParam(NDPluginAttributeValSum, 0.0);

    /* Try to connect to the array port */
    connectToArrayPort();

    callParamCallbacks();

}
Пример #8
0
/** Constructor for NDPluginROI; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * After calling the base class constructor this method sets reasonable default values for all of the
  * ROI parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginROI::NDPluginROI(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr,
                         int maxBuffers, size_t maxMemory,
                         int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_NDPLUGIN_ROI_PARAMS, maxBuffers, maxMemory,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   ASYN_MULTIDEVICE, 1, priority, stackSize)
{
    //static const char *functionName = "NDPluginROI";

    /* ROI general parameters */
    createParam(NDPluginROINameString,              asynParamOctet, &NDPluginROIName);

     /* ROI definition */
    createParam(NDPluginROIDim0MinString,           asynParamInt32, &NDPluginROIDim0Min);
    createParam(NDPluginROIDim1MinString,           asynParamInt32, &NDPluginROIDim1Min);
    createParam(NDPluginROIDim2MinString,           asynParamInt32, &NDPluginROIDim2Min);
    createParam(NDPluginROIDim0SizeString,          asynParamInt32, &NDPluginROIDim0Size);
    createParam(NDPluginROIDim1SizeString,          asynParamInt32, &NDPluginROIDim1Size);
    createParam(NDPluginROIDim2SizeString,          asynParamInt32, &NDPluginROIDim2Size);
    createParam(NDPluginROIDim0MaxSizeString,       asynParamInt32, &NDPluginROIDim0MaxSize);
    createParam(NDPluginROIDim1MaxSizeString,       asynParamInt32, &NDPluginROIDim1MaxSize);
    createParam(NDPluginROIDim2MaxSizeString,       asynParamInt32, &NDPluginROIDim2MaxSize);
    createParam(NDPluginROIDim0BinString,           asynParamInt32, &NDPluginROIDim0Bin);
    createParam(NDPluginROIDim1BinString,           asynParamInt32, &NDPluginROIDim1Bin);
    createParam(NDPluginROIDim2BinString,           asynParamInt32, &NDPluginROIDim2Bin);
    createParam(NDPluginROIDim0ReverseString,       asynParamInt32, &NDPluginROIDim0Reverse);
    createParam(NDPluginROIDim1ReverseString,       asynParamInt32, &NDPluginROIDim1Reverse);
    createParam(NDPluginROIDim2ReverseString,       asynParamInt32, &NDPluginROIDim2Reverse);
    createParam(NDPluginROIDim0EnableString,        asynParamInt32, &NDPluginROIDim0Enable);
    createParam(NDPluginROIDim1EnableString,        asynParamInt32, &NDPluginROIDim1Enable);
    createParam(NDPluginROIDim2EnableString,        asynParamInt32, &NDPluginROIDim2Enable);
    createParam(NDPluginROIDim0AutoSizeString,      asynParamInt32, &NDPluginROIDim0AutoSize);
    createParam(NDPluginROIDim1AutoSizeString,      asynParamInt32, &NDPluginROIDim1AutoSize);
    createParam(NDPluginROIDim2AutoSizeString,      asynParamInt32, &NDPluginROIDim2AutoSize);
    createParam(NDPluginROIDataTypeString,          asynParamInt32, &NDPluginROIDataType);
    createParam(NDPluginROIEnableScaleString,       asynParamInt32, &NDPluginROIEnableScale);
    createParam(NDPluginROIScaleString,             asynParamFloat64, &NDPluginROIScale);

    /* Set the plugin type string */
    setStringParam(NDPluginDriverPluginType, "NDPluginROI");

    // Enable ArrayCallbacks.  
    // This plugin currently ignores this setting and always does callbacks, so make the setting reflect the behavior
    setIntegerParam(NDArrayCallbacks, 1);

    /* Try to connect to the array port */
    connectToArrayPort();
}
Пример #9
0
/** Constructor for NDPluginOverlay; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * After calling the base class constructor this method sets reasonable default values for all of the
  * ROI parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxOverlays The maximum number ofoverlays this plugin supports. 1 is minimum.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginOverlay::NDPluginOverlay(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr, int maxOverlays,
                         int maxBuffers, size_t maxMemory,
                         int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, maxOverlays, NUM_NDPLUGIN_OVERLAY_PARAMS, maxBuffers, maxMemory,
                   asynGenericPointerMask,
                   asynGenericPointerMask,
                   ASYN_MULTIDEVICE, 1, priority, stackSize)
{
    static const char *functionName = "NDPluginOverlay";


    this->maxOverlays = maxOverlays;
    this->pOverlays = (NDOverlay_t *)callocMustSucceed(maxOverlays, sizeof(*this->pOverlays), functionName);

    createParam(NDPluginOverlayMaxSizeXString,      asynParamInt32, &NDPluginOverlayMaxSizeX);
    createParam(NDPluginOverlayMaxSizeYString,      asynParamInt32, &NDPluginOverlayMaxSizeY);
    createParam(NDPluginOverlayNameString,          asynParamOctet, &NDPluginOverlayName);
    createParam(NDPluginOverlayUseString,           asynParamInt32, &NDPluginOverlayUse);
    createParam(NDPluginOverlayPositionXString,     asynParamInt32, &NDPluginOverlayPositionX);
    createParam(NDPluginOverlayPositionYString,     asynParamInt32, &NDPluginOverlayPositionY);
    createParam(NDPluginOverlaySizeXString,         asynParamInt32, &NDPluginOverlaySizeX);
    createParam(NDPluginOverlaySizeYString,         asynParamInt32, &NDPluginOverlaySizeY);
    createParam(NDPluginOverlayWidthXString,        asynParamInt32, &NDPluginOverlayWidthX);
    createParam(NDPluginOverlayWidthYString,        asynParamInt32, &NDPluginOverlayWidthY);
    createParam(NDPluginOverlayShapeString,         asynParamInt32, &NDPluginOverlayShape);
    createParam(NDPluginOverlayDrawModeString,      asynParamInt32, &NDPluginOverlayDrawMode);
    createParam(NDPluginOverlayRedString,           asynParamInt32, &NDPluginOverlayRed);
    createParam(NDPluginOverlayGreenString,         asynParamInt32, &NDPluginOverlayGreen);
    createParam(NDPluginOverlayBlueString,          asynParamInt32, &NDPluginOverlayBlue);
    createParam(NDPluginOverlayTimeStampFormatString, asynParamOctet, &NDPluginOverlayTimeStampFormat);
    createParam(NDPluginOverlayFontString,          asynParamInt32, &NDPluginOverlayFont);
    createParam(NDPluginOverlayDisplayTextString,   asynParamOctet, &NDPluginOverlayDisplayText);      

    /* Set the plugin type string */
    setStringParam(NDPluginDriverPluginType, "NDPluginOverlay");

    /* Try to connect to the array port */
    connectToArrayPort();
}
Пример #10
0
/** Constructor for NDPluginEdge; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
 * After calling the base class constructor this method sets reasonable default values for all of the
 * parameters.
 * \param[in] portName The name of the asyn port driver to be created.
 * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
 *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
 *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
 * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
 *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
 *            of the driver doing the callbacks.
 * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
 * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
 * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
 *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
 * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
 *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
 * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
 * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
 */
NDPluginEdge::NDPluginEdge(const char *portName, int queueSize, int blockingCallbacks,
    const char *NDArrayPort, int NDArrayAddr,
    int maxBuffers, size_t maxMemory,
    int priority, int stackSize)
  /* Invoke the base class constructor */
  : NDPluginDriver(portName, queueSize, blockingCallbacks,
      NDArrayPort, NDArrayAddr, 1, maxBuffers, maxMemory,
      asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
      asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
      0, 1, priority, stackSize, 1)
{
  char versionString[20];
  //static const char *functionName = "NDPluginEdge";

  createParam( NDPluginEdgeLowThresholdString,     asynParamFloat64,  &NDPluginEdgeLowThreshold);
  createParam( NDPluginEdgeThresholdRatioString,   asynParamFloat64,  &NDPluginEdgeThresholdRatio);
  createParam( NDPluginEdgeVerticalFoundString,    asynParamInt32,    &NDPluginEdgeVerticalFound);
  createParam( NDPluginEdgeTopEdgeFoundString,     asynParamInt32,    &NDPluginEdgeTopEdgeFound);
  createParam( NDPluginEdgeTopPixelString,         asynParamInt32,    &NDPluginEdgeTopPixel);
  createParam( NDPluginEdgeBottomEdgeFoundString,  asynParamInt32,    &NDPluginEdgeBottomEdgeFound);
  createParam( NDPluginEdgeBottomPixelString,      asynParamInt32,    &NDPluginEdgeBottomPixel);
  createParam( NDPluginEdgeVerticalCenterString,   asynParamFloat64,  &NDPluginEdgeVerticalCenter);
  createParam( NDPluginEdgeVerticalSizeString,     asynParamInt32,    &NDPluginEdgeVerticalSize);
  createParam( NDPluginEdgeHorizontalFoundString,  asynParamInt32,    &NDPluginEdgeHorizontalFound);
  createParam( NDPluginEdgeLeftEdgeFoundString,    asynParamInt32,    &NDPluginEdgeLeftEdgeFound);
  createParam( NDPluginEdgeLeftPixelString,        asynParamInt32,    &NDPluginEdgeLeftPixel);
  createParam( NDPluginEdgeRightEdgeFoundString,   asynParamInt32,    &NDPluginEdgeRightEdgeFound);
  createParam( NDPluginEdgeRightPixelString,       asynParamInt32,    &NDPluginEdgeRightPixel);
  createParam( NDPluginEdgeHorizontalCenterString, asynParamFloat64,  &NDPluginEdgeHorizontalCenter);
  createParam( NDPluginEdgeHorizontalSizeString,   asynParamInt32,    &NDPluginEdgeHorizontalSize);


  /* Set the plugin type string */
  setStringParam(NDPluginDriverPluginType, "NDPluginEdge");

  epicsSnprintf(versionString, sizeof(versionString), "%d.%d.%d",
      EDGE_VERSION, EDGE_REVISION, EDGE_MODIFICATION);
  setStringParam(NDDriverVersion, versionString);

  /* Try to connect to the array port */
  connectToArrayPort();
}
Пример #11
0
/** Constructor for NDPluginFastCCD; most parameters are simply passed to NDPluginDriver::NDPluginDriver.

  * After calling the base class constructor this method sets reasonable default values for all of the
  * ROI parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxOverlays The maximum number ofoverlays this plugin supports. 1 is minimum.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginFastCCD::NDPluginFastCCD(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr, 
                         int maxBuffers, size_t maxMemory,
                         int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_NDPLUGIN_FASTCCD_PARAMS, 
                   maxBuffers, maxMemory,
                   asynGenericPointerMask,
                   asynGenericPointerMask,
                   ASYN_MULTIDEVICE, 1, priority, stackSize)
{
    //static const char *functionName = "NDPluginFastCCD";


    createParam(NDPluginFastCCDOffset0String,    asynParamInt32,  &NDPluginFastCCDOffset0);
    createParam(NDPluginFastCCDOffset1String,    asynParamInt32,  &NDPluginFastCCDOffset1);
    createParam(NDPluginFastCCDOffset2String,    asynParamInt32,  &NDPluginFastCCDOffset2);
    createParam(NDPluginFastCCDDPValString,      asynParamInt32,  &NDPluginFastCCDDPVal);
    createParam(NDPluginFastCCDEnableString,     asynParamInt32,  &NDPluginFastCCDEnable);
    createParam(NDPluginFastCCDEnableDataString, asynParamInt32,  &NDPluginFastCCDEnableData);

    int offset = 0x1000;

    setIntegerParam(NDPluginFastCCDOffset0, offset);
    setIntegerParam(NDPluginFastCCDOffset1, offset);
    setIntegerParam(NDPluginFastCCDOffset2, offset);
    setIntegerParam(NDPluginFastCCDDPVal, offset);
    setIntegerParam(NDPluginFastCCDEnable, 0);
    setIntegerParam(NDPluginFastCCDEnableData, 0);

    /* Set the plugin type string */
    setStringParam(NDPluginDriverPluginType, "NDPluginFastCCD");

    /* Call Parameter Callbacks */
    callParamCallbacks();

    /* Try to connect to the array port */
    connectToArrayPort();
}
/** Constructor for NDPluginEdge; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * After calling the base class constructor this method sets reasonable default values for all of the
  * parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginEdge::NDPluginEdge(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr,
                         int maxBuffers, size_t maxMemory,
                         int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_NDPLUGIN_EDGE_PARAMS, maxBuffers, maxMemory,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   ASYN_MULTIDEVICE, 1, priority, stackSize)
{
   //static const char *functionName = "NDPluginEdge";
    
  createParam( NDPluginEdgeLowThresholdString,     asynParamFloat64,  &NDPluginEdgeLowThreshold);
  createParam( NDPluginEdgeThresholdRatioString,   asynParamFloat64,  &NDPluginEdgeThresholdRatio);
  createParam( NDPluginEdgeVerticalFoundString,    asynParamInt32,    &NDPluginEdgeVerticalFound);
  createParam( NDPluginEdgeTopEdgeFoundString,     asynParamInt32,    &NDPluginEdgeTopEdgeFound);
  createParam( NDPluginEdgeTopPixelString,         asynParamInt32,    &NDPluginEdgeTopPixel);
  createParam( NDPluginEdgeBottomEdgeFoundString,  asynParamInt32,    &NDPluginEdgeBottomEdgeFound);
  createParam( NDPluginEdgeBottomPixelString,      asynParamInt32,    &NDPluginEdgeBottomPixel);
  createParam( NDPluginEdgeVerticalCenterString,   asynParamFloat64,  &NDPluginEdgeVerticalCenter);
  createParam( NDPluginEdgeVerticalSizeString,     asynParamInt32,    &NDPluginEdgeVerticalSize);
  createParam( NDPluginEdgeHorizontalFoundString,  asynParamInt32,    &NDPluginEdgeHorizontalFound);
  createParam( NDPluginEdgeLeftEdgeFoundString,    asynParamInt32,    &NDPluginEdgeLeftEdgeFound);
  createParam( NDPluginEdgeLeftPixelString,        asynParamInt32,    &NDPluginEdgeLeftPixel);
  createParam( NDPluginEdgeRightEdgeFoundString,   asynParamInt32,    &NDPluginEdgeRightEdgeFound);
  createParam( NDPluginEdgeRightPixelString,       asynParamInt32,    &NDPluginEdgeRightPixel);
  createParam( NDPluginEdgeHorizontalCenterString, asynParamFloat64,  &NDPluginEdgeHorizontalCenter);
  createParam( NDPluginEdgeHorizontalSizeString,   asynParamInt32,    &NDPluginEdgeHorizontalSize);
  
  
  /* Set the plugin type string */
  setStringParam(NDPluginDriverPluginType, "NDPluginEdge");
  
  /* Try to connect to the array port */
  connectToArrayPort();
}
Пример #13
0
/** Constructor for NDPluginROIStat; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * After calling the base class constructor this method sets reasonable default values for all of the
  * ROI parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxROIs The maximum number of ROIs this plugin supports. 1 is minimum.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginROIStat::NDPluginROIStat(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr, int maxROIs,
                         int maxBuffers, size_t maxMemory,
                         int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
             NDArrayPort, NDArrayAddr, maxROIs, NUM_NDPLUGIN_ROISTAT_PARAMS, maxBuffers, maxMemory,
             asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
             asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
             ASYN_MULTIDEVICE, 1, priority, stackSize)
{
  const char *functionName = "NDPluginROIStat::NDPluginROIStat";

  if (maxROIs < 1) {
    maxROIs = 1;
  }
  maxROIs_ = maxROIs;
  pROIs_ = new NDROI[maxROIs];
  if(!pROIs_) {cantProceed(functionName);}
  
  /* ROI general parameters */
  createParam(NDPluginROIStatFirstString,             asynParamInt32, &NDPluginROIStatFirst);
  createParam(NDPluginROIStatNameString,              asynParamOctet, &NDPluginROIStatName);
  createParam(NDPluginROIStatUseString,               asynParamInt32, &NDPluginROIStatUse);
  createParam(NDPluginROIStatResetString,             asynParamInt32, &NDPluginROIStatReset);
  createParam(NDPluginROIStatResetAllString,          asynParamInt32, &NDPluginROIStatResetAll);
  createParam(NDPluginROIStatBgdWidthString,          asynParamInt32, &NDPluginROIStatBgdWidth);
  
  /* ROI definition */
  createParam(NDPluginROIStatDim0MinString,           asynParamInt32, &NDPluginROIStatDim0Min);
  createParam(NDPluginROIStatDim0SizeString,          asynParamInt32, &NDPluginROIStatDim0Size);
  createParam(NDPluginROIStatDim0MaxSizeString,       asynParamInt32, &NDPluginROIStatDim0MaxSize);
  createParam(NDPluginROIStatDim1MinString,           asynParamInt32, &NDPluginROIStatDim1Min);
  createParam(NDPluginROIStatDim1SizeString,          asynParamInt32, &NDPluginROIStatDim1Size);
  createParam(NDPluginROIStatDim1MaxSizeString,       asynParamInt32, &NDPluginROIStatDim1MaxSize);
  createParam(NDPluginROIStatDim2MinString,           asynParamInt32, &NDPluginROIStatDim2Min);
  createParam(NDPluginROIStatDim2SizeString,          asynParamInt32, &NDPluginROIStatDim2Size);
  createParam(NDPluginROIStatDim2MaxSizeString,       asynParamInt32, &NDPluginROIStatDim2MaxSize);
  
  /* ROI statistics */
  createParam(NDPluginROIStatMinValueString,          asynParamFloat64, &NDPluginROIStatMinValue);
  createParam(NDPluginROIStatMaxValueString,          asynParamFloat64, &NDPluginROIStatMaxValue);
  createParam(NDPluginROIStatMeanValueString,         asynParamFloat64, &NDPluginROIStatMeanValue);
  createParam(NDPluginROIStatTotalString,             asynParamFloat64, &NDPluginROIStatTotal);
  createParam(NDPluginROIStatNetString,               asynParamFloat64, &NDPluginROIStatNet);

  /* Time series arrays */
  createParam(NDPluginROIStatTSControlString,           asynParamInt32, &NDPluginROIStatTSControl);
  createParam(NDPluginROIStatTSNumPointsString,         asynParamInt32, &NDPluginROIStatTSNumPoints);
  createParam(NDPluginROIStatTSCurrentPointString,      asynParamInt32, &NDPluginROIStatTSCurrentPoint);
  createParam(NDPluginROIStatTSAcquiringString,         asynParamInt32, &NDPluginROIStatTSAcquiring);
  createParam(NDPluginROIStatTSMinValueString,   asynParamFloat64Array, &NDPluginROIStatTSMinValue);
  createParam(NDPluginROIStatTSMaxValueString,   asynParamFloat64Array, &NDPluginROIStatTSMaxValue);
  createParam(NDPluginROIStatTSMeanValueString,  asynParamFloat64Array, &NDPluginROIStatTSMeanValue);
  createParam(NDPluginROIStatTSTotalString,      asynParamFloat64Array, &NDPluginROIStatTSTotal);
  createParam(NDPluginROIStatTSNetString,        asynParamFloat64Array, &NDPluginROIStatTSNet);
  createParam(NDPluginROIStatTSTimestampString,  asynParamFloat64Array, &NDPluginROIStatTSTimestamp);

  createParam(NDPluginROIStatLastString,              asynParamInt32, &NDPluginROIStatLast);
  
  //Note: params set to a default value here will overwrite a default database value

  /* Set the plugin type string */
  setStringParam(NDPluginDriverPluginType, "NDPluginROIStat");
  
  for (int roi=0; roi<maxROIs_; ++roi) {
    
    setIntegerParam(roi , NDPluginROIStatFirst,             0);
    setIntegerParam(roi , NDPluginROIStatLast,              0);

    setStringParam (roi,  NDPluginROIStatName,              "");
    setIntegerParam(roi , NDPluginROIStatUse,               0);
    
    setIntegerParam(roi , NDPluginROIStatDim0Min,           0);
    setIntegerParam(roi , NDPluginROIStatDim0Size,          0);
    setIntegerParam(roi , NDPluginROIStatDim0MaxSize,       0);
    setIntegerParam(roi , NDPluginROIStatDim1Min,           0);
    setIntegerParam(roi , NDPluginROIStatDim1Size,          0);
    setIntegerParam(roi , NDPluginROIStatDim1MaxSize,       0);
    setIntegerParam(roi , NDPluginROIStatDim2Min,           0);
    setIntegerParam(roi , NDPluginROIStatDim2Size,          0);
    setIntegerParam(roi , NDPluginROIStatDim2MaxSize,       0);
    
    setDoubleParam (roi , NDPluginROIStatMinValue,          0.0);
    setDoubleParam (roi , NDPluginROIStatMaxValue,          0.0);
    setDoubleParam (roi , NDPluginROIStatMeanValue,         0.0);
    setDoubleParam (roi , NDPluginROIStatTotal,             0.0);
    setDoubleParam (roi , NDPluginROIStatNet,               0.0);
    callParamCallbacks(roi);
  }

  numTSPoints_ = DEFAULT_NUM_TSPOINTS;
  setIntegerParam(NDPluginROIStatTSNumPoints, numTSPoints_);
  timeSeries_ = (double *)calloc(MAX_TIME_SERIES_TYPES*maxROIs_*numTSPoints_, sizeof(double));
  
  /* Try to connect to the array port */
  connectToArrayPort();

  callParamCallbacks();
  
}
Пример #14
0
/** Constructor for NDPluginCircularBuff; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * After calling the base class constructor this method sets reasonable default values for all of the
  * parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginCircularBuff::NDPluginCircularBuff(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr,
                         int maxBuffers, size_t maxMemory,
                         int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, maxBuffers, maxMemory,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   0, 1, priority, stackSize, 1), pOldArray_(NULL)
{
    //const char *functionName = "NDPluginCircularBuff";
    preBuffer_ = NULL;

    maxBuffers_ = maxBuffers;

    // Scope
    createParam(NDCircBuffControlString,            asynParamInt32,      &NDCircBuffControl);
    createParam(NDCircBuffStatusString,             asynParamOctet,      &NDCircBuffStatus);
    createParam(NDCircBuffTriggerAString,           asynParamOctet,      &NDCircBuffTriggerA);
    createParam(NDCircBuffTriggerBString,           asynParamOctet,      &NDCircBuffTriggerB);
    createParam(NDCircBuffTriggerAValString,        asynParamFloat64,    &NDCircBuffTriggerAVal);
    createParam(NDCircBuffTriggerBValString,        asynParamFloat64,    &NDCircBuffTriggerBVal);
    createParam(NDCircBuffTriggerCalcString,        asynParamOctet,      &NDCircBuffTriggerCalc);
    createParam(NDCircBuffTriggerCalcValString,     asynParamFloat64,    &NDCircBuffTriggerCalcVal);
    createParam(NDCircBuffPresetTriggerCountString, asynParamInt32,      &NDCircBuffPresetTriggerCount);
    createParam(NDCircBuffActualTriggerCountString, asynParamInt32,      &NDCircBuffActualTriggerCount);
    createParam(NDCircBuffPreTriggerString,         asynParamInt32,      &NDCircBuffPreTrigger);
    createParam(NDCircBuffPostTriggerString,        asynParamInt32,      &NDCircBuffPostTrigger);
    createParam(NDCircBuffCurrentImageString,       asynParamInt32,      &NDCircBuffCurrentImage);
    createParam(NDCircBuffPostCountString,          asynParamInt32,      &NDCircBuffPostCount);
    createParam(NDCircBuffSoftTriggerString,        asynParamInt32,      &NDCircBuffSoftTrigger);
    createParam(NDCircBuffTriggeredString,          asynParamInt32,      &NDCircBuffTriggered);

    // Set the plugin type string
    setStringParam(NDPluginDriverPluginType, "NDPluginCircularBuff");

    // Set the status to idle
    setStringParam(NDCircBuffStatus, "Idle");

    // Init the current frame count to zero
    setIntegerParam(NDCircBuffCurrentImage, 0);
    setIntegerParam(NDCircBuffPostCount, 0);

    // Init the scope control to off
    setIntegerParam(NDCircBuffControl, 0);

    // Init the pre and post count to 100
    setIntegerParam(NDCircBuffPreTrigger, 100);
    setIntegerParam(NDCircBuffPostTrigger, 100);
    
    // Init the preset trigger count to 1
    setIntegerParam(NDCircBuffPresetTriggerCount, 1);
    setIntegerParam(NDCircBuffActualTriggerCount, 0);
    
    // Enable ArrayCallbacks.  
    // This plugin currently ignores this setting and always does callbacks, so make the setting reflect the behavior
    setIntegerParam(NDArrayCallbacks, 1);

    // Try to connect to the array port
    connectToArrayPort();
}
Пример #15
0
/** Constructor for NDPluginStats; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * After calling the base class constructor this method sets reasonable default values for all of the
  * parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginStats::NDPluginStats(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr,
                         int maxBuffers, size_t maxMemory,
                         int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_NDPLUGIN_STATS_PARAMS, maxBuffers, maxMemory,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   0, 1, priority, stackSize)
{
    int numTSPoints=256;  // Initial size of time series
    int i;
    //const char *functionName = "NDPluginStats";
    
    /* Statistics */
    createParam(NDPluginStatsComputeStatisticsString, asynParamInt32,      &NDPluginStatsComputeStatistics);
    createParam(NDPluginStatsBgdWidthString,          asynParamInt32,      &NDPluginStatsBgdWidth);
    createParam(NDPluginStatsMinValueString,          asynParamFloat64,    &NDPluginStatsMinValue);
    createParam(NDPluginStatsMinXString,              asynParamFloat64,    &NDPluginStatsMinX);
    createParam(NDPluginStatsMinYString,              asynParamFloat64,    &NDPluginStatsMinY);            
    createParam(NDPluginStatsMaxValueString,          asynParamFloat64,    &NDPluginStatsMaxValue);
    createParam(NDPluginStatsMaxXString,              asynParamFloat64,    &NDPluginStatsMaxX);
    createParam(NDPluginStatsMaxYString,              asynParamFloat64,    &NDPluginStatsMaxY);                
    createParam(NDPluginStatsMeanValueString,         asynParamFloat64,    &NDPluginStatsMeanValue);
    createParam(NDPluginStatsSigmaValueString,        asynParamFloat64,    &NDPluginStatsSigmaValue);
    createParam(NDPluginStatsTotalString,             asynParamFloat64,    &NDPluginStatsTotal);
    createParam(NDPluginStatsNetString,               asynParamFloat64,    &NDPluginStatsNet);

    /* Centroid */
    createParam(NDPluginStatsComputeCentroidString,   asynParamInt32,      &NDPluginStatsComputeCentroid);
    createParam(NDPluginStatsCentroidThresholdString, asynParamFloat64,    &NDPluginStatsCentroidThreshold);
    createParam(NDPluginStatsCentroidXString,         asynParamFloat64,    &NDPluginStatsCentroidX);
    createParam(NDPluginStatsCentroidYString,         asynParamFloat64,    &NDPluginStatsCentroidY);
    createParam(NDPluginStatsSigmaXString,            asynParamFloat64,    &NDPluginStatsSigmaX);
    createParam(NDPluginStatsSigmaYString,            asynParamFloat64,    &NDPluginStatsSigmaY);
    createParam(NDPluginStatsSigmaXYString,           asynParamFloat64,    &NDPluginStatsSigmaXY);

    /* Time series */
    createParam(NDPluginStatsTSControlString,         asynParamInt32,        &NDPluginStatsTSControl);
    createParam(NDPluginStatsTSNumPointsString,       asynParamInt32,        &NDPluginStatsTSNumPoints);
    createParam(NDPluginStatsTSCurrentPointString,    asynParamInt32,        &NDPluginStatsTSCurrentPoint);
    createParam(NDPluginStatsTSAcquiringString,       asynParamInt32,        &NDPluginStatsTSAcquiring);
    createParam(NDPluginStatsTSMinValueString,        asynParamFloat64Array, &NDPluginStatsTSMinValue);
    createParam(NDPluginStatsTSMinXString,            asynParamFloat64Array, &NDPluginStatsTSMinX);
    createParam(NDPluginStatsTSMinYString,            asynParamFloat64Array, &NDPluginStatsTSMinY);            
    createParam(NDPluginStatsTSMaxValueString,        asynParamFloat64Array, &NDPluginStatsTSMaxValue);
    createParam(NDPluginStatsTSMaxXString,            asynParamFloat64Array, &NDPluginStatsTSMaxX);
    createParam(NDPluginStatsTSMaxYString,            asynParamFloat64Array, &NDPluginStatsTSMaxY);                
    createParam(NDPluginStatsTSMeanValueString,       asynParamFloat64Array, &NDPluginStatsTSMeanValue);
    createParam(NDPluginStatsTSSigmaValueString,      asynParamFloat64Array, &NDPluginStatsTSSigmaValue);
    createParam(NDPluginStatsTSTotalString,           asynParamFloat64Array, &NDPluginStatsTSTotal);
    createParam(NDPluginStatsTSNetString,             asynParamFloat64Array, &NDPluginStatsTSNet);
    createParam(NDPluginStatsTSCentroidXString,       asynParamFloat64Array, &NDPluginStatsTSCentroidX);
    createParam(NDPluginStatsTSCentroidYString,       asynParamFloat64Array, &NDPluginStatsTSCentroidY);
    createParam(NDPluginStatsTSSigmaXString,          asynParamFloat64Array, &NDPluginStatsTSSigmaX);
    createParam(NDPluginStatsTSSigmaYString,          asynParamFloat64Array, &NDPluginStatsTSSigmaY);
    createParam(NDPluginStatsTSSigmaXYString,         asynParamFloat64Array, &NDPluginStatsTSSigmaXY);

    /* Profiles */
    createParam(NDPluginStatsComputeProfilesString,   asynParamInt32,         &NDPluginStatsComputeProfiles);
    createParam(NDPluginStatsProfileSizeXString,      asynParamInt32,         &NDPluginStatsProfileSizeX);
    createParam(NDPluginStatsProfileSizeYString,      asynParamInt32,         &NDPluginStatsProfileSizeY);
    createParam(NDPluginStatsCursorXString,           asynParamInt32,         &NDPluginStatsCursorX);
    createParam(NDPluginStatsCursorYString,           asynParamInt32,         &NDPluginStatsCursorY);
    createParam(NDPluginStatsProfileAverageXString,   asynParamFloat64Array,  &NDPluginStatsProfileAverageX);
    createParam(NDPluginStatsProfileAverageYString,   asynParamFloat64Array,  &NDPluginStatsProfileAverageY);
    createParam(NDPluginStatsProfileThresholdXString, asynParamFloat64Array,  &NDPluginStatsProfileThresholdX);
    createParam(NDPluginStatsProfileThresholdYString, asynParamFloat64Array,  &NDPluginStatsProfileThresholdY);
    createParam(NDPluginStatsProfileCentroidXString,  asynParamFloat64Array,  &NDPluginStatsProfileCentroidX);
    createParam(NDPluginStatsProfileCentroidYString,  asynParamFloat64Array,  &NDPluginStatsProfileCentroidY);
    createParam(NDPluginStatsProfileCursorXString,    asynParamFloat64Array,  &NDPluginStatsProfileCursorX);
    createParam(NDPluginStatsProfileCursorYString,    asynParamFloat64Array,  &NDPluginStatsProfileCursorY);

    /* Histogram */
    createParam(NDPluginStatsComputeHistogramString,  asynParamInt32,         &NDPluginStatsComputeHistogram);
    createParam(NDPluginStatsHistSizeString,          asynParamInt32,         &NDPluginStatsHistSize);
    createParam(NDPluginStatsHistMinString,           asynParamFloat64,       &NDPluginStatsHistMin);
    createParam(NDPluginStatsHistMaxString,           asynParamFloat64,       &NDPluginStatsHistMax);
    createParam(NDPluginStatsHistEntropyString,       asynParamFloat64,       &NDPluginStatsHistEntropy);
    createParam(NDPluginStatsHistArrayString,         asynParamFloat64Array,  &NDPluginStatsHistArray);

    memset(this->profileX, 0, sizeof(this->profileX));
    memset(this->profileY, 0, sizeof(this->profileY));
    // If we uncomment the following line then we can't set numTSPoints from database at initialisation
    //setIntegerParam(NDPluginStatsTSNumPoints, numTSPoints);
    setIntegerParam(NDPluginStatsTSAcquiring, 0);
    setIntegerParam(NDPluginStatsTSCurrentPoint, 0);
    for (i=0; i<MAX_TIME_SERIES_TYPES; i++) {
        timeSeries[i] = (double *)calloc(numTSPoints, sizeof(double));
    }
    this->histogram = NULL;

    /* Set the plugin type string */
    setStringParam(NDPluginDriverPluginType, "NDPluginStats");

    /* Try to connect to the array port */
    connectToArrayPort();
}
Пример #16
0
/** Constructor for NDPluginDLL; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * After calling the base class constructor this method sets reasonable default values for all of the
  * Transform parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginDLL::NDPluginDLL(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr, int maxBuffers, size_t maxMemory,
                         int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, 1024, maxBuffers, maxMemory,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   ASYN_MULTIDEVICE, 1, priority, stackSize)
{
    asynStatus status;
    const char *functionName = "NDPluginDLL";
    int ii, jj;

    int dims[2];
    HMODULE hMod;
	OBJMAKER makeControllerObjects;
	int gg;
	int_string *params;





	// map the params from asyn assign param to the enumerated param in the dll.

	mapAsyn2DLL = new std::map<int,int>;
	mapDLL2Asyn = new std::map<int,int>;

 dims[0] =1024;
    dims[1] = 1024;
    this->pRaw = this->pNDArrayPool->alloc(2, dims, NDUInt16, 0, NULL);

	printf("Made NDArray, X = %i  Y = %i Type = %i \n",1024, 1024,3);

	printf("Image data pointer = %i \n", (long)(pRaw->pData));


	hMod = LoadLibrary (dll_name);
	if (NULL == hMod)
	{
		printf("Load DLL failed\n");
			exit(0);
	}

	 makeControllerObjects = (OBJMAKER) GetProcAddress (hMod, "makeControllerObjects");
	if (NULL == makeControllerObjects)
	{
		long erx=GetLastError();
		printf("Cannot get Proc Address. Error= %i\n",erx);
	}

	makeControllerObjects(
		(int*)&num_controllers,
		(genCamController*)controllers,
		(void*)madSimCallback,
		&(this->pRaw->pData));



	printf("Controllers Found: %i \n",num_controllers);


	madSimPtr=this;
			// start threads per object
//	for (int k = 0; k<num_controllers; k++)
//	{
//		Sleep(2000);
//		madSimCallback(genCamControllerEnum::make_new_thread,controllers[k]);
//	}


	//
	// get param lists from the DLL and make all params.
	//
	int asyn_param;
	int enum_param;
	int ptype;
	int nparam;

	for (int k = 0; k<num_controllers; k++)
	{
		params=controllers[k]->getCompleteParamIntStrArray();
		nparam=controllers[k]->getTotalNumParams();

		for (int pp=0;pp<nparam;pp++)
		{
			if (pp==12)
				trapHere();

			enum_param=params[pp].x;
			ptype= controllers[k]->getParamType(enum_param);

			switch(ptype)
			{

				case putGetParameters::paramInt:
					createParam(params[pp].str,asynParamInt32,&asyn_param);
					(*mapAsyn2DLL)[asyn_param] = params[pp].x;
					(*mapDLL2Asyn)[params[pp].x] = asyn_param;


					break;

				case putGetParameters::paramDouble:
					createParam(params[pp].str,asynParamFloat64,&asyn_param);
					(*mapAsyn2DLL)[asyn_param] = params[pp].x;
					(*mapDLL2Asyn)[params[pp].x] = asyn_param;
				break;

				case putGetParameters::paramString:
					createParam(params[pp].str,asynParamOctet,&asyn_param);
					(*mapAsyn2DLL)[asyn_param] = params[pp].x;
					(*mapDLL2Asyn)[params[pp].x] = asyn_param;
				break;

				case putGetParameters::paramPtr:
					createParam(params[pp].str,asynParamInt32,&asyn_param);
					(*mapAsyn2DLL)[asyn_param] = params[pp].x;
					(*mapDLL2Asyn)[params[pp].x] = asyn_param;

				break;

				default:
					printf("ERROR: NDPluginDLL::NDPluginDLL: Create Undef Param\n");
				break;


			}

		}
	// copy ALL parameters from detector to this local Area Detector object
	//so EPICS can relect what detector is doing.
	lock();
	copyParamsFromDet(0);
	callParamCallbacks();
	unlock();


	}
//    createParam(NDPluginDLLNameString,         asynParamOctet, &NDPluginDLLName);
//    createParam(NDPluginDLL1TypeString,        asynParamInt32, &NDPluginDLL1Type);

    /* Set the plugin type string */
//    setStringParam(NDPluginDriverPluginType, "NDPluginDLL");
//    setStringParam(NDPluginDLLName, "");
//    setIntegerParam(NDPluginDLL1Type, 0);


	NDArrayDataPub=NDArrayData;

    /* Try to connect to the array port */
    status = connectToArrayPort();
}
Пример #17
0
/** Constructor for NDPluginProcess; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
  * After calling the base class constructor this method sets reasonable default values for all of the
  * parameters.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPluginProcess::NDPluginProcess(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr,
                         int maxBuffers, size_t maxMemory,
                         int priority, int stackSize)
    /* Invoke the base class constructor */
    : NDPluginDriver(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_NDPLUGIN_PROCESS_PARAMS, maxBuffers, maxMemory,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
                   ASYN_MULTIDEVICE, 1, priority, stackSize)
{
    //static const char *functionName = "NDPluginProcess";

    /* Background array subtraction */
    createParam(NDPluginProcessSaveBackgroundString,    asynParamInt32,     &NDPluginProcessSaveBackground);
    createParam(NDPluginProcessEnableBackgroundString,  asynParamInt32,     &NDPluginProcessEnableBackground);
    createParam(NDPluginProcessValidBackgroundString,   asynParamInt32,     &NDPluginProcessValidBackground);

    /* Flat field normalization */
    createParam(NDPluginProcessSaveFlatFieldString,     asynParamInt32,     &NDPluginProcessSaveFlatField);
    createParam(NDPluginProcessEnableFlatFieldString,   asynParamInt32,     &NDPluginProcessEnableFlatField);
    createParam(NDPluginProcessValidFlatFieldString,    asynParamInt32,     &NDPluginProcessValidFlatField);
    createParam(NDPluginProcessScaleFlatFieldString,    asynParamFloat64,   &NDPluginProcessScaleFlatField);

    /* High and low clipping */
    createParam(NDPluginProcessLowClipString,           asynParamFloat64,   &NDPluginProcessLowClip);
    createParam(NDPluginProcessEnableLowClipString,     asynParamInt32,     &NDPluginProcessEnableLowClip);
    createParam(NDPluginProcessHighClipString,          asynParamFloat64,   &NDPluginProcessHighClip);
    createParam(NDPluginProcessEnableHighClipString,    asynParamInt32,     &NDPluginProcessEnableHighClip);

    /* Scale and offset */
    createParam(NDPluginProcessEnableOffsetScaleString, asynParamInt32,     &NDPluginProcessEnableOffsetScale);
    createParam(NDPluginProcessAutoOffsetScaleString,   asynParamInt32,     &NDPluginProcessAutoOffsetScale);
    createParam(NDPluginProcessScaleString,             asynParamFloat64,   &NDPluginProcessScale);
    createParam(NDPluginProcessOffsetString,            asynParamFloat64,   &NDPluginProcessOffset);

    /* Frame filtering */
    createParam(NDPluginProcessEnableFilterString,      asynParamInt32,     &NDPluginProcessEnableFilter);
    createParam(NDPluginProcessResetFilterString,       asynParamInt32,     &NDPluginProcessResetFilter);
    createParam(NDPluginProcessAutoResetFilterString,   asynParamInt32,     &NDPluginProcessAutoResetFilter);
    createParam(NDPluginProcessFilterCallbacksString,   asynParamInt32,     &NDPluginProcessFilterCallbacks);
    createParam(NDPluginProcessNumFilterString,         asynParamInt32,     &NDPluginProcessNumFilter);
    createParam(NDPluginProcessNumFilteredString,       asynParamInt32,     &NDPluginProcessNumFiltered);   
    createParam(NDPluginProcessOOffsetString,           asynParamFloat64,   &NDPluginProcessOOffset);   
    createParam(NDPluginProcessOScaleString,            asynParamFloat64,   &NDPluginProcessOScale);   
    createParam(NDPluginProcessOC1String,               asynParamFloat64,   &NDPluginProcessOC1);   
    createParam(NDPluginProcessOC2String,               asynParamFloat64,   &NDPluginProcessOC2);   
    createParam(NDPluginProcessOC3String,               asynParamFloat64,   &NDPluginProcessOC3);   
    createParam(NDPluginProcessOC4String,               asynParamFloat64,   &NDPluginProcessOC4);   
    createParam(NDPluginProcessFOffsetString,           asynParamFloat64,   &NDPluginProcessFOffset);   
    createParam(NDPluginProcessFScaleString,            asynParamFloat64,   &NDPluginProcessFScale);   
    createParam(NDPluginProcessFC1String,               asynParamFloat64,   &NDPluginProcessFC1);   
    createParam(NDPluginProcessFC2String,               asynParamFloat64,   &NDPluginProcessFC2);   
    createParam(NDPluginProcessFC3String,               asynParamFloat64,   &NDPluginProcessFC3);   
    createParam(NDPluginProcessFC4String,               asynParamFloat64,   &NDPluginProcessFC4);   
    createParam(NDPluginProcessROffsetString,           asynParamFloat64,   &NDPluginProcessROffset);   
    createParam(NDPluginProcessRC1String,               asynParamFloat64,   &NDPluginProcessRC1);   
    createParam(NDPluginProcessRC2String,               asynParamFloat64,   &NDPluginProcessRC2);   
    
    /* Output data type */
    createParam(NDPluginProcessDataTypeString,          asynParamInt32,     &NDPluginProcessDataType);   

    this->pBackground = NULL;
    this->pFlatField  = NULL;
    this->pFilter     = NULL;
    setIntegerParam(NDPluginProcessValidBackground, 0);
    setIntegerParam(NDPluginProcessValidFlatField, 0);
    setIntegerParam(NDPluginProcessAutoOffsetScale, 0);

    /* Set the plugin type string */
    setStringParam(NDPluginDriverPluginType, "NDPluginProcess");

    // Enable ArrayCallbacks.  
    // This plugin currently ignores this setting and always does callbacks, so make the setting reflect the behavior
    setIntegerParam(NDArrayCallbacks, 1);

    /* Try to connect to the array port */
    connectToArrayPort();
}
Пример #18
0
/** Constructor for the NDPosPlugin class.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when 
  *            NDPluginDriverBlockingCallbacks=0.  Larger queues can decrease the number of dropped arrays,
  *            at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
  * \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
  *            0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
  *            of the driver doing the callbacks.
  * \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
  * \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
  * \param[in] maxBuffers The maximum number of buffers that the NDArrayPool for this driver is 
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of buffers.
  * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is 
  *            allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
  * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
  */
NDPosPlugin::NDPosPlugin(const char *portName,
                         int queueSize,
                         int blockingCallbacks,
                         const char *NDArrayPort,
                         int NDArrayAddr,
                         int maxBuffers,
                         size_t maxMemory,
                         int priority,
                         int stackSize)
  : NDPluginDriver(portName,
                   queueSize,
                   blockingCallbacks,
                   NDArrayPort,
                   NDArrayAddr,
                   1,
                   NUM_NDPOS_PARAMS,
                   maxBuffers,
                   maxMemory,
                   asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
                   asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
                   ASYN_MULTIDEVICE,
                   1,
                   priority,
                   stackSize)
{
  //static const char *functionName = "NDPluginAttribute::NDPluginAttribute";

  // Create parameters for controlling the plugin
  createParam(str_NDPos_Filename,        asynParamOctet,        &NDPos_Filename);
  createParam(str_NDPos_FileValid,       asynParamInt32,        &NDPos_FileValid);
  createParam(str_NDPos_Clear,           asynParamInt32,        &NDPos_Clear);
  createParam(str_NDPos_Running,         asynParamInt32,        &NDPos_Running);
  createParam(str_NDPos_Restart,         asynParamInt32,        &NDPos_Restart);
  createParam(str_NDPos_Delete,          asynParamInt32,        &NDPos_Delete);
  createParam(str_NDPos_Mode,            asynParamInt32,        &NDPos_Mode);
  createParam(str_NDPos_Append,          asynParamInt32,        &NDPos_Append);
  createParam(str_NDPos_CurrentQty,      asynParamInt32,        &NDPos_CurrentQty);
  createParam(str_NDPos_CurrentIndex,    asynParamInt32,        &NDPos_CurrentIndex);
  createParam(str_NDPos_CurrentPos,      asynParamOctet,        &NDPos_CurrentPos);
  createParam(str_NDPos_MissingFrames,   asynParamInt32,        &NDPos_MissingFrames);
  createParam(str_NDPos_DuplicateFrames, asynParamInt32,        &NDPos_DuplicateFrames);
  createParam(str_NDPos_ExpectedID,      asynParamInt32,        &NDPos_ExpectedID);
  createParam(str_NDPos_IDName,          asynParamOctet,        &NDPos_IDName);
  createParam(str_NDPos_IDDifference,    asynParamInt32,        &NDPos_IDDifference);
  createParam(str_NDPos_IDStart,         asynParamInt32,        &NDPos_IDStart);

  // Set the plugin type string
  setStringParam(NDPluginDriverPluginType, "NDPositionPlugin");
  // Set the mode to 0 - Discard after use
  setIntegerParam(NDPos_Mode,              MODE_DISCARD);
  // Set the file valid to 0
  setIntegerParam(NDPos_FileValid,         0);
  // Set the position index to 0
  setIntegerParam(NDPos_CurrentIndex,      0);
  // Set the qty to 0
  setIntegerParam(NDPos_CurrentQty,        0);
  // Set the position string to empty
  setStringParam(NDPos_CurrentPos,         "");
  // Set running to 0
  setIntegerParam(NDPos_Running,           NDPOS_IDLE);
  // Set the ID Name to the default UniqueID
  setStringParam(NDPos_IDName,             "");
  // Set the ID Difference to a default of 1
  setIntegerParam(NDPos_IDDifference,      1);
  // Set the ID Start value to a default of 1
  setIntegerParam(NDPos_IDStart,           1);
  // Set the Expected next ID value to 1
  setIntegerParam(NDPos_ExpectedID,        1);
  // Set the duplicate frames to 0
  setIntegerParam(NDPos_MissingFrames,     0);
  // Set the missing frames to 0
  setIntegerParam(NDPos_DuplicateFrames,   0);

  // Try to connect to the array port
  connectToArrayPort();

}