CanQueryDeviceName


Function

Retrieves the list of available devices.

Format

Ret = CanQueryDeviceName ( Index , DeviceName , Device )

Parameters

Index [ VB.NET: Short ] [ C, C++: short ] [ C#: short ]
This parameter should be zero for the first call and then be incremented for subsequent calls.

DeviceName [ VB.NET: String ] [ C, C++: char * ] [ C#: out string ]
Returns the device name. (For example: "CAN000")

Device [ VB.NET: String ] [ C, C++: char * ] [ C#: out string ]
Returns the board name. (For example: "CAN-4P-PE")

Return Value

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ]

Definition

Value
[Dec]

Description

CAN_ERR_SUCCESS

0

Normality completion

CAN_ERR_INFO_NOT_FIND_DEVICE

10051

Not find the available device.
Please confirm whether the device has been registered in Device Manager.

The others (See also: Details of Error Code)

Initial Value

None

Remarks

This function can be used when you create a general-purpose application that you can select a device you want to use.
The Index is set to zero for the first call. And then it should be incremented for subsequent calls until the function returns error.

For C, C++

for (int Index = 0; Ret CAN_ERR_SUCCESS; Index++){
    Ret = CanQueryDeviceName ( Index , DeviceName , Device );
}
 

Example

Retrieves the information of the device by Index=0.

VB.NET

Dim Ret As Integer
Dim DeviceName As String = Space(256)
Dim Device As String = Space(256)
Ret = CanQueryDeviceName ( 0 , DeviceName , Device )
 

C, C++

long Ret;
char DeviceName[256];
char Device[256];
Ret = CanQueryDeviceName ( 0 , DeviceName , Device );
 

C#

int Ret;
string DeviceName;
string Device;
Ret = dio.QueryDeviceName ( 0 , out DeviceName , out Device );
 

See Also

None