12-15-2011 02:46 PM
I see that I can create simulated devices in NI MAX. Is it possible to automatically create simulated devices? I want to unit test software as part of an automated deployment process
Solved! Go to Solution.
12-16-2011 02:50 PM
Hi Chris_c++,
You can export a .INI file from MAX that describes the simulated devices and import it: Import and Export a MAX Configuration Through LabVIEW.
I bet your next question is "how can I do that from C++"? It is possible to use the NI System Configuration API from C or C++, but you have to explicitly select CVI support during installation, even if you're not using CVI. The header file and a MSVC-compatible CVI import library should get installed somewhere under %ProgramFiles%\National Instruments\Shared\CVI.
Brad
12-16-2011 03:15 PM - edited 12-16-2011 03:19 PM
Let us know how that go.
12-18-2011 07:30 PM
I am having trouble finding a header with system configuration functions. Can you be more specific?
Thanks,
Chris
12-19-2011 01:30 PM - edited 12-19-2011 01:31 PM
Hi Chris,
Sorry, I thought the NI System Configuration >> LabWindows/CVI feature showed up when you install NI-DAQmx (after you select "Custom"), but it doesn't.
Here's what you need to do:
Brad
12-20-2011 08:43 AM
This seems to be a good solution.
Thank you.
12-30-2013 08:02 AM
i would like to create a simulated device using c++. i found the cvi api and its documentation, but cannot find a function to create a (simulated) device.
could you point me in the right direction?
thanx!
01-02-2014 11:05 AM
Hi mael15,
You can export a .INI file from MAX that describes the simulated devices and import it using NISysCfgImportConfiguration().
Brad
01-02-2014 02:00 PM - edited 01-02-2014 02:07 PM
thanx, but it just does not work:
NISysCfgEnumExpertHandle expertEnumHandle;
NISysCfgSessionHandle sessionHandle; NISysCfgInitializeSession(NULL, NULL, NULL, NISysCfgLocaleGerman, NISysCfgBoolFalse, 0, &expertEnumHandle, &sessionHandle); const char path2[100] = "C:/existing/path/configData.nce";
NISysCfgStatus stat = NISysCfgImportConfiguration(&sessionHandle, path2, NULL, NISysCfgImportMergeItems, NULL);
this gets me a NISysCfg_InvalidArg (-2147024809)
i thought this can only be about the path?
const char path2[100] = "C:\\existing\\path\\configData.nce";
does not work either.
what am i missing?!?
the nce file is working.
01-02-2014 02:28 PM
Hi mael15,
NISysCfgInitializeSession() takes a NISysCfgSessionHandle* and NISysCfgImportConfiguration() takes a NISysCfgSessionHandle, but you're passing &sessionHandle to both. Since NISysCfgSessionHandle is a typedef for void*, using the wrong level of indirection doesn't produce a compiler warning/error. Try passing sessionHandle to NISysCfgImportConfiguration().
Brad