ISIS Logo
lvDCOM
An EPICS support module to export LabVIEW values as process variables
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
lvDCOMInterface Class Reference

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::_Applicationm_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...
 

Detailed Description

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.

Member Typedef Documentation

typedef std::map<std::wstring, ViRef> lvDCOMInterface::vi_map_t
private

Definition at line 109 of file lvDCOMInterface.h.

Constructor & Destructor Documentation

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

Parameters
[in]configSection
[in]configFilePath to the XML input file to load configuration information from.
[in]hosthost name where LabVIEW is running ("" for localhost)
[in]optionsoptions 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().

lvDCOMInterface::~lvDCOMInterface ( )
inline

Definition at line 89 of file lvDCOMInterface.h.

References m_pxmldom.

Member Function Documentation

void lvDCOMInterface::callLabview ( BSTR  vi_name,
VARIANT &  names,
VARIANT &  values,
VARIANT_BOOL  reentrant,
VARIANT *  results 
)
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().

bool lvDCOMInterface::checkOption ( lvDCOMOptions  option)
inlineprivate

Definition at line 136 of file lvDCOMInterface.h.

References m_options.

Referenced by createViRef(), epicsExitFunc(), lvDCOMInterface(), and maybeWaitForLabVIEWOrExit().

COAUTHIDENTITY * lvDCOMInterface::createIdentity ( const std::string &  user,
const std::string &  domain,
const std::string &  pass 
)
private

Definition at line 727 of file lvDCOMInterface.cpp.

Referenced by createViRef().

void lvDCOMInterface::createViRef ( BSTR  vi_name,
bool  reentrant,
LabVIEW::VirtualInstrumentPtr &  vi 
)
private
double lvDCOMInterface::diffFileTimes ( const FILETIME &  f1,
const FILETIME &  f2 
)
static

filetime uses 100ns units, returns difference in seconds

Definition at line 830 of file lvDCOMInterface.cpp.

Referenced by getLabviewUptime().

void lvDCOMInterface::DomFromCOM ( )
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().

char * lvDCOMInterface::envExpand ( const char *  str)
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().

void lvDCOMInterface::epicsExitFunc ( void *  arg)
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().

void lvDCOMInterface::getBlockDetails ( std::vector< std::vector< std::string > > &  values)
private

Definition at line 475 of file lvDCOMInterface.cpp.

References getLabviewValue(), and waitForLabVIEW().

Referenced by checkForNewBlockDetails(), and generateFilesFromSECI().

double lvDCOMInterface::getLabviewUptime ( )
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().

template<typename T >
void lvDCOMInterface::getLabviewValue ( const char *  param,
T *  value 
)
template<typename T >
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.

void lvDCOMInterface::getLabviewValue ( BSTR  vi_name,
BSTR  control_name,
VARIANT *  value 
)
private

Definition at line 1076 of file lvDCOMInterface.cpp.

References getViRef().

template<>
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.

std::string lvDCOMInterface::getLabviewValueType ( BSTR  vi_name,
BSTR  control_name 
)
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().

void lvDCOMInterface::getViRef ( BSTR  vi_name,
bool  reentrant,
LabVIEW::VirtualInstrumentPtr &  vi 
)
private

Definition at line 761 of file lvDCOMInterface.cpp.

References createViRef(), m_lock, and m_vimap.

Referenced by callLabview(), getLabviewValue(), and setLabviewValue().

void lvDCOMInterface::maybeWaitForLabVIEWOrExit ( )
private
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().

HRESULT lvDCOMInterface::setIdentity ( COAUTHIDENTITY *  pidentity,
IUnknown *  pUnk 
)
private

Definition at line 744 of file lvDCOMInterface.cpp.

Referenced by createViRef().

template<typename T >
void lvDCOMInterface::setLabviewValue ( const char *  param,
const T &  value 
)
void lvDCOMInterface::setLabviewValue ( BSTR  vi_name,
BSTR  control_name,
const VARIANT &  value 
)
private

Definition at line 1264 of file lvDCOMInterface.cpp.

References getViRef().

template<>
void lvDCOMInterface::setLabviewValue ( const char *  param,
const std::string &  value 
)
void lvDCOMInterface::setLabviewValueExt ( BSTR  vi_name,
BSTR  control_name,
const VARIANT &  value,
VARIANT *  results 
)
private

