08-23-2012 08:16 AM
Hi,
Can I get device list using DAQmx and ANSI C? How can I do it? Which function should I use? I was looking for solution in the internet, but I found only for c#: http://zone.ni.com/devzone/cda/epd/p/id/5818 . Is it possible in ANSI C too?
Thanks for reply
Solved! Go to Solution.
08-23-2012 09:15 AM
Hi adam,
it is possible with the system configuration API from CVI. here a code snippet showing you the base architecture:
#include "nisyscfg.h" #include <ansi_c.h> static NISysCfgEnumExpertHandle cfgHandle; static char hardwareName[255]; static NISysCfgResourceHandle hHardware; static NISysCfgEnumResourceHandle enumHardware; static NISysCfgSessionHandle sHandle; void main (void) { NISysCfgInitializeSession ("localhost", NULL, NULL, NISysCfgLocaleDefault, NISysCfgBoolTrue, 10000, &cfgHandle, &sHandle); NISysCfgFindHardware (sHandle, NISysCfgFilterModeMatchValuesAll, NULL, NULL, &enumHardware); NISysCfgNextResource (sHandle, enumHardware, &hHardware); NISysCfgGetResourceProperty (hHardware, NISysCfgResourcePropertyProductName, &hardwareName); printf ("name: %s", hardwareName); getchar(); }
With NISysCfgNextResource you can browse through the ressources and NISysCfgGetResourceProperty allows you to get a wide range of properties,m including the device kind, the serial number... etc
let me know if you have further questions
Cheers
08-23-2012 09:25 AM
thanks, i will try it. Could you tell me, what syscfg exactly is? It is something like daqmx.lib?
08-23-2012 09:32 AM
syscfg is the System Configuration API. It is defined in the CVI Help as:
"The NI System Configuration Application Programming Interface (API) for LabWindows/CVI gathers information about devices on both local and remote systems. Use the NI System Configuration API to programmatically reboot a system, save and load system images, install and uninstall software, and obtain information about a system to be used in other applications."
It was formerly known as the MAX API. You can see it as a library which allows you to communicate with measurment and Automation Explorer and, that way, get the system configuration of the Softwares (NI Softwares only) and Hardware of a local or remote system.
You can get most of the necessary information in the help of CVI under <Library Reference\ NI System Configuration Library>
Bers regards
08-24-2012 01:33 AM
How can I find ansi_c.h? I was looking for it in National Instruments ProgramFiles directory, but i didn't find. Without this header, i've got an error:
Error 1 error C2065: 'NISysCfgFilterModeMatchValuesAll' : undeclared identifier
08-24-2012 01:37 AM - edited 08-24-2012 01:40 AM
ahh, I'm sorry, I just found a solution. I used NISysCfgFilterModeAll instead.
I've got one more question: what is the difference between \Bin\msvc\nisyscfg.lib(size: 141kB) and ExtLib\msvc\nisyscfg.lib(size: 78kB)? I know the size is d
08-24-2012 02:32 AM
Hi,
Please keep the forum searchable and clear.
Please mark the topic as solved and open a new one for your new question!
Thanks,
Peter
08-24-2012 04:11 AM
@Naity wrote:
it is possible with the system configuration API from CVI. here a code snippet showing you the base architecture:
#include "nisyscfg.h" #include <ansi_c.h> static NISysCfgEnumExpertHandle cfgHandle; static char hardwareName[255]; static NISysCfgResourceHandle hHardware; static NISysCfgEnumResourceHandle enumHardware; static NISysCfgSessionHandle sHandle; void main (void) { NISysCfgInitializeSession ("localhost", NULL, NULL, NISysCfgLocaleDefault, NISysCfgBoolTrue, 10000, &cfgHandle, &sHandle); NISysCfgFindHardware (sHandle, NISysCfgFilterModeMatchValuesAll, NULL, NULL, &enumHardware); NISysCfgNextResource (sHandle, enumHardware, &hHardware); NISysCfgGetResourceProperty (hHardware, NISysCfgResourcePropertyProductName, &hardwareName); printf ("name: %s", hardwareName); getchar(); }
Sticking to the original question: It appears that the system configuration API is not installed as a standard, probably only if MAX is installed. After a new install of CVI2012 without device drivers I am unable to find these files.
So may be one should better call it system configuration API for CVI...?
08-24-2012 04:52 AM
Yes, you are right,
It is a separated component which is part of the device drivers. it can also be installed separately but MAX is part of the install (I never tried though to install it while explicitely disabling MAX install).
NI System Configuration 5.3.2 - Windows Server 2003 R2 32-bit/XP/7 32-bit/Vista 64-bit/Vista 32-bit/7 64-bit/Server 2008 R2 64-bit, Real-Time OS
http://joule.ni.com/nidu/cds/view/p/id/3336/lang/en
@Wolfgang wrote:So may be one should better call it system configuration API for CVI...?
It is actually its official name called (NI System Configuration Function Reference for LabWindows™/CVI™). My mistake.
Best regards
08-24-2012 05:10 AM
Thanks