LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Device list

Solved!
Go to solution

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

0 Kudos
Message 1 of 11
(4,966 Views)
Solution
Accepted by adamenk

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 

 

______________
Florian Abry
Inside Sales Engineer, NI Germany
Message 2 of 11
(4,961 Views)

thanks, i will try it. Could you tell me, what syscfg exactly is? It is something like daqmx.lib?

0 Kudos
Message 3 of 11
(4,957 Views)

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 

______________
Florian Abry
Inside Sales Engineer, NI Germany
0 Kudos
Message 4 of 11
(4,954 Views)

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

0 Kudos
Message 5 of 11
(4,944 Views)

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

0 Kudos
Message 6 of 11
(4,942 Views)

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

Message 7 of 11
(4,934 Views)

@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...?

 

0 Kudos
Message 8 of 11
(4,918 Views)

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 

______________
Florian Abry
Inside Sales Engineer, NI Germany
Message 9 of 11
(4,911 Views)

Thanks Smiley Happy

0 Kudos
Message 10 of 11
(4,909 Views)