• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setStringParam函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setStringParam函数的典型用法代码示例。如果您正苦于以下问题:C++ setStringParam函数的具体用法?C++ setStringParam怎么用?C++ setStringParam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setStringParam函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setIntegerParam

/** Base method for closing a file
  * Calls the pure virtual function closeFile in the derived class. */
asynStatus NDPluginFile::closeFileBase()
{
    /* Closes a file */
    asynStatus status = asynSuccess;
    char errorMessage[256];
    const char* functionName = "closeFileBase";

    setIntegerParam(NDFileWriteStatus, NDFileWriteOK);
    setStringParam(NDFileWriteMessage, "");
     /* Call the closeFile method in the derived class */
    epicsMutexLock(this->fileMutexId);
    status = this->closeFile();
    if (status) {
        epicsSnprintf(errorMessage, sizeof(errorMessage)-1, 
            "Error closing file, status=%d", status);
        asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, 
              "%s:%s %s\n", 
              driverName, functionName, errorMessage);
        setIntegerParam(NDFileWriteStatus, NDFileWriteError);
        setStringParam(NDFileWriteMessage, errorMessage);
    }
    epicsMutexUnlock(this->fileMutexId);
    
    return(status);
}
开发者ID:NSLS-II-CSX,项目名称:xf23id1-ioc1,代码行数:27,代码来源:NDPluginFile.cpp


示例2: 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();
}
开发者ID:dhickin,项目名称:ADPvAccess,代码行数:34,代码来源:adPvaServer.cpp


示例3: setIntegerParam

void HXPController::postError(HXPAxis *pAxis, int status)
{
  /* This is similar to what is done in HXPAxis::move() */
  if (status < 0)
  {
    /* Set the error */
    setIntegerParam(HXPError_, status);
    
    /* Get the error string */
    HXPErrorStringGet(pAxis->moveSocket_, status, pAxis->errorDescFull_);
    
    /* Trim the error string */
    strncpy(pAxis->errorDesc_, pAxis->errorDescFull_, 39);
    pAxis->errorDesc_[39] = 0;
    
    /* Set the error description */
    setStringParam(HXPErrorDesc_, pAxis->errorDesc_);
  }
  else
  {
    /* Clear the error */
    setIntegerParam(HXPError_, 0);
    setStringParam(HXPErrorDesc_, "");
  }
  callParamCallbacks();

  return;
}
开发者ID:Brudhu,项目名称:motor,代码行数:28,代码来源:HXPDriver.cpp


示例4: acquireBlockLocks

int acquireBlockLocks(char* serviceName, int servicePort, char* fileName,
                      int numLocks, int64_t startBlocks[], int64_t lengths[]) {
    int i;
    int lockID;

    MessageClient client = newClient(serviceName, servicePort);

    Message m = newMessage();
    m->type = FILE_LOCK_CLIENT_SERVICE_CLIENT_MESSAGE;
    setStringParam(m, "functionName", "acquireblock");
    setStringParam(m, "fileName", fileName);
    setIntegerParam(m, "numLocks", numLocks);
    
    createLongArrayParam(m, "startblocks", numLocks);
    createLongArrayParam(m, "lengths", numLocks);
    
    for (i = 0; i < numLocks; ++i) {
        setLongArrayParamValue(m, "startblocks", i, startBlocks[i]);
        setLongArrayParamValue(m, "lengths", i, lengths[i]);
    }

    //printf("acquireblocklocks: Message to be sent:\n");
    //printMessage(m);

    Message reply = clientCall(client, m);
    clientDisconnect(client);
    //printf("acquirelocks: Reply:\n");
    //printMessage(reply);
    lockID = getIntegerParam(reply, "lockID");

    destroyMessage(m);
    destroyMessage(reply);

    return lockID;
}
开发者ID:gkthiruvathukal,项目名称:st-hec,代码行数:35,代码来源:lockserverapi.c


示例5: getAddress

/** Sets an int32 parameter.
  * \param[in] pasynUser asynUser structure that contains the function code in pasynUser->reason. 
  * \param[in] value The value for this parameter 
  *
  * Takes action if the function code requires it.
  */
