|
NetShrVar
An EPICS support module to export National Instruments Network Shared Variables as process variables
|
Manager class for the NetVar Interaction. Parses an netvarconfig.xml file and provides access to the 9variables described within. More...
#include <NetShrVarInterface.h>
Public Member Functions | |
| NetShrVarInterface (const char *configSection, const char *configFile, int options) | |
| section name of configFile to use to configure this asyn port More... | |
| size_t | nParams () |
| ~NetShrVarInterface () | |
| void | updateValues () |
| This is called from a polling loop in the driver to update values from buffered subscribers. More... | |
| void | createParams (asynPortDriver *driver) |
| void | report (FILE *fp, int details) |
| Helper for EPICS driver report function. More... | |
| void | readValue (const char *param) |
| read a value and update corresponding asyn parameter More... | |
| void | dataTransferredCallback (void *handle, int error, CallbackData *cb_data) |
| called when data has been transferred to the variable More... | |
| void | dataCallback (void *handle, CNVData data, CallbackData *cb_data) |
| called by DataCallback() when new data is available on a subscriber connection More... | |
| void | statusCallback (void *handle, CNVConnectionStatus status, int error, CallbackData *cb_data) |
| called by StatusCallback() when status of a network shared variable changes More... | |
| template<typename T > | |
| void | setValue (const char *param, const T &value) |
| template<typename T > | |
| void | setArrayValue (const char *param, const T *value, size_t nElements) |
| template<typename T > | |
| void | readArrayValue (const char *paramName, T *value, size_t nElements, size_t *nIn) |
| called externally with m_driver locked More... | |
| template<> | |
| void | setValue (const char *param, const std::string &value) |
Static Public Member Functions | |
| static bool | varExists (const std::string &path) |
| static bool | pathExists (const std::string &path) |
Private Types | |
| typedef std::map< std::string, NvItem * > | params_t |
Private Member Functions | |
| void | updateBytesReadCount (unsigned nbytes) |
| template<typename T > | |
| void | getAsynParamValue (int param, T &value) |
| char * | envExpand (const char *str) |
| expand epics environment strings using previously saved environment based on EPICS macEnvExpand() More... | |
| void | getParams () |
| void | setValueCNV (const std::string &name, CNVData value) |
| bool | checkOption (NetShrVarOptions option) |
| void | connectVars () |
| bool | convertTimeStamp (unsigned __int64 timestamp, epicsTimeStamp *epicsTS) |
| convert a timestamp obtained from CNVGetDataUTCTimestamp() into an EPICS timestamp timestamp has 100ns granuality More... | |
| template<typename T > | |
| void | updateParamValue (int param_index, T val, epicsTimeStamp *epicsTS, bool do_asyn_param_callbacks) |
| template<typename T > | |
| void | updateParamArrayValue (int param_index, T *val, size_t nElements, epicsTimeStamp *epicsTS, bool do_asyn_param_callbacks) |
| void | updateParamCNV (int param_index, CNVData data, epicsTimeStamp *epicsTS, bool do_asyn_param_callbacks) |
| template<CNVDataType cnvType> | |
| void | updateParamCNVImpl (int param_index, CNVData data, CNVDataType type, unsigned int nDims, epicsTimeStamp *epicsTS, bool do_asyn_param_callbacks) |
| template<typename T , typename U > | |
| void | updateParamArrayValueImpl (int param_index, T *val, size_t nElements) |
| void | readVarInit (NvItem *item) |
| used to perform an initial read of a subscribed variable More... | |
| void | setParamStatus (int param_id, asynStatus status, epicsAlarmCondition alarmStat=epicsAlarmNone, epicsAlarmSeverity alarmSevr=epicsSevNone) |
| void | getParamStatus (int param_id, asynStatus &status, int &alarmStat, int &alarmSevr) |
| void | initAsynParamIds () |
| void | updateConnectedAlarmStatus (const std::string ¶mName, int value, const std::string &alarmStr, epicsAlarmCondition stat, epicsAlarmSeverity sevr) |
Static Private Member Functions | |
| static void | epicsExitFunc (void *arg) |
Private Attributes | |
| std::string | m_configSection |
| section of configFile to load information from More... | |
| std::string | m_configFile |
| int | m_options |
| the various NetShrVarOptions currently in use More... | |
| asynPortDriver * | m_driver |
| params_t | m_params |
| pugi::xml_document | m_xmlconfig |
| MAC_HANDLE * | m_mac_env |
| int | m_writer_wait_ms |
| how long to wait for a write operation to complete in milliseconds More... | |
| int | m_b_writer_wait_ms |
| how long to wait for a buffered write operation to complete in milliseconds More... | |
| my_atomic_uint32_t | m_items_read |
| my_atomic_uint64_t | m_bytes_read |
| struct timeb | m_last_report |
Manager class for the NetVar Interaction. Parses an netvarconfig.xml file and provides access to the 9variables described within.
Definition at line 72 of file NetShrVarInterface.h.
|
private |
Definition at line 97 of file NetShrVarInterface.h.
| NetShrVarInterface::NetShrVarInterface | ( | const char * | configSection, |
| const char * | configFile, | ||
| int | options | ||
| ) |
section name of configFile to use to configure this asyn port
| [in] | configSection | |
| [in] | configFile | Path to the XML input file to load configuration information from. |
| [in] | options | options as per NetShrVarOptions enum |
Definition at line 1134 of file NetShrVarInterface.cpp.
References envExpand(), epicsExitFunc(), initCV(), m_configFile, m_last_report, m_mac_env, m_xmlconfig, and onceId.
|
inline |
Definition at line 77 of file NetShrVarInterface.h.
|
inlineprivate |
Definition at line 124 of file NetShrVarInterface.h.
|
private |
Definition at line 377 of file NetShrVarInterface.cpp.
References NvItem::access, NvItem::b_subscriber, NvItem::b_writer, NvItem::BufferedRead, NvItem::BufferedWrite, NvItem::connected_alarm, DataCallback(), DataTransferredCallback(), ERROR_CHECK, ERROR_PRINT_CONTINUE, NvItem::id, initAsynParamIds(), m_params, NvItem::nv_name, pathExists(), NvItem::Read, NvItem::reader, readVarInit(), NvItem::SingleRead, StatusCallback(), NvItem::subscriber, NvItem::Write, and NvItem::writer.
Referenced by createParams().
|
private |
convert a timestamp obtained from CNVGetDataUTCTimestamp() into an EPICS timestamp timestamp has 100ns granuality
Definition at line 827 of file NetShrVarInterface.cpp.
Referenced by updateParamCNV().
| void NetShrVarInterface::createParams | ( | asynPortDriver * | driver | ) |
Definition at line 1257 of file NetShrVarInterface.cpp.
References connectVars(), getParams(), and m_driver.
Referenced by NetShrVarDriver::NetShrVarDriver().
| void NetShrVarInterface::dataCallback | ( | void * | handle, |
| CNVData | data, | ||
| CallbackData * | cb_data | ||
| ) |
called by DataCallback() when new data is available on a subscriber connection
Definition at line 536 of file NetShrVarInterface.cpp.
References CallbackData::param_index, and updateParamCNV().
Referenced by DataCallback().
| void NetShrVarInterface::dataTransferredCallback | ( | void * | handle, |
| int | error, | ||
| CallbackData * | cb_data | ||
| ) |
called when data has been transferred to the variable
Definition at line 503 of file NetShrVarInterface.cpp.
References CallbackData::nv_name, CallbackData::param_index, and setParamStatus().
Referenced by DataTransferredCallback().
|
private |
expand epics environment strings using previously saved environment based on EPICS macEnvExpand()
Definition at line 1104 of file NetShrVarInterface.cpp.
References m_mac_env.
Referenced by getParams(), and NetShrVarInterface().
|
staticprivate |
Definition at line 1178 of file NetShrVarInterface.cpp.
Referenced by NetShrVarInterface().
|
private |
|
private |
Definition at line 1265 of file NetShrVarInterface.cpp.
References NvItem::BufferedRead, NvItem::BufferedWrite, envExpand(), m_configSection, m_params, m_xmlconfig, MAX_PATH_LEN, NvItem::Read, NvItem::SingleRead, and NvItem::Write.
Referenced by createParams().
|
private |
Definition at line 1462 of file NetShrVarInterface.cpp.
References m_driver.
Referenced by updateParamCNV().
|
private |
Definition at line 1207 of file NetShrVarInterface.cpp.
References driverName, NvItem::id, m_driver, m_params, and NvItem::type.
Referenced by connectVars().
| size_t NetShrVarInterface::nParams | ( | ) |
Definition at line 1191 of file NetShrVarInterface.cpp.
References m_configSection, m_xmlconfig, and MAX_PATH_LEN.
|
static |
Definition at line 303 of file NetShrVarInterface.cpp.
References ERROR_CHECK, and getBrowseType().
Referenced by connectVars(), and main().
| void NetShrVarInterface::readArrayValue | ( | const char * | paramName, |
| T * | value, | ||
| size_t | nElements, | ||
| size_t * | nIn | ||
| ) |
called externally with m_driver locked
<
Definition at line 726 of file NetShrVarInterface.cpp.
References NvItem::access, NvItem::array_data, ERROR_CHECK, NvItem::id, m_driver, m_params, NvItem::nv_name, NvItem::reader, NvItem::SingleRead, and updateParamCNV().
Referenced by NetShrVarDriver::readArrayValue().
| void NetShrVarInterface::readValue | ( | const char * | param | ) |
read a value and update corresponding asyn parameter
Definition at line 760 of file NetShrVarInterface.cpp.
References NvItem::access, ERROR_CHECK, NvItem::id, m_driver, m_params, NvItem::nv_name, NvItem::reader, NvItem::SingleRead, and updateParamCNV().
Referenced by NetShrVarDriver::readValue().
|
private |
used to perform an initial read of a subscribed variable
Definition at line 241 of file NetShrVarInterface.cpp.
References ERROR_CHECK, NvItem::id, NvItem::nv_name, setParamStatus(), and updateParamCNV().
Referenced by connectVars().
| void NetShrVarInterface::report | ( | FILE * | fp, |
| int | details | ||
| ) |
Helper for EPICS driver report function.
Definition at line 1522 of file NetShrVarInterface.cpp.
References m_bytes_read, m_configFile, m_configSection, m_items_read, m_last_report, m_options, m_params, and NvItem::report().
Referenced by NetShrVarDriver::report().
| void NetShrVarInterface::setArrayValue | ( | const char * | param, |
| const T * | value, | ||
| size_t | nElements | ||
| ) |
Definition at line 1372 of file NetShrVarInterface.cpp.
References ERROR_CHECK, and setValueCNV().
Referenced by NetShrVarDriver::writeArrayValue().
|
private |
Definition at line 1453 of file NetShrVarInterface.cpp.
References m_driver.
Referenced by dataTransferredCallback(), readVarInit(), statusCallback(), updateConnectedAlarmStatus(), updateParamCNV(), and updateValues().
| void NetShrVarInterface::setValue | ( | const char * | param, |
| const T & | value | ||
| ) |
Definition at line 1363 of file NetShrVarInterface.cpp.
References ERROR_CHECK, and setValueCNV().
Referenced by NetShrVarDriver::writeOctet(), and NetShrVarDriver::writeValue().
| void NetShrVarInterface::setValue | ( | const char * | param, |
| const std::string & | value | ||
| ) |
Definition at line 1354 of file NetShrVarInterface.cpp.
References ERROR_CHECK, and setValueCNV().
|
private |
Definition at line 1381 of file NetShrVarInterface.cpp.
References NvItem::access, NvItem::b_writer, NvItem::BufferedWrite, ERROR_CHECK, NvItem::field, m_b_writer_wait_ms, m_driver, m_params, m_writer_wait_ms, NvItem::nv_name, NvItem::reader, NvItem::Write, and NvItem::writer.
Referenced by setArrayValue(), and setValue().
| void NetShrVarInterface::statusCallback | ( | void * | handle, |
| CNVConnectionStatus | status, | ||
| int | error, | ||
| CallbackData * | cb_data | ||
| ) |
called by StatusCallback() when status of a network shared variable changes
Definition at line 1074 of file NetShrVarInterface.cpp.
References connectionStatus(), CallbackData::nv_name, CallbackData::param_index, and setParamStatus().
Referenced by StatusCallback().
|
inlineprivate |
Definition at line 108 of file NetShrVarInterface.h.
Referenced by updateParamCNVImpl().
|
private |
Definition at line 553 of file NetShrVarInterface.cpp.
References m_driver, and setParamStatus().
Referenced by updateParamValue().
|
private |
Definition at line 647 of file NetShrVarInterface.cpp.
References convertLabviewTimeToEpicsTime(), m_driver, m_params, and updateParamValue().
Referenced by updateParamCNVImpl().
|
private |
Definition at line 618 of file NetShrVarInterface.cpp.
|
private |
Definition at line 853 of file NetShrVarInterface.cpp.
References convertTimeStamp(), dataQuality(), ERROR_CHECK, NvItem::field, getParamStatus(), NvItem::id, m_driver, m_params, NvItem::nv_name, setParamStatus(), and NvItem::type.
Referenced by dataCallback(), readArrayValue(), readValue(), readVarInit(), and updateValues().
|
private |
Definition at line 786 of file NetShrVarInterface.cpp.
References ERROR_CHECK, CNV2C< type >::free(), updateBytesReadCount(), updateParamArrayValue(), and updateParamValue().
|
private |
Definition at line 582 of file NetShrVarInterface.cpp.
References m_driver, m_params, and updateConnectedAlarmStatus().
Referenced by updateParamArrayValue(), and updateParamCNVImpl().
| void NetShrVarInterface::updateValues | ( | ) |
This is called from a polling loop in the driver to update values from buffered subscribers.
Definition at line 1473 of file NetShrVarInterface.cpp.
References NvItem::access, NvItem::b_subscriber, NvItem::BufferedRead, NvItem::id, m_params, NetShrVarException::ni_message(), NvItem::nv_name, NvItem::Read, setParamStatus(), and updateParamCNV().
Referenced by NetShrVarDriver::updateValues().
|
static |
Definition at line 337 of file NetShrVarInterface.cpp.
References ERROR_CHECK.
|
private |
how long to wait for a buffered write operation to complete in milliseconds
Definition at line 102 of file NetShrVarInterface.h.
Referenced by setValueCNV().
|
private |
Definition at line 105 of file NetShrVarInterface.h.
Referenced by report().
|
private |
Definition at line 93 of file NetShrVarInterface.h.
Referenced by NetShrVarInterface(), and report().
|
private |
section of configFile to load information from
Definition at line 92 of file NetShrVarInterface.h.
Referenced by getParams(), nParams(), and report().
|
private |
Definition at line 96 of file NetShrVarInterface.h.
Referenced by createParams(), getParamStatus(), initAsynParamIds(), readArrayValue(), readValue(), setParamStatus(), setValueCNV(), updateConnectedAlarmStatus(), updateParamArrayValue(), updateParamArrayValueImpl(), updateParamCNV(), and updateParamValue().
|
private |
Definition at line 104 of file NetShrVarInterface.h.
Referenced by report().
|
private |
Definition at line 106 of file NetShrVarInterface.h.
Referenced by NetShrVarInterface(), and report().
|
private |
Definition at line 100 of file NetShrVarInterface.h.
Referenced by envExpand(), and NetShrVarInterface().
|
private |
the various NetShrVarOptions currently in use
Definition at line 94 of file NetShrVarInterface.h.
Referenced by report().
|
private |
Definition at line 98 of file NetShrVarInterface.h.
Referenced by connectVars(), getParams(), initAsynParamIds(), readArrayValue(), readValue(), report(), setValueCNV(), updateParamArrayValue(), updateParamArrayValueImpl(), updateParamCNV(), updateParamValue(), and updateValues().
|
private |
how long to wait for a write operation to complete in milliseconds
Definition at line 101 of file NetShrVarInterface.h.
Referenced by setValueCNV().
|
private |
Definition at line 99 of file NetShrVarInterface.h.
Referenced by getParams(), NetShrVarInterface(), and nParams().
1.8.5