void omsMAXvEncFunc::initialize()
{
    const char* functionName = "initialize";

    Debug(5, "omsMAXvEncFunc::initialize: start initialize\n" );

    int encIndex = numAxes;
    if (encIndex > MAXENCFUNC) encIndex = MAXENCFUNC;

    /* auxiliary encoders */
    for (int i=0; i < encIndex; ++i){
        if (createParam(i, motorEncoderFunctionString, asynParamInt32, &encFuncIndex[i]) != asynSuccess)
                errlogPrintf("%s:%s:%s: unable to create param motorEncoderFunctionString, index %d\n",
                              driverName, functionName, portName, i);
        if (createParam(i, motorEncoderRawPosString, asynParamFloat64, &encRawPosIndex[i]) != asynSuccess)
                errlogPrintf("%s:%s:%s: unable to create param motorEncoderRawPosString, index %d\n",
                              driverName, functionName, portName, i);
    }
    createParam(0, motorAuxEncoderPositionString, asynParamFloat64, &encPosIndex[0]);
    createParam(1, motorAuxEncoderPositionString, asynParamFloat64, &encPosIndex[1]);
    Debug(3, "omsMAXvEncFunc::initialize: auxiliary encoder 0 position index %d\n", encPosIndex[0] );
    Debug(3, "omsMAXvEncFunc::initialize: auxiliary encoder 1 position index %d\n", encPosIndex[1] );
    for (int i=0; i < encIndex; ++i) Debug(3, "omsMAXvEncFunc::initialize: encFuncIndex %d => %d\n", i, encFuncIndex[i] );
    lock();
    for (int i=0; i < encIndex; ++i){
        setIntegerParam(i, encFuncIndex[i], 0);
        setDoubleParam(i, encRawPosIndex[i], 0.0);
    }
    setDoubleParam(0, encPosIndex[0], 0.0);
    setDoubleParam(1, encPosIndex[1], 0.0);
    for (int i=0; i < encIndex; ++i) {
        callParamCallbacks(i, i);
    }
    unlock();
}
/// Constructor for the isisdaeDriver class.
/// Calls constructor for the asynPortDriver base class.
/// \param[in] dcomint DCOM interface pointer created by lvDCOMConfigure()
/// \param[in] portName @copydoc initArg0
daedataDriver::daedataDriver(const char *portName, const char* host) 
   : asynPortDriver(portName, 
                    0, /* maxAddr */ 
                    NUM_ISISDAE_PARAMS,
                    asynInt32Mask | asynInt32ArrayMask | asynDrvUserMask, /* Interface mask */
                    asynInt32Mask | asynInt32ArrayMask,  /* Interrupt mask */
                    ASYN_CANBLOCK , /* asynFlags.  This driver can block but it is not multi-device */
                    1, /* Autoconnect */
                    0, /* Default priority */
                    0)	/* Default stack size*/					
{
    const char *functionName = "daedataDriver";
//	epicsThreadOnce(&onceId, initCOM, NULL);

	m_udp = new DAEDataUDP(host);

	createParam(P_SVN_VERSIONString, asynParamInt32, &P_SVN_VERSION);
	createParam(P_FIRMWARE_VERSIONString, asynParamInt32, &P_FIRMWARE_VERSION);
	createParam(P_CHANNEL_POSITIONString, asynParamInt32Array, &P_CHANNEL_POSITION);

    // Create the thread for background tasks (not used at present, could be used for I/O intr scanning) 
    if (epicsThreadCreate("isisdaePoller",
                          epicsThreadPriorityMedium,
                          epicsThreadGetStackSize(epicsThreadStackMedium),
                          (EPICSTHREADFUNC)pollerThreadC, this) == 0)
    {
        printf("%s:%s: epicsThreadCreate failure\n", driverName, functionName);
        return;
    }
}
////////////////////////////////////////////////////////
//! @ImsMDrivePlusMotorController()
//! Constructor
//! Driver assumes only 1 axis configured per controller for now...
//!
//! @param[in] motorPortName     Name assigned to the port created to communicate with the motor
//! @param[in] IOPortName        Name assigned to the asyn IO port, name that was assigned in drvAsynIPPortConfigure()
//! @param[in] devName           Name of device (DN) assigned to motor axis in MCode, the device name is prepended to the MCode command to support Party Mode (PY) multidrop communication setup
//!                              set to empty string "" if no device name needed/not using Party Mode
//! @param[in] movingPollPeriod  Moving polling period in milliseconds
//! @param[in] idlePollPeriod    Idle polling period in milliseconds
////////////////////////////////////////////////////////
ImsMDrivePlusMotorController::ImsMDrivePlusMotorController(const char *motorPortName, const char *IOPortName, const char *devName, double movingPollPeriod, double idlePollPeriod)
    : asynMotorController(motorPortName, NUM_AXES, NUM_IMS_PARAMS,
						  asynInt32Mask | asynFloat64Mask | asynUInt32DigitalMask,
						  asynInt32Mask | asynFloat64Mask | asynUInt32DigitalMask,
						  ASYN_CANBLOCK | ASYN_MULTIDEVICE,
						  1, // autoconnect
						  0, 0),  // Default priority and stack size
    pAsynUserIMS(0)
{
	static const char *functionName = "ImsMDrivePlusMotorController()";
	asynStatus status;
	ImsMDrivePlusMotorAxis *pAxis;
	// asynMotorController constructor calloc's memory for array of axis pointers
	pAxes_ = (ImsMDrivePlusMotorAxis **)(asynMotorController::pAxes_);

	// copy names
	strcpy(motorName, motorPortName);

	// setup communication
	status = pasynOctetSyncIO->connect(IOPortName, 0, &pAsynUserIMS, NULL);
	if (status != asynSuccess) {
		printf("\n\n%s:%s: ERROR connecting to Controller's IO port=%s\n\n", DRIVER_NAME, functionName, IOPortName);
		// TODO would be good to implement exceptions
		// TODO THROW_(SmarActMCSException(MCSConnectionError, "SmarActMCSController: unable to connect serial channel"));
	}

	// write version, cannot use asynPrint() in constructor since controller (motorPortName) hasn't been created yet
	printf("%s:%s: motorPortName=%s, IOPortName=%s, devName=%s \n", DRIVER_NAME, functionName, motorPortName, IOPortName, devName);


	// init
	pasynOctetSyncIO->setInputEos(pAsynUserIMS, "\n", 1);
	pasynOctetSyncIO->setOutputEos(pAsynUserIMS, "\r\n", 2); 

	// Create controller-specific parameters
	createParam(ImsMDrivePlusSaveToNVMControlString, asynParamInt32, &ImsMDrivePlusSaveToNVM_);
	createParam(ImsMDrivePlusLoadMCodeControlString, asynParamOctet, &this->ImsMDrivePlusLoadMCode_);
	createParam(ImsMDrivePlusClearMCodeControlString, asynParamOctet, &this->ImsMDrivePlusClearMCode_);

	// Check the validity of the arguments and init controller object
	initController(devName, movingPollPeriod, idlePollPeriod);

	// Create axis
	// Assuming single axis per controller the way drvAsynIPPortConfigure( "M06", "ts-b34-nw08:2101", 0, 0 0 ) is called in st.cmd script
	pAxis = new ImsMDrivePlusMotorAxis(this, 0);
	pAxis = NULL;  // asynMotorController constructor tracking array of axis pointers

	// read home and limit config from S1-S4
	readHomeAndLimitConfig();

	startPoller(movingPollPeriod, idlePollPeriod, 2);
}
/** 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();

}
Beispiel #5
0
////////////////////////////////
// ecSdoAsyn constructor
ecSdoAsyn::ecSdoAsyn(char * sdoport, ecAsyn * parent):
    asynPortDriver(sdoport,
                   1,           // maxAddr
                   parent->sdos * 3, // max parameters
                   asynInt32Mask | asynDrvUserMask, /* interface mask */
                   asynInt32Mask, /* interrupt mask */
                   0,  /* ASYN_CANBLOCK=0, non blocking, no addresses */
                   1, /* autoconnect */
                   0, /* default priority */
                   0) /* default stack size */,
    paramrecords(new sdo_paramrecord_t * [parent->sdos]),
    parent(parent)
{
    printf("ecSdoAsyn INIT name ");
    assert(parent->sdos > 0);
    EC_SDO_ENTRY * sdoentry = (EC_SDO_ENTRY *)ellFirst(&parent->device->sdo_requests);
    int n = 0;
    while (sdoentry)
    {
        assert(n < parent->sdos);
        printf("createParam %s, %s_stat, %s_trig\n",
               sdoentry->asynparameter,
               sdoentry->asynparameter,
               sdoentry->asynparameter);
        sdo_paramrecord_t * paramrecord = (sdo_paramrecord_t *)calloc(1,sizeof(sdo_paramrecord_t));
        char *status_name = format("%s_stat", sdoentry->asynparameter);
        char *trigger_name = format("%s_trig", sdoentry->asynparameter);
        assert(createParam(sdoentry->asynparameter, asynParamInt32,
                           &paramrecord->param_val) == asynSuccess);
        assert(createParam(status_name, asynParamInt32,
                           &paramrecord->param_stat) == asynSuccess);
        assert(createParam(trigger_name, asynParamInt32,
                           &paramrecord->param_trig) == asynSuccess);
        free(status_name); free(trigger_name);
        paramrecord->sdoentry = sdoentry;

        sdoentry->param_val = paramrecord->param_val;
        sdoentry->param_stat = paramrecord->param_stat;
        sdoentry->param_trig = paramrecord->param_trig;
        paramrecords[n] = paramrecord;
        n++;
        sdoentry =  (EC_SDO_ENTRY *)ellNext(&sdoentry->node);
        // check assumption that the parameters increase by one
        // needed for parameter "normalization" in getSdoentry
        assert(paramrecord->param_val + 1 == paramrecord->param_stat);
        assert(paramrecord->param_val + 2 == paramrecord->param_trig);
    }
}
/** 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();

}
Beispiel #7
0
// Create one parameter for an outlined function
// return the created parameter
SgInitializedName* createOneFunctionParameter(const SgInitializedName* i_name, 
					      bool readOnly, 
					      SgFunctionDeclaration* func)
			
{
  ROSE_ASSERT (i_name);
  ROSE_ASSERT (func);
  SgFunctionParameterList* params = func->get_parameterList ();
  ROSE_ASSERT (params);
  SgFunctionDefinition* def = func->get_definition ();
  ROSE_ASSERT (def);

  // It handles language-specific details internally, like pass-by-value, pass-by-reference
  // name and type is not enough, need the SgInitializedName also for tell 
  // if an array comes from a parameter list
  OutlinedFuncParam_t param = createParam (i_name,readOnly);
 
  SgName p_sg_name (param.first.c_str ());
  // name, type, declaration, scope, 
  // TODO function definition's declaration should not be passed to createInitName()
  SgInitializedName* p_init_name = createInitName (param.first, param.second, def->get_declaration(), def);

  ROSE_ASSERT (p_init_name);
  prependArg(params,p_init_name);
  return p_init_name;
}
Beispiel #8
0
//////////////////////////////////////////////////////////////////////////////////////////////////
//																								//
//	void CLeyboldSimPortDriver::addIOPort(const char* IOPortName)								//
//																								//
//	Description:																				//
//		Called once (from LeyboldSimAddIOPort) for each pump,									//
//		in response to the st.cmd startup script.												//
//		Adds a pump, and the parameters to support it, to the configuration.					//
//																								//
//////////////////////////////////////////////////////////////////////////////////////////////////
void CLeyboldSimPortDriver::addIOPort(const char* IOPortName)
{
	epicsGuard < epicsMutex > guard ( CLeyboldSimPortDriver::m_Mutex );
	for (size_t ParamIndex = 0; ParamIndex < size_t(NUM_PARAMS); ParamIndex++)
	{
		if (ParameterDefns[ParamIndex].m_UseCase == NotForSim)
			// Not implemented, because not meaningful for the simulater.
			continue;
		if (ParameterDefns[ParamIndex].m_UseCase == Single)
			// Single instance parameter
			continue;

		createParam(m_asynUsers.size(), ParamIndex);
	}
	setDefaultValues(m_asynUsers.size());
	setIntegerParam(m_asynUsers.size(), FAULT, 0);

    asynUser *asynUser = pasynManager->createAsynUser(0,0);
	m_TableLookup[IOPortName] = m_asynUsers.size();
	m_asynUsers.push_back(asynUser);

	asynStatus Status = pasynManager->connectDevice(asynUser, IOPortName, int(m_asynUsers.size()));
    if (Status != asynSuccess)
		throw CException(asynUser, Status, __FUNCTION__, "connectDevice" + std::string(IOPortName));

    asynInterface* pasynOctetInterface = pasynManager->findInterface(asynUser, asynOctetType, 1);

	asynOctet* Octet = (asynOctet*)pasynOctetInterface->pinterface;
	void      *pinterruptNode;

	Octet->registerInterruptUser(pasynOctetInterface->drvPvt, asynUser, octetConnectionCallback, this, &pinterruptNode);
}
Beispiel #9
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();
}
/** Constructor for NDFileJPEG; all parameters are simply passed to NDPluginFile::NDPluginFile.
  * \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] 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.
  */
