std::string Solver::settingsPyDictRepr() const { std::stringstream ss; for(int n=0; n<getNumParams(); ++n) ss << (n ? ", " : "") << "'" << getParamName(n) << "': " << getValue(getParamName(n)).pythonRepr(); return ss.str(); }
std::string Solver::getSettingsRepr() const { std::stringstream ss; for(int n=0; n<getNumParams(); ++n) ss << " " << std::setw(20) << getParamName(n) << ": " << getValue(getParamName(n)).toString() << "\n"; return ss.str(); }
void TParamContainer::link(const TParamContainer *src) { assert(getParamCount() == src->getParamCount()); for (int i = 0; i < getParamCount(); i++) { assert(getParamName(i) == src->getParamName(i)); assert(m_imp->m_vars[i]->getName() == getParamName(i)); m_imp->m_vars[i]->setParam(src->getParam(i)); } }
asynStatus ReadASCII::writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual) { //Checks if directory has changed, reads file again if it has int function = pasynUser->reason; int status = asynSuccess; const char *paramName; const char* functionName = "writeOctet"; /* Set the parameter in the parameter library. */ status = (asynStatus)setStringParam(function, value); /* Fetch the parameter string name for possible use in debugging */ getParamName(function, ¶mName); if (function == P_Dir | function == P_DirBase) { // Directory has changed so update status |= readFileBasedOnParameters(); } /* Do callbacks so higher layers see any changes */ status |= (asynStatus)callParamCallbacks(); if (status) epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%d", driverName, functionName, status, function, paramName, value); *nActual = maxChars; return (asynStatus)status; }
asynStatus sampleChanger::writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual) { int function = pasynUser->reason; const char* functionName = "writeOctet"; asynStatus status = asynSuccess; const char *paramName = NULL; getParamName(function, ¶mName); //printf("value: %s\n", value); if (function == P_recalc) { converter c(m_dims); c.createLookup(); setDoubleParam(P_outval, ++m_outval); *nActual = strlen(value); //printf("Here %s %f\n", m_fileName.c_str(), m_outval); } else { epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%s, error=%s", driverName, functionName, status, function, paramName, value, "unknown parameter"); status = asynError; *nActual = 0; } callParamCallbacks(); asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%s\n", driverName, functionName, function, paramName, value); return status; }
/** Called when asyn clients call pasynFloat64->write(). * 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 Value to write. */ asynStatus DSA2000::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName; const char* functionName = "writeInt32"; /* Set the parameter in the parameter library. */ setDoubleParam(function, value); /* Fetch the parameter string name for possible use in debugging */ getParamName(function, ¶mName); if (function == P_DACSetting) { status = setHVStatus(); } else { /* All other parameters just get set in parameter list, no need to * act on them here */ } /* Do callbacks so higher layers see any changes */ callParamCallbacks(); if (status) epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%f", driverName, functionName, status, function, paramName, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%f\n", driverName, functionName, function, paramName, value); return status; }
asynStatus daedataDriver::readArray(asynUser *pasynUser, const char* functionName, T *value, size_t nElements, size_t *nIn) { int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName = NULL; getParamName(function, ¶mName); try { if (function == P_CHANNEL_POSITION) { m_udp->readData(0x400, value, nElements, pasynUser); // doCallbacksInt32Array(value, nElements, P_CHANNEL_POSITION, 0); nedessary? } else { throw std::runtime_error("invalid parameter"); } *nIn = nElements; asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s\n", driverName, functionName, function, paramName); return asynSuccess; } catch(const std::exception& ex) { *nIn = 0; epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, error=%s", driverName, functionName, status, function, paramName, ex.what()); return asynError; } }
/** Called when asyn clients call pasynInt32->write(). * This function performs actions for some parameters, including ADAcquire, ADBinX, etc. * 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 Value to write. */ asynStatus NDFileHDF5XML::writeInt32(asynUser *pasynUser, epicsInt32 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; status = setIntegerParam(function, value); char mesx[256]; char *mesx2; getParamName(function, (const char**)&mesx2); sprintf(mesx,"NDFileHDF5XML::writeInt32, param=%s, value=%d",mesx2,value); lf.log(mesx); NDPluginFile::writeInt32(pasynUser, value); //make sure we dont have any mutexes... //releaseSerialMutex(); //releaseGrabberMutex(); callParamCallbacks(); status=asynSuccess; return(status); }
/// Read Values as Octet asynStatus ReadASCII::readOctet(asynUser *pasynUser, char *value, size_t maxChars, size_t *nActual, int *eomReason) { //Checks if directory has changed, reads file again if it has int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName; const char* functionName = "readOctet"; /* Fetch the parameter string name for possible use in debugging */ getParamName(function, ¶mName); if (function == P_DirBase) { char dirBase[DIR_LENGTH]; getStringParam(P_DirBase, DIR_LENGTH, dirBase); strncpy(value, dirBase, maxChars); *nActual = strlen(dirBase); std::cerr << status << "new dir base " << dirBase << std::endl; } else { status = asynError; epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s function does not have read.", driverName, functionName, status, function, paramName); } return status; }
asynStatus mk3Driver::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { //std::cout << "writeFloat64" << std::endl; int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName; static const char *functionName = "writeFloat64"; getParamName(function, ¶mName); int channel; getAddress(pasynUser, &channel); int errCode; if (function == P_NominalFreq) { double result; errCode = m_interface->putNominalFreq(channel, (double) value, &result); checkErrorCode(errCode); } else if (function == P_NominalPhase) { unsigned int result; errCode = m_interface->putNominalPhase(channel, (unsigned int) value, &result); checkErrorCode(errCode); } else if (function == P_NominalPhaseError) { unsigned int result; errCode = m_interface->putNominalPhaseErrorWindow(channel, (unsigned int) value, &result); checkErrorCode(errCode); } return status; }
asynStatus daedataDriver::writeValue(asynUser *pasynUser, const char* functionName, T value) { int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName = NULL; getParamName(function, ¶mName); try { if (function == P_SVN_VERSION) { } else { throw std::runtime_error("invalid parameter"); } callParamCallbacks(); asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%s\n", driverName, functionName, function, paramName, convertToString(value).c_str()); 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, convertToString(value).c_str(), ex.what()); return asynError; } }
asynStatus NetShrVarDriver::writeArrayValue(asynUser *pasynUser, const char* functionName, T* value, size_t nElements) { int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName = NULL; getParamName(function, ¶mName); try { if (m_netvarint == NULL) { throw std::runtime_error("m_netvarint is NULL"); } m_netvarint->setArrayValue(paramName, value, nElements); asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, nElements=%d\n", driverName, functionName, function, paramName, (int)nElements); return asynSuccess; } catch(const std::exception& ex) { epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, nElements=%d, error=%s", driverName, functionName, status, function, paramName, (int)nElements, ex.what()); return asynError; } }
asynStatus sampleChanger::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { int function = pasynUser->reason; const char* functionName = "writeFloat64"; asynStatus status = asynSuccess; const char *paramName = NULL; getParamName(function, ¶mName); // if (function == P_coord1RBV) // { //// printf("value: %f\n", value); // posn2name(value, 1e10, m_fileName.c_str()); // setDoubleParam(P_coord1, currentPosn(1, m_fileName.c_str())); //// printf("coord1: %f\n", currentPosn(1, m_fileName.c_str())); // } // else if (function == P_reset) // { // loadDefFile(m_fileName.c_str()); // updatePositions(); // } // else { epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%f, error=%s", driverName, functionName, status, function, paramName, value, "unknown parameter"); status = asynError; } callParamCallbacks(); asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%f\n", driverName, functionName, function, paramName, value); return status; }
/** Called when asyn clients call pasynFloat64->write(). * \param[in] pasynUser pasynUser structure that encodes the reason and address. * \param[in] value Value to write. */ asynStatus testErrors::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName; const char* functionName = "writeFloat64"; /* Get the current error status */ getIntegerParam(P_StatusReturn, (int*)&status); /* Fetch the parameter string name for use in debugging */ getParamName(function, ¶mName); /* Set the parameter in the parameter library. */ setDoubleParam(function, 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, name=%s, value=%f", driverName, functionName, status, function, paramName, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%f\n", driverName, functionName, function, paramName, value); return status; }
asynStatus isisdaeDriver::readArray(asynUser *pasynUser, const char* functionName, T *value, size_t nElements, size_t *nIn) { int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName = NULL; getParamName(function, ¶mName); m_iface->resetMessages(); try { asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s\n", driverName, functionName, function, paramName); reportMessages(); return status; } catch(const std::exception& ex) { *nIn = 0; epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, error=%s", driverName, functionName, status, function, paramName, ex.what()); reportErrors(ex.what()); return asynError; } }
void StageObjectOverlay::paramChanged(int index) { static std::map<std::string, ofxAssimpModelLoader*> models; if (getParamName(index)=="source") { if (models.find(getStringValue(index))!=models.end()) { model = models[getStringValue(index)]; } else { model = new ofxAssimpModelLoader; model->loadModel(getStringValue(index), true); //model.setAnimation(0); //model.setPosition(0,8,0); model->setScale(1, 1, 1); model->enableColors(); model->enableMaterials(); // int meshes = model.getNumMeshes(); mesh = model->getMesh(0); position = model->getPosition(); normScale = model->getNormalizedScale(); scale = model->getScale(); model->setScaleNomalization(false); models[getStringValue(index)] = model; } } }
asynStatus isisdaeDriver::readValue(asynUser *pasynUser, const char* functionName, T* value) { int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName = NULL; getParamName(function, ¶mName); m_iface->resetMessages(); try { status = asynPortDriver::readValue(pasynUser, functionName, &value); asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%s\n", driverName, functionName, function, paramName, convertToString(*value).c_str()); reportMessages(); return status; } 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, convertToString(*value).c_str(), ex.what()); reportErrors(ex.what()); return asynError; } }
/** Called when asyn clients call pasynInt32->write(). * This function sends a signal to the arrayGenTask thread if the value of P_RunStop has changed. * 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 Value to write. */ asynStatus testArrayRingBuffer::writeInt32(asynUser *pasynUser, epicsInt32 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName; const char* functionName = "writeInt32"; /* Set the parameter in the parameter library. */ status = (asynStatus) setIntegerParam(function, value); /* Fetch the parameter string name for possible use in debugging */ getParamName(function, ¶mName); if (function == P_RunStop) { if (value) epicsEventSignal(eventId_); } else { /* All other parameters just get set in parameter list, no need to * act on them here */ } /* Do callbacks so higher layers see any changes */ status = (asynStatus) callParamCallbacks(); if (status) epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%d", driverName, functionName, status, function, paramName, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%d\n", driverName, functionName, function, paramName, value); return status; }
/** Called when asyn clients call pasynUInt32D->write(). * 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 Value to write. */ asynStatus testErrors::writeUInt32Digital(asynUser *pasynUser, epicsUInt32 value, epicsUInt32 mask) { int function = pasynUser->reason; asynStatus status = asynSuccess; int itemp; const char *paramName; const char* functionName = "writeUInt32D"; /* Get the current error status */ getIntegerParam(P_StatusReturn, &itemp); status = (asynStatus)itemp; /* Fetch the parameter string name for use in debugging */ getParamName(function, ¶mName); /* Set the parameter value in the parameter library. */ setUIntDigitalParam(function, value, mask); /* 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, name=%s, value=0x%X", driverName, functionName, status, function, paramName, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=0x%X\n", driverName, functionName, function, paramName, value); return status; }
asynStatus NetShrVarDriver::writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual) { int function = pasynUser->reason; asynStatus status = asynSuccess; const char *paramName = NULL; getParamName(function, ¶mName); const char* functionName = "writeOctet"; std::string value_s(value, maxChars); try { if (m_netvarint == NULL) { throw std::runtime_error("m_netvarint is NULL"); } m_netvarint->setValue(paramName, value_s); asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%s\n", driverName, functionName, function, paramName, value_s.c_str()); *nActual = value_s.size(); return asynPortDriver::writeOctet(pasynUser, value_s.c_str(), maxChars, nActual); } 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()); *nActual = 0; return asynError; } }
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, ¶mName); 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; } }
asynStatus FastCCD::writeFloat64(asynUser *pasynUser, epicsFloat64 value){ int function = pasynUser->reason; asynStatus status = asynSuccess; int _status = 0; const char *paramName; static const char *functionName = "writeFloat64"; getParamName(function, ¶mName); status = setDoubleParam(function, value); if(status != asynSuccess){ return status; } if(function == ADAcquireTime){ _status = cin_ctl_set_exposure_time(&cin_ctl_port, (float)value); } else if (function == ADAcquirePeriod) { _status = cin_ctl_set_cycle_time(&cin_ctl_port, (float)value); } else if (function == FastCCDPollingPeriod){ // Set the new polling period and poll statusPollingPeriod = value; epicsEventSignal(statusEvent); } else { ADDriver::writeFloat64(pasynUser, value); } if(_status){ setParamStatus(function, asynError); status = asynError; } if(status){ asynPrint(pasynUser, ASYN_TRACE_ERROR, "%s:%s: error, status=%d function=%d, value=%f\n", driverName, functionName, status, function, value); } else { asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, value=%f\n", driverName, functionName, function, value); } return status; }
asynStatus FileList::writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual) { //Checks if directory has changed, reads file again if it has int function = pasynUser->reason; int status = asynSuccess; const char *paramName = NULL; getParamName(function, ¶mName); const char* functionName = "writeOctet"; std::string value_s; // we might get an embedded NULL from channel access char waveform records if ( (maxChars > 0) && (value[maxChars-1] == '\0') ) { value_s.assign(value, maxChars-1); } else { value_s.assign(value, maxChars); } std::cout << value_s << std::endl; /* Set the parameter in the parameter library. */ status = (asynStatus)setStringParam(function, value_s.c_str()); if (function == P_Search || function == P_DirBase) { status = updateList(); if ( (status == asynSuccess) && (function == P_DirBase) ) { //change watching directory char * str = strdup(value_s.c_str()); watchQueue_.send((void*)&str, sizeof(char*)); } } /* Do callbacks so higher layers see any changes */ status |= (asynStatus)callParamCallbacks(); if (status) epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%d", driverName, functionName, status, function, paramName, value_s.c_str()); if (status == asynSuccess) { *nActual = maxChars; // To keep result happy in case we skipped an embedded trailing NULL } return (asynStatus)status; }
/** Called when asyn clients call pasynFloat64->write(). * This function sends a signal to the simTask thread if the value of P_UpdateTime has changed. * 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 Value to write. */ asynStatus drvQuadEM::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { int function = pasynUser->reason; int status = asynSuccess; int channel; const char *paramName; const char* functionName = "writeFloat64"; getAddress(pasynUser, &channel); /* Set the parameter in the parameter library. */ status |= setDoubleParam(channel, function, value); /* Fetch the parameter string name for possible use in debugging */ getParamName(function, ¶mName); if (function == P_AveragingTime) { status |= setAveragingTime(value); epicsRingBytesFlush(ringBuffer_); ringCount_ = 0; status |= readStatus(); } else if (function == P_BiasVoltage) { status |= setBiasVoltage(value); status |= readStatus(); } else if (function == P_IntegrationTime) { status |= setIntegrationTime(value); status |= readStatus(); } else { /* All other parameters just get set in parameter list, no need to * act on them here */ } /* Do callbacks so higher layers see any changes */ status |= (asynStatus) callParamCallbacks(); if (status) epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%f", driverName, functionName, status, function, paramName, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%f\n", driverName, functionName, function, paramName, value); return (asynStatus)status; }
/** Called when asyn clients call pasynInt32->write(). * 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 Value to write. */ asynStatus DSA2000::writeInt32(asynUser *pasynUser, epicsInt32 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; struct ncp_hcmd_resethvstatus resetCommand; int sendStatus; int response; int actual; const char *paramName; const char* functionName = "writeInt32"; /* Set the parameter in the parameter library. */ setIntegerParam(function, value); /* Fetch the parameter string name for possible use in debugging */ getParamName(function, ¶mName); if (function == P_HVRangeSetting) { /* Set the range */ status = setHVStatus(); } if (function == P_HVReset) { /* Send the HV reset command */ sendStatus = nmc_sendcmd(this->module, NCP_K_HCMD_RESETHVSTATUS, &resetCommand, sizeof(resetCommand), &response, sizeof(response), &actual, 0); if (sendStatus != 9) status = asynError; } else if (function == P_ReadStatus) { status = getHVStatus(); } else { /* All other parameters just get set in parameter list, no need to * act on them here */ } /* Do callbacks so higher layers see any changes */ callParamCallbacks(); if (status) epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%d", driverName, functionName, status, function, paramName, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%d\n", driverName, functionName, function, paramName, value); return status; }
bool BaseBlock::validateBlock(bool emit_errors) const { const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); for (BlockDescriptor::param_validation_list_t::const_iterator it = block_data.mValidationList.begin(); it != block_data.mValidationList.end(); ++it) { const Param* param = getParamFromHandle(it->first); if (!it->second(param)) { if (emit_errors) { llwarns << "Invalid param \"" << getParamName(block_data, param) << "\"" << llendl; } return false; } } return true; }
/** Called when asyn clients call pasynFloat64->write(). * This function sends a signal to the simTask thread if the value of P_UpdateTime has changed. * 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 Value to write. */ asynStatus testAsynPortDriver::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; int run; const char *paramName; const char* functionName = "writeFloat64"; /* Set the parameter in the parameter library. */ status = (asynStatus) setDoubleParam(function, value); /* Fetch the parameter string name for possible use in debugging */ getParamName(function, ¶mName); if (function == P_UpdateTime) { /* Make sure the update time is valid. If not change it and put back in parameter library */ if (value < MIN_UPDATE_TIME) { asynPrint(pasynUser, ASYN_TRACE_WARNING, "%s:%s: warning, update time too small, changed from %f to %f\n", driverName, functionName, value, MIN_UPDATE_TIME); value = MIN_UPDATE_TIME; setDoubleParam(P_UpdateTime, value); } /* If the update time has changed and we are running then wake up the simulation task */ getIntegerParam(P_Run, &run); if (run) epicsEventSignal(eventId_); } else { /* All other parameters just get set in parameter list, no need to * act on them here */ } /* Do callbacks so higher layers see any changes */ status = (asynStatus) callParamCallbacks(); if (status) epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s:%s: status=%d, function=%d, name=%s, value=%f", driverName, functionName, status, function, paramName, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%f\n", driverName, functionName, function, paramName, value); return status; }
/** Called when asyn clients call pasynFloat64->write(). * This function ensures the ffmpegFileBitrate parameter value is within the * allowed range of -2^53 to 2^53. If it is not, the value is not set in * the parameter library, an error is logged, and the asynError status is * returned. Otherwise this function calls asynPortDriver::writeFloat64 with * the same arguments this function was called with and returns its status. * \param[in] pasynUser pasynUser structure that encodes the reason and * address. * \param[in] value Value to write. */ asynStatus ffmpegFile::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { int function = pasynUser->reason; const char *paramName; getParamName(function, ¶mName); static const char *functionName = "writeFloat64"; if (function == ffmpegFileBitrate && (value < EXACT_INT_DBL_MIN || value > EXACT_INT_DBL_MAX)) { asynPrint(pasynUser, ASYN_TRACE_ERROR, "%s:%s: value out of range, function=%d, name=%s, value=%.0f, " "min=%.0f, max=%.0f\n", driverName2, functionName, function, paramName, value, EXACT_INT_DBL_MIN, EXACT_INT_DBL_MAX); return asynError; } return asynPortDriver::writeFloat64(pasynUser, value); }
/** Called when asyn clients call pasynFloat64->write(). * Extracts the function and axis number from pasynUser. * Sets the value in the parameter library. * If the function is motorSetClosedLoop_ then it turns the drive power on or off. * If the function is ddriveReadBinaryIO_ then it reads the binary I/O registers on the controller. * For all other functions it calls asynMotorController::writeFloat64. * Calls any registered callbacks for this pasynUser->reason and address. * \param[in] pasynUser asynUser structure that encodes the reason and address. * \param[in] value Value to write. */ asynStatus ddriveController::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; ddriveAxis *pAxis = getAxis(pasynUser); const char *paramName = "(unset)"; /* Fetch the parameter string name for possible use in debugging */ getParamName(function, ¶mName); /* Set the parameter and readback in the parameter library. This may be overwritten when we read back the * status at the end, but that's OK */ status = setDoubleParam(pAxis->axisNo_, function, value); const DDParam *ddp = DDParamFromIndex(function); if (ddp && ddp->type == asynParamFloat64) { if (ddp->global) { status = writeParameter(ddp, value); } else { status = pAxis->writeParameter(ddp, value); } } else if (function == param_move_timeout_) { position_move_timeout_ = value; printf("Move timeout set to: %g\n", value); } else { /* Call base class method */ status = asynMotorController::writeFloat64(pasynUser, value); } /* Do callbacks so higher layers see any changes */ callParamCallbacks(pAxis->axisNo_); if (status) asynPrint(pasynUser, ASYN_TRACE_ERROR, "%s:%s: error, status=%d function=%s (%d), value=%d\n", driverName, __func__, status, paramName, function, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%s (%d), value=%d\n", driverName, __func__, paramName, function, value); return status; }
/** Called when asyn clients call pasynInt32->write(). * This function sends a signal to the simTask thread if the value of P_Run has changed. * 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 Value to write. */ asynStatus testErrors::writeInt32(asynUser *pasynUser, epicsInt32 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; int itemp; const char *paramName; const char* functionName = "writeInt32"; /* Fetch the parameter string name for use in debugging */ getParamName(function, ¶mName); /* Set the parameter value in the parameter library. */ setIntegerParam(function, value); if (function == P_DoUpdate) { epicsEventSignal(eventId_); } else if (function == P_StatusReturn) { } else if (function == P_EnumOrder) { setEnums(); } else { /* Set the parameter status in the parameter library except for the above commands with always return OK */ /* Get the current error status */ getIntegerParam(P_StatusReturn, &itemp); status = (asynStatus)itemp; 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, name=%s, value=%d", driverName, functionName, status, function, paramName, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, name=%s, value=%d\n", driverName, functionName, function, paramName, value); return status; }