I am using VB.NET in Visual Studio Community with a number of U3s and U6s. I am trying to discover all connected devices at the start of the application through the use of ListAll or ListAllS. Documentation in 2.5.3 describes the use of the string "ANY" for DeviceType and ConnectionType in ListAllS but I cannot get that to work. I keep getting an error returned unless I place LJUD.DEVICE.U3 or LJUD.DEVICE.U6 and LJUD.CONNECTION.USB in the function call.
Can you provide a VB.NET code snippet to show the syntax I should be using?
It sounds like you are using the LJM library documentation for ListAll which supports "ANY" for device and connection type. The U3 and U6 use the UD library and are not supported in the LJM library. The UD library's version of ListAll does not support "ANY". The device and connection type need to be specified. General UD ListAll documentation can be found here:
https://labjack.com/support/software/api/ud/function-reference/listall
Here's a code snippet for using ListAll with the U3 and U6:
Dim numFound As Integer
Dim serialNumbers(127) As Integer ' 128 elements minimum
Dim ids(127) As Integer ' 128 elements minimum
Dim addresses(127) As Double ' 128 elements minimum
Console.WriteLine("Found the following devices:")
' Search for U3s and display results in console.
numFound = 0
LJUD.ListAll(LJUD.DEVICE.U3, LJUD.CONNECTION.USB, numFound, serialNumbers, ids, addresses)
If numFound > 0 Then
For i As Integer = 0 To numFound - 1
' Not displaying addresses as IP addresses do not apply to the U3.
Console.WriteLine(" U3: Serial # = {0}, Local ID = {1}", serialNumbers(i), ids(i))
Next
End If
' Search for U6s and display results in console
numFound = 0
LJUD.ListAll(LJUD.DEVICE.U6, LJUD.CONNECTION.USB, numFound, serialNumbers, ids, addresses)
If numFound > 0 Then
For i As Integer = 0 To numFound - 1
' Not displaying addresses as IP addresses do not apply to the U6.
Console.WriteLine(" U6: Serial # = {0}, Local ID = {1}", serialNumbers(i), ids(i))
Next
End If
Excellent. Many thanks for the clarification and the code snippet.