FindAllCOMDevices Method - neoVI API

This function is deprecated. Use FindNeoDevices instead.

This method returns the number of COM (both serial and USB serial) hardware devices connected to the PC.

int _stdcall icsneoFindAllCOMDevices(int lDriverType,
int lGetSerialNumbers,
int lStopAtFirst,
int lUSBCommOnly,
int *p_lDeviceTypes,
int *p_lComPorts,
int *p_lSerialNumbers,
int *lNumDevices);

Parameters

lDriverType

[in] Specifies which neoVI driver to use. This should always be set to INTREPIDCS_DRIVER_STANDARD (0).

lGetSerialNumbers

[in] Specifies whether the serial numbers should be read from the device (iGetSerialNumbers=1). Getting serial numbers will take longer than not doing it therefore so set this to zero if not required for the application. If a device is already opened the serial number cannot be read.

lStopAtFirst

[in] Indicates whether the function should stop at the first device found (lStopAtFirst=1). This is useful when you only have one device connected to the PC.

lUSBCommOnly

[in] Indicates to search USB serial devices only (lUSBCommOnly=1). Normal COM ports will not be searched. Normal COM port searches will take longer to execute.

p_lDeviceTypes

[out] Pointer to array of at least 255 elements. This array will be filled in with the type of device found. The valid device types include INTREPIDCS_DEVICE_NEO4 (0), INTREPIDCS_DEVICE_VCAN (1), or INTREPIDCS_DEVICE_NEO6 (2).

p_lComPorts

[out] Pointer to array of at least 255 elements. This array will be filled in with the com port numbers of each connected device.

p_lSerialNumbers

[out] Pointer to array of at least 255 elements. This array will be filled in with the serial number of each device if argument lGetSerialNumbers=1.

iNumDevices

[out] Points to a value which contains the number of devices found.

Return Values

If this function operates successfully the return value will be 1. If the function fails the return value will be zero.

Remarks

None.

Examples

Opens first device on USB Com port either a ValueCAN or neoVI PRO

int iDeviceTypes[255];
int iComPort[255];
int iSerialNum[255];
int iOpenedStates[255];
int iDeviceNumbers[255];
int iNumDevices;

if (icsneoFindAllCOMDevices(INTREPIDCS_DRIVER_STANDARD, 0,1,1,iDeviceTypes,iComPort,iSerialNum,&iNumDevices))
{

    if (iNumDevices > 0)
    {

        lResult = icsneoOpenPortEx(iComPort[0] ,NEOVI_COMMTYPE_RS232,
                                                                        INTREPIDCS_DRIVER_STANDARD,0,57600,1,bNetworkID, &hObject);

    if (lResult == 0)
        MessageBox(hWnd,TEXT("Problem Opening Port"),TEXT("neoVI Example"),0);
    else
    {

            MessageBox(hWnd,TEXT("Port Opened Successfully"),TEXT("neoVI Example"),0);
        }

    }
}
else
    MessageBox(hWnd,TEXT("Problem Opening Port"),TEXT("neoVI Example"),0);

}
else

    MessageBox(hWnd,TEXT("Problem Opening Port"),TEXT("neoVI Example"),0);

Last updated