11 #ifndef LV_DCOM_INTERFACE_H
12 #define LV_DCOM_INTERFACE_H
23 #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
41 #include <epicsMutex.h>
42 #include <epicsThread.h>
43 #include <epicsExit.h>
59 LabVIEW::VirtualInstrumentPtr
vi_ref;
83 lvDCOMInterface(
const char* configSection,
const char *configFile,
const char* host,
int options,
const char* progid,
const char* username,
const char* password);
85 void getParams(std::map<std::string,std::string>& res);
86 template<
typename T>
void setLabviewValue(
const char* param,
const T& value);
88 template<
typename T>
void getLabviewValue(
const char* param, T* value,
size_t nElements,
size_t& nIn);
90 std::string
doPath(
const std::string& xpath);
91 std::string
doXPATH(
const std::string& xpath);
93 void report(FILE* fp,
int details);
94 static double diffFileTimes(
const FILETIME& f1,
const FILETIME& f2);
95 int generateFilesFromSECI(
const char* portName,
const char* macros,
const char* configSection,
const char* configFile,
96 const char* dbSubFile,
const char* blocks_match,
bool no_setter);
116 CComPtr<LabVIEW::_Application>
m_lv;
125 void getViRef(BSTR vi_name,
bool reentrant, LabVIEW::VirtualInstrumentPtr &vi);
126 void createViRef(BSTR vi_name,
bool reentrant, LabVIEW::VirtualInstrumentPtr &vi);
128 void setLabviewValue(BSTR vi_name, BSTR control_name,
const VARIANT& value);
129 void setLabviewValueExt(BSTR vi_name, BSTR control_name,
const VARIANT& value, VARIANT* results);
130 void callLabview(BSTR vi_name, VARIANT& names, VARIANT& values, VARIANT_BOOL reentrant, VARIANT* results);
132 COAUTHIDENTITY*
createIdentity(
const std::string& user,
const std::string& domain,
const std::string& pass);
133 HRESULT
setIdentity(COAUTHIDENTITY* pidentity, IUnknown* pUnk);
135 void stopVis(
bool only_ones_we_started);
lvDCOMOptions
Options that can be passed from EPICS iocsh via lvDCOMConfigure command.
COAUTHIDENTITY * m_pidentity
std::string m_configSection
section of configFile to load information from
(4) On IOC exit, stop any LabVIEW VIs that we started due to viStartIfIdle being specified ...
CComPtr< LabVIEW::_Application > m_lv
bool checkForNewBlockDetails()
bool started
did we start this vi because it was idle and viStartIfIdle was specified
void waitForLabviewBoolean(BSTR vi_name, BSTR control_name, bool value)
(8) On IOC exit, stop any LabVIEW VIs that we have connected to
std::string doPath(const std::string &xpath)
IXMLDOMDocument2 * m_pxmldom
void callLabview(BSTR vi_name, VARIANT &names, VARIANT &values, VARIANT_BOOL reentrant, VARIANT *results)
static std::vector< std::vector< std::string > > m_seci_values
horrible - do properly some time
void report(FILE *fp, int details)
Helper for EPICS driver report function.
(16) Do not start LabVIEW, connect to existing instance otherwise fail. As loading a Vi starts labvie...
bool reentrant
is the VI reentrant
double waitForLabVIEW()
wait for LabVIEW to have been running for m_minLVUptime seconds
int m_options
the various lvDCOMOptions currently in use
std::map< std::string, bool > m_xpath_bool_map
void getParams(std::map< std::string, std::string > &res)
(32) Automatically set if lvDCOMSECIConfigure() has been used
std::string doXPATH(const std::string &xpath)
std::map< std::string, std::string > m_xpath_map
void getBlockDetails(std::vector< std::vector< std::string > > &values)
double getLabviewUptime()
returns -1.0 if labview not running, else labview uptime in seconds
static void epicsExitFunc(void *arg)
void stopVis(bool only_ones_we_started)
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
void maybeWaitForLabVIEWOrExit()
static double m_minLVUptime
minimum time labview must be running before connection made in "lvNoStart" mode
Manager class for LabVIEW DCOM Interaction. Parses an lvinput.xml file and provides access to the Lab...
void setLabviewValue(const char *param, const T &value)
std::map< std::wstring, ViRef > vi_map_t
ViRef(LabVIEW::VirtualInstrumentPtr vi_ref_, bool reentrant_, bool started_)
HRESULT setIdentity(COAUTHIDENTITY *pidentity, IUnknown *pUnk)
(1) If the LabVIEW VI is idle when we connect to it, issue a warning message
Hold a reference to a LabVIEW VI.
void getLabviewValue(const char *param, T *value)
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 r...
(2) If the LabVIEW VI is idle when we connect to it, attempt to start it
static double diffFileTimes(const FILETIME &f1, const FILETIME &f2)
filetime uses 100ns units, returns difference in seconds
(64) Do not generate setter XML / :SP PVs in SECI mode
COAUTHIDENTITY * createIdentity(const std::string &user, const std::string &domain, const std::string &pass)
bool checkOption(lvDCOMOptions option)
void createViRef(BSTR vi_name, bool reentrant, LabVIEW::VirtualInstrumentPtr &vi)
void setLabviewValueExt(BSTR vi_name, BSTR control_name, const VARIANT &value, VARIANT *results)
char * envExpand(const char *str)
expand epics environment strings using previously saved environment based on EPICS macEnvExpand() ...
LabVIEW::VirtualInstrumentPtr vi_ref
bool doXPATHbool(const std::string &xpath)
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
void getViRef(BSTR vi_name, bool reentrant, LabVIEW::VirtualInstrumentPtr &vi)