LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.net constructor doesn't see all the objects

I'm using LabVIEW 2013 and I'm trying to use a .net assembly to send command to our hardware through USB port. I couldn't following the path provided by software developer because I couldn't see all the object he sees. Any suggestion?  Thanks.

0 Kudos
Message 1 of 16
(4,479 Views)

Is this a custom DLL provided, or a Microsoft system assembly?  Sometimes the Microsoft system .NET assemblies are in subcategories you wouldn't anticipate.

 

Can you tell us the path in question?

0 Kudos
Message 2 of 16
(4,464 Views)

This is not a MicroSoft system assembly, this is an open source program called USBLibrary. 

0 Kudos
Message 3 of 16
(4,434 Views)

If it's open source, can you link to the download page where you got the DLL as well as the path(s) you think you should be able to find inside of it?

 

Also, are you certain it's a constructor you need?  It may actually be a static method or property, so instead of a constructor node you may need to use a property or invoke node, then right click, Select Class -> .NET -> Browse..., go to the DLL, and look again for static options (they start with [S]).

0 Kudos
Message 4 of 16
(4,428 Views)

The attached is the library, it has some source code in it. It's an awkward situation, because I don't know the .net and the software guys don't know LabVIEW, so it's hard to navigate through. 

0 Kudos
Message 5 of 16
(4,414 Views)

Still need to know which object it is you think you should see, but don't.

 

Many of the functions appear to have inputs from the mscorlib library, maybe you need to look there?

Message 6 of 16
(4,406 Views)

Kyle,

 

Thanks for pointing out the mscorlib, I think I need something from the library to get started, like the EventHandler. But the EventHandler needs two inputs, object and method, could you explain how I can generate these two items? I can wire the UsbHidPort constructor to the object, there's a red conversion dot, do you think it matters?

0 Kudos
Message 7 of 16
(4,400 Views)

At this point I think we really need to see a code snippet showing the C# code that you're trying to duplicate.

 

Any reference wire from a .NET node can be cast as an Object, so you really need to make sure you're using the correct one.  Just because the wire connects doesn't mean it's going to work.

0 Kudos
Message 8 of 16
(4,392 Views)

The .NET library as is, has likely a problem if you happen to have two or more of the same devices connected to your computer as it does not offer a way to distinguish them and you only identify a device by vendor_id and product_id.

 

The Event Handler you want to have is in LabVIEW implemented as a callback VI and then registered for the .Net reference as event. I attached a very rough, totally untested and in many ways completely insufficient VI that should show you the principles of accessing this library from LabVIEW. You will surely have to modify it heavily to get a useful library of functions, but it gives you an idea how the library can be accessed.USB Reader_Writer.png

Data Received Callback.png

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Download All
Message 9 of 16
(4,366 Views)

rolfk,

 

Thank you very much for the detailed help, looks it's what I need. I'm installing the latest LabVIEW so I can open your example, in the mean time, may I ask you a question? What are the object type of the two .NET constants in the callback vi? Do I need to change them to the appropriate types?

 

 

0 Kudos
Message 10 of 16
(4,346 Views)