19 if (!rResourceManager.Initialize())
24 if (!rResourceManager.FindResources(l_InstrumentList, IEEE4888_TEST_RESOURCE_FILTER) || l_InstrumentList.empty())
28 rInstrumentName = l_InstrumentList.front();
32 std::cout <<
"l_CManagerException: " << rE.
what() << std::endl;
40bool ConnectToIEEE488Instrument (IEEE4888_TEST_RESOURCE_MANAGER_CLASS * & rpResourceManager, IEEE4888_TEST_INSTRUMENT_CLASS * & rpInstrument)
45 rpResourceManager =
new IEEE4888_TEST_RESOURCE_MANAGER_CLASS;
53 rpInstrument =
new IEEE4888_TEST_INSTRUMENT_CLASS(*rpResourceManager, l_InstrumentName);
54 if (
nullptr == rpInstrument)
58 if (!rpInstrument->Open())
63 std::cout <<
"l_CManagerException: " << rE.
what() << std::endl;
64 rpInstrument =
nullptr;
72 std::string l_ID = std::string(rBuffer.
begin(), rBuffer.
end());
73 std::regex l_Regex(
"([^,]+), *([^,]+), *([^,]+), *([^,]+)");
75 if (!std::regex_match(l_ID, l_Match, l_Regex))
78 std::string l_Manufacturer = l_Match[1].str();
79 std::string l_Model = l_Match[2].str();
80 std::string l_SerialNumber = l_Match[3].str();
81 std::string l_Versions = l_Match[4].str();
83 l_Regex =
"(Metrolab.*)|(NATIONAL INSTRUMENTS)";
84 if (!std::regex_match(l_Manufacturer, l_Regex))
87 l_Regex =
"(0x1234)|([0-9]+)";
88 if (!std::regex_match(l_SerialNumber, l_Regex))
91 l_Regex =
"((THM1176)|(TFM1186)|(PT2026)|(FDI2056)|(SIMPLE IEEE 488.2 DEVICE)).*";
92 if (!std::regex_match(l_Model, l_Regex))
95 if (l_Model.compare(0, 7,
"THM1176") == 0)
96 l_Regex =
"el(([A-Z])([0-9]+))-pr(([A-Z])([0-9]+))-fw(([0-9]+)\\.([0-9]+))\\n";
97 else if (l_Model.compare(
"SIMPLE IEEE 488.2 DEVICE") == 0)
101 if (!std::regex_match(l_Versions, l_Regex))
Exception handling utilities.
Collection of utility macros for error messages.
bool ConnectToIEEE488Instrument(IEEE4888_TEST_RESOURCE_MANAGER_CLASS *&rpResourceManager, IEEE4888_TEST_INSTRUMENT_CLASS *&rpInstrument)
Connect to an IEEE488Instrument.
bool FetchIEEE4888Resource(IEEE4888_TEST_RESOURCE_MANAGER_CLASS &rResourceManager, tResourceName &rInstrumentName)
Open a connection to the Resource Manager and find an IEEE488Instrument.
bool CheckIDNResponse(const CSCPIBuffer &rBuffer)
Sanity-check of the response to an *IDN? query.
Utility functions used to test IEEE488Instrument API.
virtual const char * what() const noexcept
Return string describing what happened.
List of VISA resource names.
std::vector< MTL_INSTRUMENT_BUFFER_TYPE >::iterator end()
Return an iterator to the end of the buffer.
std::vector< MTL_INSTRUMENT_BUFFER_TYPE >::iterator begin()
Return an iterator to the beginning of the buffer.
std::string tResourceName
IEEE488 resource name.