asynStatus NDPosPlugin::writeInt32(asynUser *pasynUser, epicsInt32 value)
{
  int function = pasynUser->reason;
  int oldvalue;
  int addr;
  asynStatus status = asynSuccess;
  static const char *functionName = "NDPosPlugin::writeInt32";

  // Set the parameter in the parameter library.
  status = getAddress(pasynUser, &addr);
  if (status == asynSuccess){
    getIntegerParam(function, &oldvalue);

    // By default we set the value in the parameter library. If problems occur we set the old value back.
    setIntegerParam(function, value);

    if (function == NDPos_Running){
      // Reset the expected ID to the starting value
      int expected = 0;
      getIntegerParam(NDPos_IDStart, &expected);
      setIntegerParam(NDPos_ExpectedID, expected);
    } else if (function == NDPos_Mode){
      // Reset the position index to 0 if the mode is changed
      setIntegerParam(NDPos_CurrentIndex, 0);
    } else if (function == NDPos_Restart){
      // Reset the position index to 0
      setIntegerParam(NDPos_CurrentIndex, 0);
      // Reset the last sent position
      setStringParam(NDPos_CurrentPos, "");
    } else if (function == NDPos_Delete){
      // Reset the position index to 0
      setIntegerParam(NDPos_CurrentIndex, 0);
      // Reset the last sent position
      setStringParam(NDPos_CurrentPos, "");
      // Clear out the position array
      positionArray.clear();
      setIntegerParam(NDPos_CurrentQty, positionArray.size());
    } else {
      // If this parameter belongs to a base class call its method
      if (function < FIRST_NDPOS_PARAM){
        status = NDPluginDriver::writeInt32(pasynUser, value);
      }
    }
  }

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

  if (status){
    epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize,
                  "%s: status=%d, function=%d, value=%d",
                  functionName, status, function, value);
  } else {
    asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
              "%s: function=%d, value=%d\n",
              functionName, function, value);
  }

  return status;
}
开发者ID:AdamBark,项目名称:ADCore,代码行数:66,代码来源:NDPosPlugin.cpp


示例6: setStringParam

void isisdaeDriver::reportMessages()
{
	std::string msgs = m_iface->getAllMessages();
    setStringParam(P_AllMsgs, msgs.c_str());
    setStringParam(P_ErrMsgs, "");
// getAsynMessages will pick these up and report to screen
//		errlogSevPrintf(errlogInfo, "%s", msgs.c_str());
	m_iface->resetMessages();
}
开发者ID:ISISComputingGroup,项目名称:EPICS-isisdae,代码行数:9,代码来源:isisdaeDriver.cpp


示例7: 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();

}
开发者ID:dls-controls,项目名称:ADCore,代码行数:75,代码来源:NDPluginAttribute.cpp


示例8: getParamName

asynStatus isisdaeDriver::readOctet(asynUser *pasynUser, char *value, size_t maxChars, size_t *nActual, int *eomReason)
{
	int function = pasynUser->reason;
	int status=0;
	const char *functionName = "readOctet";
    const char *paramName = NULL;
	getParamName(function, &paramName);
	m_iface->resetMessages();
	// we don't do much yet
	return asynPortDriver::readOctet(pasynUser, value, maxChars, nActual, eomReason);

	std::string value_s;
	try
	{
		if (m_iface == NULL)
		{
			throw std::runtime_error("m_iface is NULL");
		}
//		m_iface->getLabviewValue(paramName, &value_s);
		if ( value_s.size() > maxChars ) // did we read more than we have space for?
		{
			*nActual = maxChars;
			if (eomReason) { *eomReason = ASYN_EOM_CNT | ASYN_EOM_END; }
			asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, 
              "%s:%s: function=%d, name=%s, value=\"%s\" (TRUNCATED from %d chars)\n", 
			  driverName, functionName, function, paramName, value_s.substr(0,*nActual).c_str(), value_s.size());
		}
		else
		{
			*nActual = value_s.size();
			if (eomReason) { *eomReason = ASYN_EOM_END; }
			asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, 
              "%s:%s: function=%d, name=%s, value=\"%s\"\n", 
			  driverName, functionName, function, paramName, value_s.c_str());
		}
		strncpy(value, value_s.c_str(), maxChars); // maxChars  will NULL pad if possible, change to  *nActual  if we do not want this
        setStringParam(P_AllMsgs, m_iface->getAllMessages().c_str());
        setStringParam(P_ErrMsgs, "");
		m_iface->resetMessages();
		callParamCallbacks(); // this flushes P_ErrMsgs
		return asynSuccess;
	}
	catch(const std::exception& ex)
	{
        epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, 
                  "%s:%s: status=%d, function=%d, name=%s, value=\"%s\", error=%s", 
                  driverName, functionName, status, function, paramName, value_s.c_str(), ex.what());
		reportErrors(ex.what());
		callParamCallbacks(); // this flushes P_ErrMsgs
		*nActual = 0;
		if (eomReason) { *eomReason = ASYN_EOM_END; }
		value[0] = '\0';
		return asynError;
	}
}
开发者ID:ISISComputingGroup,项目名称:EPICS-isisdae,代码行数:55,代码来源:isisdaeDriver.cpp


示例9: 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();

}
开发者ID:ISISComputingGroup,项目名称:EPICS-areaDetector,代码行数:73,代码来源:NDPluginAttribute.cpp


示例10: getStringParam

