ICP  1
instapi_lib.h
Go to the documentation of this file.
1 #ifndef INSTAPI_LIB_H
2 #define INSTAPI_LIB_H
3 
4 #ifdef INSTAPI_LIB_EXPORTS
5 #define INSTAPI_DLL __declspec(dllexport)
6 #else
7 #define INSTAPI_DLL __declspec(dllimport)
8 #endif
9 
10 #include "atlsafe.h"
11 #import "..\\tlb\\LabVIEW.tlb" named_guids
12 
13 struct ViRef
14 {
15  LabVIEW::VirtualInstrumentPtr vi_ref;
16  bool reentrant;
17 };
18 
20 {
21 private:
22  typedef std::map<ULONG, std::string> session_map_t;
24 
25  typedef std::map<std::wstring, ViRef> vi_map_t;
27  void getViRef(BSTR vi_name, bool reentrant, LabVIEW::VirtualInstrumentPtr &vi);
28  void createViRef(BSTR vi_name, bool reentrant, LabVIEW::VirtualInstrumentPtr &vi);
29  void accessRuncontrol(ULONG session_id, BSTR block_name, VARIANT_BOOL new_value, VARIANT_BOOL* value, bool setvalue);
30  void accessLimits(ULONG session_id, BSTR block_name, VARIANT new_value, BSTR* value, bool setvalue, bool low);
31  void setBlockSetpoint(ULONG session_id, BSTR block_name, VARIANT setpoint_value, bool push_button, bool use_external, VARIANT* results);
32 public:
33  static COAUTHIDENTITY* createIdentity(const std::string& user, const std::string& domain, const std::string& pass);
34  static HRESULT setIdentity(COAUTHIDENTITY* pidentity, IUnknown* pUnk);
35  HRESULT test();
36  HRESULT testicp();
37  HRESULT testlv();
38  // session functions
39  void createSession(BSTR instrument, BSTR user_name, BSTR password, ULONG* session_id);
40  void deleteSession(ULONG session_id);
41  void getRole(ULONG session_id, BSTR* role);
42  void setRole(ULONG session_id, BSTR role);
43  void putMessage(ULONG session_id, BSTR time, BSTR severity, BSTR message);
44  void getMessages(ULONG session_id, LONG start_index, BSTR min_severity, VARIANT* times, VARIANT* severities, VARIANT* messages, LONG* end_index);
45  void getBlockNames(ULONG session_id, VARIANT* block_names);
46  // block functions
47  void getBlockValue(ULONG session_id, BSTR block_name, VARIANT* block_value);
48  void getBlockSetpoint(ULONG session_id, BSTR block_name, VARIANT* setpoint_value);
49  void sendBlockSetpoint(ULONG session_id, BSTR block_name, VARIANT setpoint_value, bool push_button, bool use_external, VARIANT* results);
50  void getRunControl(ULONG session_id, BSTR block_name, VARIANT_BOOL* rc_value);
51  void setRunControl(ULONG session_id, BSTR block_name, VARIANT_BOOL rc_value);
52  void getRunControlLimit(ULONG session_id, BSTR block_name, VARIANT* limit_value, bool low);
53  void setRunControlLimit(ULONG session_id, BSTR block_name, VARIANT new_value, bool low);
54  void pushBlockButton(ULONG session_id, BSTR block_name, bool use_external, VARIANT* results);
55  void logBlocksNow(ULONG session_id, BSTR source);
56  // labview functions
57  void getLabviewValue(ULONG session_id, BSTR vi_name, BSTR control_name, VARIANT* value);
58  void setLabviewValue(ULONG session_id, BSTR vi_name, BSTR control_name, VARIANT value);
59  void setLabviewValueExt(ULONG session_id, BSTR vi_name, BSTR control_name, VARIANT value, VARIANT* results);
60  void callLabview(ULONG session_id, BSTR vi_name, VARIANT names, VARIANT values, VARIANT_BOOL reentrant, VARIANT* results);
61  void toggleViVisibility(ULONG session_id, BSTR vi_name, VARIANT_BOOL show);
62  void getViState(ULONG session_id, BSTR vi_name, VARIANT* value);
63  void startVi(ULONG session_id, BSTR vi_name);
64  void stopVi(ULONG session_id, BSTR vi_name);
65  void closeViFrontPanel(ULONG session_id, BSTR vi_name);
66  void getViNames(ULONG session_id, VARIANT* names);
67  // dae functions
68  void getRunState(ULONG session_id, BSTR* messages, LONG* status);
69  void beginRun(ULONG session_id, LONG period, VARIANT_BOOL wait, VARIANT_BOOL quiet, VARIANT_BOOL paused, BSTR* messages);
70  void abortRun(ULONG session_id, BSTR* messages);
71  void endRun(ULONG session_id, BSTR* messages);
72  void pauseRun(ULONG session_id, BSTR* messages);
73  void resumeRun(ULONG session_id, BSTR* messages);
74  void recoverRun(ULONG session_id, BSTR* messages);
75  void saveRun(ULONG session_id, BSTR* messages);
76  void updateCRPT(ULONG session_id, BSTR* messages);
77  void storeCRPT(ULONG session_id, BSTR* messages);
78  void getGoodFrames(ULONG session_id, VARIANT_BOOL curr_period, BSTR* messages, LONG* frames);
79  void getUamps(ULONG session_id, VARIANT_BOOL curr_period, BSTR* messages, DOUBLE* uamps);
80  void getMEvents(ULONG session_id, BSTR* messages, DOUBLE* mev);
81  void getCurrentPeriod(ULONG session_id, BSTR* messages, LONG *period, LONG* daq_period);
82  void getRunNumber(ULONG session_id, BSTR* messages, LONG* run_no);
83  void getTotalCounts(ULONG session_id, BSTR* messages, LONG* counts);
84  void snapshotCRPT(ULONG session_id, BSTR filename, LONG do_update, LONG do_pause, BSTR* messages);
85  void sumAllHistogramMemory(ULONG session_id, BSTR* messages, LONG* counts);
86  void sumAllSpectra(ULONG session_id, BSTR* messages, LONG* counts, LONG* bin_counts);
87  void setPeriod(ULONG session_id, LONG period_number, BSTR* messages);
88  void getSpectrum(ULONG session_id, LONG spectrum_no, LONG period, VARIANT_BOOL as_dist, VARIANT* time_channels, VARIANT* signal, LONG* sum, BSTR* messages);
89  void changeNumberOfSoftwarePeriods(ULONG session_id, LONG num_periods, BSTR* messages);
90  void getNumberOfPeriods(ULONG session_id, BSTR* messages, LONG* num_periods);
91  void vmeWriteValue(ULONG session_id, ULONG card_id, ULONG card_address, ULONG word_size, ULONG value, ULONG mode, BSTR* messages);
92  //Seci
93  void clearSeciGraphs(ULONG session_id);
94  void changeSeciConfiguration(ULONG session_id, BSTR name, VARIANT_BOOL* result);
95  void isSeciBusy(ULONG session_id, VARIANT_BOOL* result);
96  //Others
97  void setRbNumber(ULONG session_id, VARIANT rb_no);
98  void getRbNumber(ULONG session_id, VARIANT* rb_no);
99  void setTitle(ULONG session_id, VARIANT title);
100  void setBeamlineParameter(ULONG session_id, VARIANT name, VARIANT value, VARIANT units);
101  void deleteBeamlineParameter(ULONG session_id, VARIANT name);
102  void deleteAllBeamlineParameters(ULONG session_id);
103  void getBeamlineParameter(ULONG session_id, BSTR name, BSTR* value, BSTR* units, BSTR* type);
104  void getBeamlineParameterNames(ULONG session_id, VARIANT* names);
105  void setSampleParameter(ULONG session_id, VARIANT name, VARIANT value, VARIANT units);
106  void deleteSampleParameter(ULONG session_id, VARIANT name);
107  void deleteAllSampleParameters(ULONG session_id);
108  void getSampleParameter(ULONG session_id, BSTR name, BSTR* value, BSTR* units, BSTR* type);
109  void getSampleParameterNames(ULONG session_id, VARIANT* names);
110  void getSeciConfig(ULONG session_id, BSTR* name);
111  void clearDatabaseLogs(ULONG session_id, int run_num);
112  void clearLogFiles(ULONG session_id, int run_num, BSTR path);
113  void getMeasurementLabel(ULONG session_id, BSTR id, BSTR* label);
114  void setMeasurementLabel(ULONG session_id, BSTR id, BSTR label);
115  void getMeasurementId(ULONG session_id, BSTR label, VARIANT_BOOL newId, BSTR* id);
116 };
117 
118 
119 #endif /* INSTAPI_LIB_H */
std::map< std::wstring, ViRef > vi_map_t
Definition: instapi_lib.h:25
vi_map_t m_vimap
Definition: instapi_lib.h:26
static int test()
bool reentrant
Definition: instapi_lib.h:16
session_map_t m_session
Definition: instapi_lib.h:23
#define INSTAPI_DLL
Definition: instapi_lib.h:7
std::map< ULONG, std::string > session_map_t
Definition: instapi_lib.h:22
LabVIEW::VirtualInstrumentPtr vi_ref
Definition: instapi_lib.h:15