Definition at line 1277 of file lvDCOMInterface.cpp.

References callLabview(), and m_extint.

Referenced by setLabviewValue().

void lvDCOMInterface::stopVis ( bool  only_ones_we_started)
private

Definition at line 645 of file lvDCOMInterface.cpp.

References LabVIEW::eIdle, and m_vimap.

Referenced by epicsExitFunc().

double lvDCOMInterface::waitForLabVIEW ( )
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().

void lvDCOMInterface::waitForLabviewBoolean ( BSTR  vi_name,
BSTR  control_name,
bool  value 
)
private

Definition at line 1209 of file lvDCOMInterface.cpp.

References getLabviewValue().

Referenced by setLabviewValue().

Member Data Documentation

CLSID lvDCOMInterface::m_clsid
private

Definition at line 104 of file lvDCOMInterface.h.

Referenced by createViRef(), and lvDCOMInterface().

std::string lvDCOMInterface::m_configFile
private

Definition at line 101 of file lvDCOMInterface.h.

Referenced by lvDCOMInterface(), and report().

std::string lvDCOMInterface::m_configSection
private

section of configFile to load information from

Definition at line 100 of file lvDCOMInterface.h.

Referenced by getLabviewValue(), getParams(), nParams(), report(), and setLabviewValue().

CComBSTR lvDCOMInterface::m_extint
private

Definition at line 115 of file lvDCOMInterface.h.

Referenced by lvDCOMInterface(), and setLabviewValueExt().

std::string lvDCOMInterface::m_host
private

Definition at line 102 of file lvDCOMInterface.h.

Referenced by createViRef(), lvDCOMInterface(), and report().

epicsMutex lvDCOMInterface::m_lock
private

Definition at line 111 of file lvDCOMInterface.h.

Referenced by doXPATH(), doXPATHbool(), getLabviewUptime(), and getViRef().

CComPtr<LabVIEW::_Application> lvDCOMInterface::m_lv
private

Definition at line 116 of file lvDCOMInterface.h.

Referenced by createViRef().

MAC_HANDLE* lvDCOMInterface::m_mac_env
private

Definition at line 120 of file lvDCOMInterface.h.

Referenced by envExpand(), generateFilesFromSECI(), and lvDCOMInterface().

double lvDCOMInterface::m_minLVUptime = 60.0
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().

int lvDCOMInterface::m_options
private

the various lvDCOMOptions currently in use

Definition at line 108 of file lvDCOMInterface.h.

Referenced by checkForNewBlockDetails(), checkOption(), and report().

std::string lvDCOMInterface::m_password
private

Definition at line 106 of file lvDCOMInterface.h.

Referenced by createViRef().

COAUTHIDENTITY* lvDCOMInterface::m_pidentity
private

Definition at line 117 of file lvDCOMInterface.h.

Referenced by createViRef().

std::string lvDCOMInterface::m_progid
private

Definition at line 103 of file lvDCOMInterface.h.

Referenced by lvDCOMInterface(), and report().

IXMLDOMDocument2* lvDCOMInterface::m_pxmldom
private
std::vector< std::vector< std::string > > lvDCOMInterface::m_seci_values
staticprivate

horrible - do properly some time

Definition at line 121 of file lvDCOMInterface.h.

Referenced by checkForNewBlockDetails(), and generateFilesFromSECI().

std::string lvDCOMInterface::m_username
private

Definition at line 105 of file lvDCOMInterface.h.

Referenced by createViRef(), and report().

vi_map_t lvDCOMInterface::m_vimap
private

Definition at line 110 of file lvDCOMInterface.h.

Referenced by createViRef(), getViRef(), report(), and stopVis().

std::map<std::string,bool> lvDCOMInterface::m_xpath_bool_map
private

Definition at line 119 of file lvDCOMInterface.h.

Referenced by doXPATHbool(), and report().

std::map<std::string,std::string> lvDCOMInterface::m_xpath_map
private

Definition at line 118 of file lvDCOMInterface.h.

Referenced by doXPATH(), and report().


The documentation for this class was generated from the following files:
Copyright © 2013 Science and Technology Facilities Council | Generated by   doxygen 1.8.5