LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving mapping from IVI logical name to full driver session name.

MAX, of course, lets you set up "Driver Sessions" with full names, and then "logical names" which are shortcuts to the full driver session. How can I retrieve the actual driver session that the logical name maps to? I can get the handle to the logcal name list via the IVI library, but I can't find any function that lets me retrieve further information about the logical name. Is this available in the "Configuration Server C API"?

0 Kudos
Message 1 of 3
(3,280 Views)

Hello pblase,

 

What other information are you looking to retrieve besides the logical name? Depending on what information you are looking to retrieve the configuration server can be an effective tool. The following are good links for examples of IVI configurations. One will demonstrate a search that works for finding the logical names of devices in your system as well as the driver sessions. The other programmatically accesses virtual and physical channels.

 

http://digital.ni.com/public.nsf/websearch/F25F9B0E8DA4BB2386256DEF00729F81?OpenDocument

https://decibel.ni.com/content/docs/DOC-12530

Ian M.
National Instruments
0 Kudos
Message 2 of 3
(3,259 Views)

What I want is, as I said, the mapping between the logical name and the session. This must be available, since the IVI drivers use it to go from a logical name to the attached session! One would think that it would be a single function call.

 

I'm doing this because in my program I can select which of a number of drivers (Newport motion controllers, in this case) a particular GUI control is attached to. The full session name is long, and there are - of course - sessions that have nothing to do with motion controllers. In the control list (a ring control) I use the logical names, which are shorter. However I want to also list the full session name elsewhere. Since I can't go from the session name to the logical name, that mapping isn't stored anywhere, I must go the other way around.

 

Ok, I think I figured it out. This could really be documented better!

Also, this whole thing could really be in the .ivi library configuration store section, which encapsulates a few of these calls, but not all of them.

 

//include section
#include <IviConfigServer.h>    //IVI configuration store

//done once at program startup. Note: this gets a copy, you don't have to dispose of ConfigStoreHandle afterwards.

static IviConfigStoreHandle ConfigStoreHandle = NULL;

Status = Ivi_GetConfigStoreHandle (&ConfigStoreHandle);

//This is the pain in the butt.    
ViStatus Status;

IviLogicalNameCollectionHandle LogicalNameCollectionHandle = NULL;
IviLogicalNameHandle LogicalNameHandle = NULL;
IviSessionHandle SessionHandle;
ViChar         ControllerSessionName[MAX_Controller_Name_LEN];  
ViChar         ControllerDescriptor[MAX_DESCRIPTOR_LEN];
ViChar         ControllerDescription[MAX_Controller_Name_LEN];


//get the configuration store logical name collection (what you see in MAX under "Logical Names")
Status = IviConfig_GetConfigStoreLogicalNameCollection (
    ConfigStoreHandle,
    &LogicalNameCollectionHandle);
    

//how many logical names are there in the collection?
Status = IviConfig_GetLogicalNameCount (
    LogicalNameCollectionHandle,
    &IVI_ItemCount);
    

//For each logical name, find the corresponding session name   
for (i = 1; i <= IVI_ItemCount; i++) {
    Status = IviConfig_GetLogicalNameItemByIndex (
            LogicalNameCollectionHandle,
            i,
            &LogicalNameHandle);


    //get the session name for this logical name
    Status = IviConfig_GetLogicalNamePropertyViString (
            LogicalNameHandle,
            IVICONFIG_VAL_LOGICAL_NAME_NAME,
            MAX_Controller_Name_LEN,
            ControllerDescriptor);

 

    //get the description for this logical name
    Status = IviConfig_GetLogicalNamePropertyViString (
            LogicalNameHandle,
            IVICONFIG_VAL_LOGICAL_NAME_DESCRIPTION,
            MAX_Controller_Name_LEN,
            ControllerDescription);
    

    //get the handle for the ession attached to this logical name
    Status = IviConfig_GetLogicalNameSessionReference (
            LogicalNameHandle,
            &SessionHandle);
    

    //get the name of the session (what I really wanted in the first place)
    Status = IviConfig_GetSessionPropertyViString (
            SessionHandle,
            IVICONFIG_VAL_CONFIG_COMPONENT_NAME,
            MAX_DESCRIPTOR_LEN,
            ControllerSessionName);                
   
    }

 

Message 3 of 3
(3,247 Views)