NDFileJPEG::NDFileJPEG(const char *portName, int queueSize, int blockingCallbacks,
                       const char *NDArrayPort, int NDArrayAddr,
                       int priority, int stackSize)
    /* Invoke the base class constructor.
     * We allocate 2 NDArrays 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. */
    : NDPluginFile(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_NDFILE_JPEG_PARAMS,
                   2, 0, asynGenericPointerMask, asynGenericPointerMask, 
                   ASYN_CANBLOCK, 1, priority, stackSize)
{
    //static const char *functionName = "NDFileJPEG";

    createParam(NDFileJPEGQualityString, asynParamInt32, &NDFileJPEGQuality);
    
    jpeg_create_compress(&this->jpegInfo);
    this->jpegInfo.err = jpeg_std_error(&this->jpegErr);

    /* Note: we don't use the built-in stdio routines, because this does not work when using
     * the prebuilt library and either VC++ or g++ on Windows.  The FILE pointers are wrong
     * when doing that.  Rather we implement our own jpeg_destination_mgr structure and handle
     * the I/O ourselves.  The code we use is almost a direct copy from jdatadst.c in the standard
     * package. */
    this->destMgr.pub.init_destination = init_destination;
    this->destMgr.pub.empty_output_buffer = empty_output_buffer;
    this->destMgr.pub.term_destination = term_destination;
    this->destMgr.pNDFileJPEG = this;
    this->jpegInfo.dest = (jpeg_destination_mgr *) &this->destMgr;

    /* Set the plugin type string */    
    setStringParam(NDPluginDriverPluginType, "NDFileJPEG");
    this->supportsMultipleArrays = 0;
    setIntegerParam(NDFileJPEGQuality, 50);
}
/** 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();
}
Beispiel #12
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 the FileList class.
/// Calls constructor for the asynPortDriver base class.
FileList::FileList(const char *portName, const char *searchDir, const char *searchPat, int fullPath) 
   : asynPortDriver(portName, 
                    4, /* maxAddr */ 
                    NUM_FileList_PARAMS,
					asynInt32Mask | asynOctetMask | asynDrvUserMask | asynFloat64Mask, /* Interface mask */
                    asynInt32Mask | asynOctetMask | asynFloat64Mask,  /* Interrupt mask */
                    0, /* asynFlags.  This driver can block but it is not multi-device */
                    1, /* Autoconnect */
                    0, /* Default priority */
                    0)	/* Default stack size*/,
	watchQueue_(10, sizeof(char *)), m_fullPath(fullPath != 0 ? true : false)
{
	int status = asynSuccess;
    const char *functionName = "FileList";

	createParam(P_DirBaseString, asynParamOctet, &P_DirBase);
	createParam(P_SearchString, asynParamOctet, &P_Search);
	createParam(P_CaseString, asynParamInt32, &P_CaseSensitive);
	createParam(P_JSONArrString, asynParamOctet, &P_JSONOutArr);

	//Allocate column data
	pJSONOut_ = (char *)calloc(OUT_CHAR_LIM, 1);

	setStringParam(P_DirBase, searchDir);
	setStringParam(P_Search, searchPat);
	setIntegerParam(P_CaseSensitive, 0);
	updateList();

	// Start filewatcher
	char * str = strdup(searchDir);
	watchQueue_.send((void*)&str, sizeof(char*));

	/* Do callbacks so higher layers see any changes */
	status |= (asynStatus)callParamCallbacks();

	// Create the thread that will service the file watcher
	// To write to the controller
	epicsThreadCreate("fileWatcher", 
                    epicsThreadPriorityMax,
                    epicsThreadGetStackSize(epicsThreadStackMedium),
                    (EPICSTHREADFUNC)fileWatcherThreadC, (void *)this);
	if (status) {
		std::cerr << status << "epicsThreadCreate failure" << std::endl;
		return;
	}

}
Beispiel #14
0
int main()
{
	Param_t * param = createParam(); //Create new Parameter
	param = stringtokenizer(param); //get commands and tokenize

	deleteParam(param);
	return 0;
}
Beispiel #15
0
ecMaster::ecMaster(char * name) :
    asynPortDriver(name,
                   1, /* maxAddr */
                   NUM_MASTER_PARAMS, /* max parameters */
                   asynInt32Mask | asynDrvUserMask, /* interface mask*/
                   asynInt32Mask, /* interrupt mask */
                   0, /* non-blocking, no addresses */
                   1, /* autoconnect */
                   0, /* default priority */
                   0) /* default stack size */,
    lastCycle(0), missed(0)
{
    printf("create master %s\n", name);
    createParam("Cycle", asynParamInt32, &P_Cycle);
    createParam("WorkingCounter", asynParamInt32, &P_WorkingCounter);
    createParam("Missed", asynParamInt32, &P_Missed);
    createParam("WcState", asynParamInt32, &P_WcState);
}
Beispiel #16
0
/** Constructor for the USB1608G class
  */
