FindNeoDevices Method - intrepidcs API¶
C/C++ declare - VB.NET declare - C# declare - Parameters - Return Values - Remarks - C/C++ example - VB.NET example - C# example
This method returns the neoVI hardware devices connected to the PC.
C/C++ Declare¶
int _stdcall icsneoFindNeoDevices(unsigned long DeviceTypes, NeoDevice *pNeoDevices, int *pNumberOfDevices);
Visual Basic .NET Declare¶
Public Declare Function icsneoFindNeoDevices Lib “icsneo40.dll” (ByVal DeviceTypes As UInt32, ByRef pNeoDevice As NeoDevice, ByRef pNumDevices As Int32) As Int32
C# Declare¶
[DllImport(“icsneo40.dll”)] public static extern Int32 icsneoFindNeoDevices(UInt32 DeviceTypes, ref NeoDevice pNeoDevice, ref Int32 pNumDevices);
Parameters¶
- DeviceTypes
[in] Specifies the types of neoVI devices to find. Currently supported values are:
Constants are defined in appropriate header or module. You may use logical OR to choose which devices to look for or use NEODEVICE_ALL to specify all devices.
pNeoDevices [out] This is the address of the first element of an array of NeoDevice structure. This array can be as big as 255 devices. You must specify the size of the pNeoDevices array in the pNumberOfDevices parameter. The number of devices found will be limited to the value of pNumberofDevices or 255, whichever is lower. Each returned NeoDevice structure will contain information for each device such as its type, device ‘handle’ and serial number.
- pNumberOfDevices
- [in/out] In: Specifies the size of the pNeoDevices array. Must be in the range 0 to 255.
Out: Specifies the number of neo devices that were found. This can be in the range 0 to 255.
Return Values¶
1 if the function succeeded. 0 if it failed for any reason. If the function succeeds but no devices are found 1 will still be returned and pNumberOfDevices will equal 0.
Remarks¶
The NeoDevice array elements that are returned with this function may be passed to OpenNeoDevice so that individual neoVI devices can be opened.
Examples¶
C/C++ Example:¶
NeoDevice Devices[255];
unsigned long lDevTypes;
int iNumDevices = 255;
int iRetVal = 0;
int lDevTypes;
lDevTypes = NEODEVICE_ALL;
iRetVal = icsneoFindNeoDevices(lDevTypes, Devices, &iNumDevices);
C# Example:¶
int iResult;//Holds the results from function call
NeoDevice ndNeoToOpen = new NeoDevice(); ; //Struct holding detected hardware information
int iNumberOfDevices; //Number of hardware devices to look for
int lDevTypes; //Holds the device types to look for
lDevTypes = NEODEVICE_ALL;
//Set the number of devices to find
iNumberOfDevices = 1;
//Search for connected hardware
iResult = icsNeoDll.icsneoFindNeoDevices(65535, ref ndNeoToOpen, ref iNumberOfDevices);
if (iResult == 0)
{
MessageBox.Show("Problem finding devices");
return;
}
Visual Basic .NET Example:¶
Dim iResult As Integer '//Holds the results from function call
Dim ndNeoToOpen As NeoDevice '//Struct holding detected hardware information
Dim iNumberOfDevices As Integer '//Number of hardware devices to look for
Dim lDevTypes As Integer '//Holds the device types to look for
'//Set the devices to look for
lDevTypes = NEODEVICE_ALL
'//Set the number of devices to find
iNumberOfDevices = 1
'//Search for connected hardware
iResult = icsneoFindNeoDevices(lDevTypes, ndNeoToOpen, iNumberOfDevices)
If (iResult = 0) Then MsgBox("Problem finding devices")