From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Add CAN channels from XNET database programmatically using the System Definition .NET API

Solved!
Go to solution

I am creating system definitions programmatically using the System Definition API. The only thing I cannot figure out how to do is add CAN channels from a linked database. For example, I want to add channels under the Incoming/Single-Point section. I've discovered that in the .NET API I can add a SignalBasedFrame object to the SinglePoint section, but here I need to specify the frame ID, payload length, signal names, etc.

 

Is there a way to pull this information automatically from the database file?

 

Any help is greatly appreciated.

0 Kudos
Message 1 of 9
(5,605 Views)

Hey aweiss47, 

 

There is a VeriStand help file which you will probably find useful for that:

http://zone.ni.com/reference/en-XX/help/372846G-01/vsnetapis/lv_sysdef_creating/

 

There is an XNET Databases class in the System Definition API which should allow you to add one programmatically to the System Definition of your project!

0 Kudos
Message 2 of 9
(5,589 Views)

Hi Siana,

 

Thanks for your response. 

 

I had come across that link before, but It looks to me like I need to manually enter fame info that is already contained in the database (specifically Part 2, Step 6 in the help file).

 

Is there a way to get, say, a list of all frames contained in the database file, similar to the "Import NI-XNET Frames" dialog in VeriStand?

 

In the simplest case I want to add every single incoming frame from the linked database.

 

Thanks,

Adam

 

0 Kudos
Message 3 of 9
(5,579 Views)

Hi Adam,

 

I'm fairly certain there is a property of the XNET Database that would either allow you to access its frames directly or access the XNET Clusters containing the frames. This forum post might be helpful in that regard:

http://forums.ni.com/t5/NI-VeriStand/adding-xnet-can-channels-using-veristand-api/td-p/2308006

0 Kudos
Message 4 of 9
(5,559 Views)

So in a very basic form, this would get you all the frames in an XNET database, part of the Measurment I/O pallete

 

framesFromDatabase.png



I saw my father do some work on a car once as a kid and I asked him "How did you know how to do that?" He responded "I didn't, I had to figure it out."
0 Kudos
Message 5 of 9
(5,548 Views)

Hello,

 

Thanks for the replies. This is exactly what I needed.

 

One last question:

 

How do I create the XNET Database object from either the Database .NET Object, or from the database file path? I know I can create a control and manually select the database but I need to do this programmatically.

 

 

0 Kudos
Message 6 of 9
(5,515 Views)

There is a vi called "XNET Database Get List" that will return the names and associated db files of all the configured XNET databases, it's located in the same palette and there are VIs to create/delete XNET dbs as well.



I saw my father do some work on a car once as a kid and I asked him "How did you know how to do that?" He responded "I didn't, I had to figure it out."
0 Kudos
Message 7 of 9
(5,513 Views)

The problem is this VI returns strings and paths, but I need the XNET Database object to feed to the property node and I don't see anything else in the XNET palette that will create this.

 

Any ideas?

0 Kudos
Message 8 of 9
(5,506 Views)
Solution
Accepted by topic author aweiss47

The strings it returns are the XNET db alias names, with LabVIEW IO (XNET objects, DAQ tasks, etc) you can generally provide the input as a string and it should still work.

 

Alternatively you could type cast the alias name as an XNET db object and that would give you the strict type so that property or method nodes you might wire up will adjust to the type wired.  Either way should work fine though.

 

xnetDBAlias.png



I saw my father do some work on a car once as a kid and I asked him "How did you know how to do that?" He responded "I didn't, I had to figure it out."
Message 9 of 9
(5,501 Views)