LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Config Management

Highlighted

Config Management

Hi all,

 

first off, I am new to CVI. I know how to do these things in other languages, but am unsure how to achieve this in CVI. So I have a couple of questions that are probably beginner questions.

 

I was wondering how to implement a good config management in my software, so the users can configure the hardware in a dialog and save/load it to/from file.

In LabVIEW I used to create a cluster with all the options and put that cluster into an array, so the user can configure as many channels as they like. Can I do something similar in CVI? Looking through the palettes and examples I found no way to even group front panel elements in a significant way.

Is there something I am missing or would I have to build a mask somehow populate it with the data?

 

As for the File I/O: I usually use XML files to store and load the data. This is convenient in most languages because you can just flatten data to XML and in reverse. When looking at the XML examples it looks like CVI does not support this kind of functionality. Do I really have to format my structures to XML by hand?

 

I'm also open to other approaches, there's probably a lot I have not yet considered. Thanks in advance for your help!



Remember Cunningham's Law
0 Kudos
Message 1 of 6
(150 Views)

Re: Config Management

One way of implementing this would be as a tree control. Is there a way to integrate the channel selector into a cell?

From the DAQmx examples I get, that you can create channel selector drop downs as:

NIDAQmx_NewPhysChanAOCtrl(panelHandle,PANEL_CHANNEL,0);

Is there a way to pass the cell reference instead of PANEL_CHANNEL?



Remember Cunningham's Law
0 Kudos
Message 2 of 6
(122 Views)

Rif.: Config Management

The way I am normally addressing this problem is to have a separate panel to handle configuration options and save parameters in an .ini file using the Reading/Writing .ini-Style Files instrument (inifile.fp) located in <CVIfolder>\toolslib\toolbox folder. You may want to change to XML format by using CVIXML instrument (cvixml.fp) found in the same folder.

Regardless the file type, there is no direct equivalent of LabVIEW UI cluster controls in CVI; that is, you cannot group controls of different types together and treat them as a single entity: you may organize them in a C structure but you will need a series of Get/SetCtrlVal to read/write individual structure fields to UI controls.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 6
(94 Views)

Rif.: Config Management

Thanks Roberto!

 

I suspected as much, but it's good to get confirmation.

What about the second part of my question? Is it possible to fill a drop down in a tree control with all available channels of a certain type?



Remember Cunningham's Law
0 Kudos
Message 4 of 6
(72 Views)

Rif.: Config Management

Hi PeterFoerster,

 

LabWindows/CVI has an XML Instrument (you'll have to add it to your project manually, but it's included in the installation) that can load existing XML files and then save after making modifications.

 

XML API (Filepath is [CVI directory]\toolslib\toolbox\cvixml.fp)
http://zone.ni.com/reference/en-XX/help/370051V-01/toolslib/toolslibcvixml/

 

Using an Instrument Driver (how to add that instrument to your project)
http://zone.ni.com/reference/en-XX/help/370051V-01/toolslib/toolslibusing_an_instrument_driver/

 

Function Tree, XML API
http://zone.ni.com/reference/en-XX/help/370051V-01/toolslib/toolslibcvixml_functiontree/

 

So, you'd want to load the XML file, change some of the values in the file, and then save the XML document under a new filename.

0 Kudos
Message 5 of 6
(48 Views)

Rif.: Config Management


@PeterFoerster  ha scritto:

Thanks Roberto!

 

I suspected as much, but it's good to get confirmation.

What about the second part of my question? Is it possible to fill a drop down in a tree control with all available channels of a certain type?


I'm not aware of a way to link a tree item with the channel selector control, I suspect it's not possible.

What you can do as a workaround is to operate on a double-click on a tree item and open a separate panel where the channel selector is present to let the user select the desired option(s).

 

I want to point you to a specific sample instead that is located in <CVIsamplesFolder>\app\xmltree: this shows how to read an xml file and show its content in a tree control and may save you a lot of work.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 6
(33 Views)