USB1608G::USB1608G(const char *portName, int boardNum)
  : asynPortDriver(portName, MAX_SIGNALS, NUM_PARAMS, 
      asynInt32Mask | asynUInt32DigitalMask | asynDrvUserMask,  // Interfaces that we implement
                      asynUInt32DigitalMask,                    // Interfaces that do callbacks
      ASYN_MULTIDEVICE | ASYN_CANBLOCK, 1, /* ASYN_CANBLOCK=1, ASYN_MULTIDEVICE=1, autoConnect=1 */
      0, 0),  /* Default priority and stack size */
    boardNum_(boardNum)
{
  // Analog output parameters
  createParam(analogOutValueString,            asynParamInt32, &analogOutValue_);

  // Analog input parameters
  createParam(analogInValueString,             asynParamInt32, &analogInValue_);
  createParam(analogInRangeString,             asynParamInt32, &analogInRange_);
  
  // Digital I/O parameters
  createParam(digitalDirectionString,  asynParamUInt32Digital, &digitalDirection_);
  createParam(digitalOutputString,     asynParamUInt32Digital, &digitalOutput_);
}
Beispiel #17
0
void DynamicParamManager::createParam(
    DynamicParamId dynamicParamId,
    const TupleAttributeDescriptor &attrDesc,
    bool failIfExists)
{
    StrictMutexGuard mutexGuard(mutex);

    SharedDynamicParam param(new DynamicParam(attrDesc));
    createParam(dynamicParamId, param, failIfExists);
}
Beispiel #18
0
//-----------------------------------------------------------------------------
// 描述: 根据名称返回对应的参数对象,若无则返回NULL
//-----------------------------------------------------------------------------
DbParam* DbParamList::paramByName(const string& name)
{
    DbParam *result = findParam(name);
    if (!result)
    {
        result = createParam(name, 0);
        items_.add(result);
    }

    return result;
}
Beispiel #19
0
//-----------------------------------------------------------------------------
// 描述: 根据序号(1-based)返回对应的参数对象,若无则返回NULL
//-----------------------------------------------------------------------------
DbParam* DbParamList::paramByNumber(int number)
{
    DbParam *result = findParam(number);
    if (!result)
    {
        result = createParam("", number);
        items_.add(result);
    }

    return result;
}
/** Constructor for ffmpegFile; all parameters are simply passed to NDPluginFile::NDPluginFile.
ffmpegFileConfigure() should be used to create an instance in the iocsh.
See ffmpegStream.template for more details of usage.

  * \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] 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.
  */