int FastCCD::uploadFirmware(void){
  int _status = 0;

  char path[256];
  getStringParam(FastCCDFirmwarePath, sizeof(path), path);
  setIntegerParam(FastCCDFirmwareUpload, 1);

  // Power off the cin

  setStringParam(ADStatusMessage, "Powering CIN OFF");
  callParamCallbacks();
  if(cin_ctl_pwr(&cin_ctl_port, 0)){
    goto error;
  }

  sleep(5);
  getCameraStatus();

  // Power on the cin

  setStringParam(ADStatusMessage, "Powering CIN ON");
  callParamCallbacks();
  if(cin_ctl_pwr(&cin_ctl_port, 1)){
    goto error;
  }

  sleep(5);
  getCameraStatus();

  setStringParam(ADStatusMessage, "Uploading Firmware to CIN");
  callParamCallbacks();
  _status |= cin_ctl_load_firmware(&cin_ctl_port, 
                                  &cin_ctl_port_stream, path);
 
  if(!_status){
    _status |= cin_ctl_set_fabric_address(&cin_ctl_port, (char *)cinFabricIP);
    _status |= cin_data_send_magic();
  }

  setIntegerParam(FastCCDFirmwareUpload, 0);

error:

  if(_status){
    setStringParam(ADStatusMessage, "ERROR Uploading Firmware");
  } else {
    setStringParam(ADStatusMessage, "Firmware uploaded to CIN");
  }

  return _status;
}
开发者ID:timmmooney,项目名称:ADFastCCD,代码行数:51,代码来源:FastCCD.cpp


示例11: setIntegerParam

/** Base method for opening a file
  * Creates the file name with NDPluginBase::createFileName, then calls the pure virtual function openFile
  * in the derived class. */
asynStatus NDPluginFile::openFileBase(NDFileOpenMode_t openMode, NDArray *pArray)
{
    /* Opens a file for reading or writing */
    asynStatus status = asynSuccess;
    char fullFileName[MAX_FILENAME_LEN];
    char tempSuffix[MAX_FILENAME_LEN];
    char errorMessage[256];
    static const char* functionName = "openFileBase";

    if (this->useAttrFilePrefix)
        this->attrFileNameSet();

    setIntegerParam(NDFileWriteStatus, NDFileWriteOK);
    setStringParam(NDFileWriteMessage, "");
    status = (asynStatus)createFileName(MAX_FILENAME_LEN, fullFileName);
    if (status) {
        asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, 
              "%s::%s error creating full file name, fullFileName=%s, status=%d\n", 
              driverName, functionName, fullFileName, status);
        setIntegerParam(NDFileWriteStatus, NDFileWriteError);
        setStringParam(NDFileWriteMessage, "Error creating full file name");
        return(status);
    }
    setStringParam(NDFullFileName, fullFileName);
    
    getStringParam(NDFileTempSuffix, sizeof(tempSuffix), tempSuffix);
    if ( *tempSuffix != 0 && 
         (strlen(fullFileName) + strlen(tempSuffix)) < sizeof(fullFileName) ) {
        strcat( fullFileName, tempSuffix );
    }

    /* Call the openFile method in the derived class */
    /* Do this with the main lock released since it is slow */
    this->unlock();
    epicsMutexLock(this->fileMutexId);
    this->registerInitFrameInfo(pArray);
    status = this->openFile(fullFileName, openMode, pArray);
    if (status) {
        epicsSnprintf(errorMessage, sizeof(errorMessage)-1, 
            "Error opening file %s, status=%d", fullFileName, status);
        asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, 
              "%s::%s %s\n", 
              driverName, functionName, errorMessage);
        setIntegerParam(NDFileWriteStatus, NDFileWriteError);
        setStringParam(NDFileWriteMessage, errorMessage);
    }
    epicsMutexUnlock(this->fileMutexId);
    this->lock();
    
    return(status);
}
开发者ID:prjemian,项目名称:ADCore,代码行数:54,代码来源:NDPluginFile.cpp


示例12: getAddress

/** Called when asyn clients call pasynOctet->write().
  * This function performs actions for some parameters, including AttributesFile.
  * For all parameters it sets the value in the parameter library and calls any registered callbacks..
  * \param[in] pasynUser pasynUser structure that encodes the reason and address.
  * \param[in] value Address of the string to write.
  * \param[in] nChars Number of characters to write.
  * \param[out] nActual Number of characters actually written. */
