本文整理汇总了C++中createParam函数的典型用法代码示例。如果您正苦于以下问题:C++ createParam函数的具体用法?C++ createParam怎么用?C++ createParam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createParam函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Debug
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();
}
示例2: asynPortDriver
/// 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;
}
}
示例3: asynMotorController
////////////////////////////////////////////////////////
//! @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);
}
示例4: NDPluginDriver
/** 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();
}
示例5: asynPortDriver
////////////////////////////////
// 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,
¶mrecord->param_val) == asynSuccess);
assert(createParam(status_name, asynParamInt32,
¶mrecord->param_stat) == asynSuccess);
assert(createParam(trigger_name, asynParamInt32,
¶mrecord->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);
}
}
示例6: NDPluginDriver
/** 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();
}
示例7: createOneFunctionParameter
// 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;
}
示例8: guard
//////////////////////////////////////////////////////////////////////////////////////////////////
// //
// 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);
}
示例9: NDPluginDriver
/** 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();
}
示例10: NDPluginFile
/** 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);
}
示例11: NDPluginDriver
/** 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();
}
示例12: NDPluginDriver
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();
}
示例13: asynPortDriver
/// 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;
}
}
示例14: main
int main()
{
Param_t * param = createParam(); //Create new Parameter
param = stringtokenizer(param); //get commands and tokenize
deleteParam(param);
return 0;
}
示例15: asynPortDriver
/** 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_);
}