Manager class for LabVIEW DCOM Interaction. Parses an lvinput.xml file and provides access to the LabVIEW VI controls/indicators described within. More...
#include <lvDCOMInterface.h>
Public Member Functions | |
lvDCOMInterface (const char *configSection, const char *configFile, const char *host, int options, const char *progid, const char *username, const char *password) | |
section name of configFile we will load settings from More... | |
long | nParams () |
void | getParams (std::map< std::string, std::string > &res) |
template<typename T > | |
void | setLabviewValue (const char *param, const T &value) |
template<typename T > | |
void | getLabviewValue (const char *param, T *value) |
template<typename T > | |
void | getLabviewValue (const char *param, T *value, size_t nElements, size_t &nIn) |
~lvDCOMInterface () | |
std::string | doPath (const std::string &xpath) |
std::string | doXPATH (const std::string &xpath) |
bool | doXPATHbool (const std::string &xpath) |
void | report (FILE *fp, int details) |
Helper for EPICS driver report function. More... | |
int | generateFilesFromSECI (const char *portName, const char *macros, const char *configSection, const char *configFile, const char *dbSubFile, const char *blocks_match, bool no_setter) |
generate XML and DB files for SECI blocks More... | |
bool | checkForNewBlockDetails () |
template<> | |
void | getLabviewValue (const char *param, std::string *value) |
template<> | |
void | setLabviewValue (const char *param, const std::string &value) |
Static Public Member Functions | |
static double | diffFileTimes (const FILETIME &f1, const FILETIME &f2) |
filetime uses 100ns units, returns difference in seconds More... | |
Private Types | |
typedef std::map< std::wstring, ViRef > | vi_map_t |
Private Member Functions | |
void | DomFromCOM () |
char * | envExpand (const char *str) |
expand epics environment strings using previously saved environment based on EPICS macEnvExpand() More... | |
void | getViRef (BSTR vi_name, bool reentrant, LabVIEW::VirtualInstrumentPtr &vi) |
void | createViRef (BSTR vi_name, bool reentrant, LabVIEW::VirtualInstrumentPtr &vi) |
void | getLabviewValue (BSTR vi_name, BSTR control_name, VARIANT *value) |
void | setLabviewValue (BSTR vi_name, BSTR control_name, const VARIANT &value) |
void | setLabviewValueExt (BSTR vi_name, BSTR control_name, const VARIANT &value, VARIANT *results) |
void | callLabview (BSTR vi_name, VARIANT &names, VARIANT &values, VARIANT_BOOL reentrant, VARIANT *results) |
void | waitForLabviewBoolean (BSTR vi_name, BSTR control_name, bool value) |
COAUTHIDENTITY * | createIdentity (const std::string &user, const std::string &domain, const std::string &pass) |
HRESULT | setIdentity (COAUTHIDENTITY *pidentity, IUnknown *pUnk) |
void | stopVis (bool only_ones_we_started) |
bool | checkOption (lvDCOMOptions option) |
double | getLabviewUptime () |
returns -1.0 if labview not running, else labview uptime in seconds More... | |
std::string | getLabviewValueType (BSTR vi_name, BSTR control_name) |
determine best epics type for a labvier variable, this will be used to choose the appropriate EPICS record template to use More... | |
double | waitForLabVIEW () |
wait for LabVIEW to have been running for m_minLVUptime seconds More... | |
void | maybeWaitForLabVIEWOrExit () |
void | getBlockDetails (std::vector< std::vector< std::string > > &values) |
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 |
std::string | m_host |
std::string | m_progid |
CLSID | m_clsid |
std::string | m_username |
std::string | m_password |
int | m_options |
the various lvDCOMOptions currently in use More... | |
vi_map_t | m_vimap |
epicsMutex | m_lock |
IXMLDOMDocument2 * | m_pxmldom |
CComBSTR | m_extint |
CComPtr< LabVIEW::_Application > | m_lv |
COAUTHIDENTITY * | m_pidentity |
std::map< std::string, std::string > | m_xpath_map |
std::map< std::string, bool > | m_xpath_bool_map |
MAC_HANDLE * | m_mac_env |
Static Private Attributes | |
static double | m_minLVUptime = 60.0 |
minimum time labview must be running before connection made in "lvNoStart" mode More... | |
static std::vector < std::vector< std::string > > | m_seci_values |
horrible - do properly some time More... | |
Manager class for LabVIEW DCOM Interaction. Parses an lvinput.xml file and provides access to the LabVIEW VI controls/indicators described within.
Definition at line 80 of file lvDCOMInterface.h.
|
private |
Definition at line 109 of file lvDCOMInterface.h.
lvDCOMInterface::lvDCOMInterface | ( | const char * | configSection, |
const char * | configFile, | ||
const char * | host, | ||
int | options, | ||
const char * | progid, | ||
const char * | username, | ||
const char * | password | ||
) |
section name of configFile we will load settings from
[in] | configSection | |
[in] | configFile | Path to the XML input file to load configuration information from. |
[in] | host | host name where LabVIEW is running ("" for localhost) |
[in] | options | options as per lvDCOMOptions enum |
[in] | progid | (optional) DCOM ProgID (required if connecting to a compiled LabVIEW application) |
[in] | username | (optional) remote username for host |
[in] | password | (optional) remote password for username on host |
Definition at line 335 of file lvDCOMInterface.cpp.
References checkOption(), LabVIEW::CLSID_Application, DomFromCOM(), doPath(), envExpand(), epicsExitFunc(), initCOM(), lvNoStart, m_clsid, m_configFile, m_extint, m_host, m_mac_env, m_progid, m_pxmldom, onceId, and waitForLabVIEW().
|
inline |
Definition at line 89 of file lvDCOMInterface.h.
References m_pxmldom.
|
private |
Definition at line 1307 of file lvDCOMInterface.cpp.
References getViRef().
Referenced by setLabviewValueExt().
bool lvDCOMInterface::checkForNewBlockDetails | ( | ) |
Definition at line 525 of file lvDCOMInterface.cpp.
References getBlockDetails(), lvSECIConfig, m_options, and m_seci_values.
Referenced by lvDCOMDriver::lvDCOMTask().
|
inlineprivate |
Definition at line 136 of file lvDCOMInterface.h.
References m_options.
Referenced by createViRef(), epicsExitFunc(), lvDCOMInterface(), and maybeWaitForLabVIEWOrExit().
|
private |
Definition at line 727 of file lvDCOMInterface.cpp.
Referenced by createViRef().
|
private |
Definition at line 862 of file lvDCOMInterface.cpp.
References checkOption(), createIdentity(), LabVIEW::eIdle, initCOM(), m_clsid, m_host, m_lv, m_password, m_pidentity, m_username, m_vimap, maybeWaitForLabVIEWOrExit(), onceId, setIdentity(), ViRef::started, viStartIfIdle, and viWarnIfIdle.
Referenced by getViRef().
|
static |
filetime uses 100ns units, returns difference in seconds
Definition at line 830 of file lvDCOMInterface.cpp.
Referenced by getLabviewUptime().
|
private |
Definition at line 306 of file lvDCOMInterface.cpp.
References m_pxmldom.
Referenced by lvDCOMInterface().
std::string lvDCOMInterface::doPath | ( | const std::string & | xpath | ) |
Definition at line 299 of file lvDCOMInterface.cpp.
References doXPATH().
Referenced by getLabviewValue(), lvDCOMInterface(), and StringItem::StringItem().
std::string lvDCOMInterface::doXPATH | ( | const std::string & | xpath | ) |
Definition at line 173 of file lvDCOMInterface.cpp.
References envExpand(), m_lock, m_pxmldom, and m_xpath_map.
Referenced by doPath(), getLabviewValue(), and StringItem::StringItem().
bool lvDCOMInterface::doXPATHbool | ( | const std::string & | xpath | ) |
Definition at line 207 of file lvDCOMInterface.cpp.
References envExpand(), m_lock, m_pxmldom, and m_xpath_bool_map.
Referenced by BoolItem::BoolItem().
|
private |
expand epics environment strings using previously saved environment based on EPICS macEnvExpand()
Definition at line 145 of file lvDCOMInterface.cpp.
References m_mac_env.
Referenced by doXPATH(), doXPATHbool(), generateFilesFromSECI(), and lvDCOMInterface().
|
staticprivate |
Definition at line 443 of file lvDCOMInterface.cpp.
References checkOption(), stopVis(), viAlwaysStopOnExit, and viStopOnExitIfStarted.
Referenced by lvDCOMInterface().
int lvDCOMInterface::generateFilesFromSECI | ( | const char * | portName, |
const char * | macros, | ||
const char * | configSection, | ||
const char * | configFile, | ||
const char * | dbSubFile, | ||
const char * | blocks_match, | ||
bool | no_setter | ||
) |
generate XML and DB files for SECI blocks
Definition at line 537 of file lvDCOMInterface.cpp.
References envExpand(), pcrecpp::RE::FullMatch(), getBlockDetails(), getLabviewValueType(), m_mac_env, m_seci_values, replaceWithEntities(), and waitForLabVIEW().
Referenced by lvDCOMSECIConfigure().
|
private |
Definition at line 475 of file lvDCOMInterface.cpp.
References getLabviewValue(), and waitForLabVIEW().
Referenced by checkForNewBlockDetails(), and generateFilesFromSECI().
|
private |
returns -1.0 if labview not running, else labview uptime in seconds
Definition at line 788 of file lvDCOMInterface.cpp.
References diffFileTimes(), and m_lock.
Referenced by maybeWaitForLabVIEWOrExit(), and waitForLabVIEW().
void lvDCOMInterface::getLabviewValue | ( | const char * | param, |
T * | value | ||
) |
Definition at line 1045 of file lvDCOMInterface.cpp.
References doPath(), doXPATH(), m_configSection, and MAX_PATH_LEN.
Referenced by getBlockDetails(), getLabviewValue(), getLabviewValueType(), lvDCOMDriver::readArray(), lvDCOMDriver::readOctet(), lvDCOMDriver::readValue(), and waitForLabviewBoolean().
void lvDCOMInterface::getLabviewValue | ( | const char * | param, |
T * | value, | ||
size_t | nElements, | ||
size_t & | nIn | ||
) |
Definition at line 1009 of file lvDCOMInterface.cpp.
References doPath(), doXPATH(), getLabviewValue(), m_configSection, and MAX_PATH_LEN.
|
private |
Definition at line 1076 of file lvDCOMInterface.cpp.
References getViRef().
void lvDCOMInterface::getLabviewValue | ( | const char * | param, |
std::string * | value | ||
) |
Definition at line 977 of file lvDCOMInterface.cpp.
References doPath(), doXPATH(), getLabviewValue(), m_configSection, and MAX_PATH_LEN.
|
private |
determine best epics type for a labvier variable, this will be used to choose the appropriate EPICS record template to use
Definition at line 1091 of file lvDCOMInterface.cpp.
References getLabviewValue().
Referenced by generateFilesFromSECI().
void lvDCOMInterface::getParams | ( | std::map< std::string, std::string > & | res | ) |
Definition at line 687 of file lvDCOMInterface.cpp.
References m_configSection, m_pxmldom, and MAX_PATH_LEN.
Referenced by lvDCOMDriver::lvDCOMDriver().
|
private |
Definition at line 761 of file lvDCOMInterface.cpp.
References createViRef(), m_lock, and m_vimap.
Referenced by callLabview(), getLabviewValue(), and setLabviewValue().
|
private |
Definition at line 840 of file lvDCOMInterface.cpp.
References checkOption(), getLabviewUptime(), lvNoStart, lvSECIConfig, m_minLVUptime, and waitForLabVIEW().
Referenced by createViRef().
long lvDCOMInterface::nParams | ( | ) |
Definition at line 672 of file lvDCOMInterface.cpp.
References m_configSection, m_pxmldom, and MAX_PATH_LEN.
void lvDCOMInterface::report | ( | FILE * | fp, |
int | details | ||
) |
Helper for EPICS driver report function.
Definition at line 1330 of file lvDCOMInterface.cpp.
References m_configFile, m_configSection, m_host, m_options, m_progid, m_username, m_vimap, m_xpath_bool_map, and m_xpath_map.
Referenced by lvDCOMDriver::report().
|
private |
Definition at line 744 of file lvDCOMInterface.cpp.
Referenced by createViRef().
void lvDCOMInterface::setLabviewValue | ( | const char * | param, |
const T & | value | ||
) |
Definition at line 1226 of file lvDCOMInterface.cpp.
References m_configSection, setLabviewValueExt(), and waitForLabviewBoolean().
Referenced by setLabviewValue(), lvDCOMDriver::writeOctet(), and lvDCOMDriver::writeValue().
|
private |
Definition at line 1264 of file lvDCOMInterface.cpp.
References getViRef().
void lvDCOMInterface::setLabviewValue | ( | const char * | param, |
const std::string & | value | ||
) |
Definition at line 1171 of file lvDCOMInterface.cpp.
References m_configSection, setLabviewValue(), setLabviewValueExt(), and waitForLabviewBoolean().
|
private |
Definition at line 1277 of file lvDCOMInterface.cpp.
References callLabview(), and m_extint.
Referenced by setLabviewValue().
|
private |
Definition at line 645 of file lvDCOMInterface.cpp.
References LabVIEW::eIdle, and m_vimap.
Referenced by epicsExitFunc().
|
private |
wait for LabVIEW to have been running for m_minLVUptime seconds
Definition at line 461 of file lvDCOMInterface.cpp.
References getLabviewUptime(), and m_minLVUptime.
Referenced by generateFilesFromSECI(), getBlockDetails(), lvDCOMInterface(), and maybeWaitForLabVIEWOrExit().
|
private |
Definition at line 1209 of file lvDCOMInterface.cpp.
References getLabviewValue().
Referenced by setLabviewValue().
|
private |
Definition at line 104 of file lvDCOMInterface.h.
Referenced by createViRef(), and lvDCOMInterface().
|
private |
Definition at line 101 of file lvDCOMInterface.h.
Referenced by lvDCOMInterface(), and report().
|
private |
section of configFile to load information from
Definition at line 100 of file lvDCOMInterface.h.
Referenced by getLabviewValue(), getParams(), nParams(), report(), and setLabviewValue().
|
private |
Definition at line 115 of file lvDCOMInterface.h.
Referenced by lvDCOMInterface(), and setLabviewValueExt().
|
private |
Definition at line 102 of file lvDCOMInterface.h.
Referenced by createViRef(), lvDCOMInterface(), and report().
|
private |
Definition at line 111 of file lvDCOMInterface.h.
Referenced by doXPATH(), doXPATHbool(), getLabviewUptime(), and getViRef().
|
private |
Definition at line 116 of file lvDCOMInterface.h.
Referenced by createViRef().
|
private |
Definition at line 120 of file lvDCOMInterface.h.
Referenced by envExpand(), generateFilesFromSECI(), and lvDCOMInterface().
|
staticprivate |
minimum time labview must be running before connection made in "lvNoStart" mode
in seconds
Definition at line 107 of file lvDCOMInterface.h.
Referenced by maybeWaitForLabVIEWOrExit(), and waitForLabVIEW().
|
private |
the various lvDCOMOptions currently in use
Definition at line 108 of file lvDCOMInterface.h.
Referenced by checkForNewBlockDetails(), checkOption(), and report().
|
private |
Definition at line 106 of file lvDCOMInterface.h.
Referenced by createViRef().
|
private |
Definition at line 117 of file lvDCOMInterface.h.
Referenced by createViRef().
|
private |
Definition at line 103 of file lvDCOMInterface.h.
Referenced by lvDCOMInterface(), and report().
|
private |
Definition at line 114 of file lvDCOMInterface.h.
Referenced by DomFromCOM(), doXPATH(), doXPATHbool(), getParams(), lvDCOMInterface(), nParams(), and ~lvDCOMInterface().
|
staticprivate |
horrible - do properly some time
Definition at line 121 of file lvDCOMInterface.h.
Referenced by checkForNewBlockDetails(), and generateFilesFromSECI().
|
private |
Definition at line 105 of file lvDCOMInterface.h.
Referenced by createViRef(), and report().
|
private |
Definition at line 110 of file lvDCOMInterface.h.
Referenced by createViRef(), getViRef(), report(), and stopVis().
|
private |
Definition at line 119 of file lvDCOMInterface.h.
Referenced by doXPATHbool(), and report().
|
private |
Definition at line 118 of file lvDCOMInterface.h.