ffmpegFile::ffmpegFile(const char *portName, int queueSize, int blockingCallbacks,
                       const char *NDArrayPort, int NDArrayAddr,
                       int priority, int stackSize)
    /* Invoke the base class constructor.
     * We allocate 2 NDArrays 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 can be 0, which will use defaults. 
     * We require a minimum stacksize of 128k for windows-x64 */
    : NDPluginFile(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1,
                   2, 0, asynGenericPointerMask, asynGenericPointerMask,
                   ASYN_CANBLOCK, 1, priority, stackSize < 128000 ? 128000 : stackSize, 1)
{
    //const char *functionName = "ffmpegFile";

    createParam(ffmpegFileBitrateString, asynParamFloat64, &ffmpegFileBitrate);
    createParam(ffmpegFileFPSString,     asynParamInt32,   &ffmpegFileFPS);
    createParam(ffmpegFileHeightString,  asynParamInt32,   &ffmpegFileHeight);
    createParam(ffmpegFileWidthString,   asynParamInt32,   &ffmpegFileWidth);

    /* Set the plugin type string */    
    setStringParam(NDPluginDriverPluginType, "ffmpegFile");
    this->supportsMultipleArrays = 0;
    
    /* Initialise the ffmpeg library */
    ffmpegInitialise();

    this->ctx = NULL;
    this->outFile = NULL;
    this->codec = NULL;
    this->c = NULL;
    this->inPicture = NULL;
    this->scPicture = NULL;    
    this->scArray = NULL;
    this->outArray = NULL;
    this->ctx = NULL;      
    this->fmt = NULL;
    this->oc = NULL;
    this->video_st = NULL;    
    
}
sampleChanger::sampleChanger(const char *portName, const char* fileName, int dims=2) 
   : asynPortDriver(portName, 
                    0, /* maxAddr */ 
                    NUM_MSP_PARAMS, /* num parameters */
                    asynInt32Mask | asynFloat64Mask | asynOctetMask | asynDrvUserMask, /* Interface mask */
                    asynInt32Mask | asynFloat64Mask | asynOctetMask,  /* Interrupt mask */
                    ASYN_CANBLOCK, /* asynFlags.  This driver can block but it is not multi-device */
                    1, /* Autoconnect */
                    0,
                    0), m_fileName(fileName), m_outval(1.0)
{
    createParam(P_recalcString, asynParamOctet, &P_recalc);  
    createParam(P_outvalString, asynParamFloat64, &P_outval);  

	// initial values
    setDoubleParam(P_outval, m_outval);
	
	// set dims. Default should be 2. Only 1 and 2 are currently supported
	m_dims = dims;
	if ( m_dims!=1 ) m_dims = 2;
}
Beispiel #22
0
/** Constructor for NDFileMagick; all parameters are simply passed to NDPluginFile::NDPluginFile.
  * \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] 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.
  */
NDFileMagick::NDFileMagick(const char *portName, int queueSize, int blockingCallbacks,
                           const char *NDArrayPort, int NDArrayAddr,
                           int priority, int stackSize)
    /* Invoke the base class constructor.
     * We allocate 2 NDArrays 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. */
    : NDPluginFile(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_NDFILE_MAGICK_PARAMS,
                   2, 0, asynGenericPointerMask, asynGenericPointerMask, 
                   ASYN_CANBLOCK, 1, priority, stackSize)
{
    //static const char *functionName = "NDFileMagick";

    /* Set the plugin type string */    
    setStringParam(NDPluginDriverPluginType, "NDFileMagick");
    this->supportsMultipleArrays = 0;
    
    createParam(NDFileMagickQualityString,       asynParamInt32, &NDFileMagickQuality);
    createParam(NDFileMagickCompressTypeString,  asynParamInt32, &NDFileMagickCompressType);
    createParam(NDFileMagickBitDepthString,      asynParamInt32, &NDFileMagickBitDepth);
}
Beispiel #23
0
/** Constructor for NDFileNexus; all parameters are simply passed to NDPluginFile::NDPluginFile.
  * \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] 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.
  */
NDFileNexus::NDFileNexus(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr,
                         int priority, int stackSize)
  /* Invoke the base class constructor.
   * We allocate 2 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. */
  : NDPluginFile(portName, queueSize, blockingCallbacks,
                 NDArrayPort, NDArrayAddr, 1, NUM_NDFILE_NEXUS_PARAMS,
                 2, 0, asynGenericPointerMask, asynGenericPointerMask,
                 ASYN_CANBLOCK, 1, priority, stackSize)
{
  //static const char *functionName = "NDFileNexus";
  createParam(NDFileNexusTemplatePathString,  asynParamOctet, &NDFileNexusTemplatePath);
  createParam(NDFileNexusTemplateFileString,  asynParamOctet, &NDFileNexusTemplateFile);
  createParam(NDFileNexusTemplateValidString, asynParamInt32, &NDFileNexusTemplateValid);

  this->pFileAttributes = new NDAttributeList;
  this->imageNumber = 0;
  setIntegerParam(NDFileNexusTemplateValid, 0);

  this->supportsMultipleArrays = 1;
}
Beispiel #24
0
void ddriveController::createDDParam(const char *cmd, const char *param_str, asynParamType type, 
                                     int *param_idx, bool query, bool global, bool service_mode, int service_param) {
  static int i=0;
  createParam(param_str, type, param_idx);
  ddparams_[i].asyn_param = param_str;
  ddparams_[i].command = cmd;
  ddparams_[i].type = type;
  ddparams_[i].query = query;
  ddparams_[i].global = global;
  ddparams_[i].idx = *param_idx;
  ddparams_[i].service_mode = service_mode;
  ddparams_[i].service_param = service_param;
  printf("Parameter %s is index %d\n", cmd, *param_idx);
  i++;
}
Beispiel #25
0
/// XFCPort constructor
XFCPort::XFCPort(const char * name) : asynPortDriver(
        name,
        1, /* maxAddr */
        1, /* max parameters */
        asynInt32Mask | asynDrvUserMask, /* interface mask*/
        asynInt32Mask, /* interrupt mask */
        0, /* non-blocking, no addresses */
        1, /* autoconnect */
        0, /* default priority */
        0) /* default stack size */
{
    printf("Creating XFCPort \"%s\"\n", name);
    createParam("MISSED", asynParamInt32, &P_Missed);
    setIntegerParam(P_Missed, 0);
}
/** Constructor for the testArrayRingBuffer class.
  * Calls constructor for the asynPortDriver base class.
  * \param[in] portName The name of the asyn port driver to be created.
  * \param[in] maxArrayLength The maximum  number of points in the volt and time arrays */
testArrayRingBuffer::testArrayRingBuffer(const char *portName, int maxArrayLength) 
   : asynPortDriver(portName, 
                    1, /* maxAddr */ 
                    (int)NUM_PARAMS,
                    asynInt32Mask | asynFloat64Mask | asynInt32ArrayMask | asynDrvUserMask, /* Interface mask */
                    asynInt32Mask | asynFloat64Mask | asynInt32ArrayMask,                   /* Interrupt mask */
                    0, /* asynFlags.  This driver does not block and it is not multi-device, so flag is 0 */
                    1, /* Autoconnect */
                    0, /* Default priority */
                    0) /* Default stack size*/    
{
    asynStatus status;
    const char *functionName = "testArrayRingBuffer";

    /* Make sure maxArrayLength is positive */
    if (maxArrayLength < 1) maxArrayLength = 10;
    
    /* Allocate the waveform array */
    pData_ = (epicsInt32 *)calloc(maxArrayLength, sizeof(epicsInt32));
    
    eventId_ = epicsEventCreate(epicsEventEmpty);
    createParam(P_RunStopString,            asynParamInt32,         &P_RunStop);
    createParam(P_MaxArrayLengthString,     asynParamInt32,         &P_MaxArrayLength);
    createParam(P_ArrayLengthString,        asynParamInt32,         &P_ArrayLength);
    createParam(P_LoopDelayString,          asynParamFloat64,       &P_LoopDelay);
    createParam(P_BurstLengthString,        asynParamInt32,         &P_BurstLength);
    createParam(P_BurstDelayString,         asynParamFloat64,       &P_BurstDelay);
    createParam(P_ScalarDataString,         asynParamInt32,         &P_ScalarData);
    createParam(P_ArrayDataString,          asynParamInt32Array,    &P_ArrayData);
    
    /* Set the initial values of some parameters */
    setIntegerParam(P_MaxArrayLength,    maxArrayLength);
    setIntegerParam(P_ArrayLength,       maxArrayLength);
    
    /* Create the thread that does the array callbacks in the background */
    status = (asynStatus)(epicsThreadCreate("testArrayRingBufferTask",
                          epicsThreadPriorityMedium,
                          epicsThreadGetStackSize(epicsThreadStackMedium),
                          (EPICSTHREADFUNC)::arrayGenTaskC,
                          this) == NULL);
    if (status) {
        printf("%s::%s: epicsThreadCreate failure\n", driverName, functionName);
        return;
    }
}
Beispiel #27
0
 const cfgPropertyStruct CFGManager::getOrCreateProperty(const string &_group,
                                                         const string &_name,
                                                         const string &val,
                                                         CFGClient *newClient) {
   cfgPropertyStruct newProp;
   newProp.propertyType = stringProperty;
   newProp.propertyIndex = 0;
   newProp.sValue = val;
   if(getPropertyValue(_group, _name, "value", &newProp.sValue)) {
     newProp.paramId = getParamId(_group, _name);
   } else {
     newProp.paramId = createParam(_group, _name, stringParam);
     setProperty(newProp);
   }
   if(newClient) {
     registerToParam(newProp.paramId, newClient);
   }
   return newProp;
 }
Beispiel #28
0
void DynamicParamManager::createCounterParam(
    DynamicParamId dynamicParamId,
    bool failIfExists)
{
    StrictMutexGuard mutexGuard(mutex);

    StandardTypeDescriptorFactory stdTypeFactory;
    TupleAttributeDescriptor attrDesc(
        stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
    SharedDynamicParam param(new DynamicParam(attrDesc, true));
    createParam(dynamicParamId, param, failIfExists);

    // initialize the parameter to zero
    PBuffer buf = param->pBuffer.get();
    int64_t *pCounter = reinterpret_cast<int64_t *>(buf);
    *pCounter = 0;
    param->datum.pData = buf;
    param->datum.cbData = sizeof(int64_t);
}
/** Constructor for NDFileFITS; all parameters are simply passed to NDPluginFile::NDPluginFile.
  * \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] 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.
  */
NDFileFITS::NDFileFITS(const char *portName, int queueSize, int blockingCallbacks,
                       const char *NDArrayPort, int NDArrayAddr,
                       int priority, int stackSize)
    /* Invoke the base class constructor.
     * We allocate 2 NDArrays 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. */
    : NDPluginFile(portName, queueSize, blockingCallbacks,
                   NDArrayPort, NDArrayAddr, 1, NUM_NDFILE_FITS_PARAMS,
                   2, 0, asynGenericPointerMask, asynGenericPointerMask, 
                   ASYN_CANBLOCK, 1, priority, stackSize)
{
    //static const char *functionName = "NDFileFITS";
    createParam(NDFITSFileHeaderFullPathnameString,   asynParamOctet,   &NDFITSFileHeaderFullPathname);
    
    // Set the plugin type string
    setStringParam(NDPluginDriverPluginType, "NDFileFITS");
    
    setStringParam(NDFITSFileHeaderFullPathname, ".\\FitsHeaderParameters.txt"); 
}
Beispiel #30
0
 void Server::initialise(tinyxml2::XMLHandle & handle)
 {
   static bool first = true;
   if (!singleton_server_)
   {
     name_ = handle.ToElement()->Attribute("name");
     std::string ns = name_;
   }
   tinyxml2::XMLHandle param_handle(handle.FirstChildElement("Parameters"));
   tinyxml2::XMLHandle tmp_handle = param_handle.FirstChild();
   while (tmp_handle.ToElement())
   {
     createParam(name_, tmp_handle);
     tmp_handle = tmp_handle.NextSibling();
   }
   if (first)
   {
     HIGHLIGHT_NAMED(name_, "EXOTica Server Initialised");
     first = false;
   }
 }