asynStatus NDPluginCircularBuff::writeOctet(asynUser *pasynUser, const char *value, size_t nChars, size_t *nActual)
{
  int addr=0;
  int function = pasynUser->reason;
  asynStatus status = asynSuccess;
  short postfixError;
  const char *functionName = "writeOctet";

  status = getAddress(pasynUser, &addr); if (status != asynSuccess) return(status);
  // Set the parameter in the parameter library.
  status = (asynStatus)setStringParam(addr, function, (char *)value);
  if (status != asynSuccess) return(status);

  if (function == NDCircBuffTriggerCalc){
    if (nChars > sizeof(triggerCalcInfix_)) nChars = sizeof(triggerCalcInfix_);
    // If the input string is empty then use a value of "0", otherwise there is an error
    if ((value == 0) || (strlen(value) == 0)) {
      strcpy(triggerCalcInfix_, DEFAULT_TRIGGER_CALC);
      setStringParam(NDCircBuffTriggerCalc, DEFAULT_TRIGGER_CALC);
    } else {
      strncpy(triggerCalcInfix_, value, nChars);
    }
    status = (asynStatus)postfix(triggerCalcInfix_, triggerCalcPostfix_, &postfixError);
    if (status) {
      asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
      "%s::%s error processing infix expression=%s, error=%s\n",
      driverName, functionName, triggerCalcInfix_, calcErrorStr(postfixError));
    }
  } 
  
  else if (function < FIRST_NDPLUGIN_CIRC_BUFF_PARAM) {
      /* If this parameter belongs to a base class call its method */
      status = NDPluginDriver::writeOctet(pasynUser, value, nChars, nActual);
  }

  // Do callbacks so higher layers see any changes
  callParamCallbacks(addr, addr);

  if (status){
    epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize,
                  "%s:%s: status=%d, function=%d, value=%s",
                  driverName, functionName, status, function, value);
  } else {
    asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
              "%s:%s: function=%d, value=%s\n",
              driverName, functionName, function, value);
  }
  *nActual = nChars;
  return status;
}
开发者ID:jlmuir,项目名称:ADCore,代码行数:57,代码来源:NDPluginCircularBuff.cpp


示例13: releaseBlockLocks

void releaseBlockLocks(char* serviceName, int servicePort,
                       char* fileName, int lockID) {

    MessageClient client = newClient(serviceName, servicePort);
    Message m = newMessage();
    m->type = FILE_LOCK_CLIENT_SERVICE_CLIENT_MESSAGE;
    setStringParam(m, "functionName", "releaseblock");
    setStringParam(m, "fileName", fileName);
    setIntegerParam(m, "lockID", lockID);
    Message reply = clientCall(client, m);
    clientDisconnect(client);
    
    destroyMessage(m);
    destroyMessage(reply);
}
开发者ID:gkthiruvathukal,项目名称:st-hec,代码行数:15,代码来源:lockserverapi.c


示例14: 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();
}
开发者ID:aglowacki,项目名称:ADCore,代码行数:45,代码来源:NDPluginTransform.cpp


示例15: 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();
}
开发者ID:argonnexraydetector,项目名称:ADCore,代码行数:48,代码来源:NDPluginStdArrays.cpp


示例16: 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);
}
开发者ID:argonnexraydetector,项目名称:ADCore,代码行数:48,代码来源:NDFileJPEG.cpp


示例17: getIntegerParam

/** Called when asyn clients call pasynOctet->write().
  * Simply sets the value in the parameter library and 
  * calls any registered callbacks for this pasynUser->reason and address.  
  * \param[in] pasynUser pasynUser structure that encodes the reason and address.
  * \param[in] value Address of the string to write.
  * \param[in] nChars Number of characters to write.
  * \param[out] nActual Number of characters actually written. */
asynStatus testErrors::writeOctet(asynUser *pasynUser, const char *value, 
                                  size_t nChars, size_t *nActual)
{
    int function = pasynUser->reason;
    asynStatus status = asynSuccess;
    int itemp;
    const char *functionName = "writeOctet";

    /* Get the current error status */
    getIntegerParam(P_StatusReturn, &itemp); status = (asynStatus)itemp;

    /* Set the parameter in the parameter library. */
    setStringParam(function, (char *)value);
    /* Set the parameter status in the parameter library. */
    setParamStatus(function, status);

     /* Do callbacks so higher layers see any changes */
    callParamCallbacks();

    if (status) 
        epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, 
                  "%s:%s: status=%d, function=%d, value=%s", 
                  driverName, functionName, status, function, value);
    else        
        asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, 
              "%s:%s: function=%d, value=%s\n", 
              driverName, functionName, function, value);
    *nActual = nChars;
    return status;
}
开发者ID:ffeldbauer,项目名称:asyn,代码行数:37,代码来源:testErrors.cpp


示例18: NDPluginDriver

/** 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();
}
开发者ID:NicholasRees,项目名称:ADCore,代码行数:48,代码来源:NDPluginFile.cpp


示例19: writeOctet


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setStyleSheet函数代码示例发布时间:2022-05-30
下一篇:
C++ setString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap