PreviousDTI Programmer's Guide (9.1 revision 1) Next

Common Procedures Using DTI

Show this topic in Library frames

This section outlines key procedures that are often used with DTI.

Making a Connection to a Server using DTI

This documents the procedure for obtaining a connection handle to a server, which is a first step for many DTI functions.

To obtain a Connection handle to a server

  1. Start a DTI session
  2. // initialize status code return 
    BTI_LONG status = 0; 
    // Call PvStart function with its reserved 
    // parameter 
    status = PvStart(0); 
    
  3. Connect to a server
  4. // initialize variables 
    BTI_LONG status = 0; 
    BTI_CHAR_PTR uName = "jsmith"; 
    BTI_CHAR_PTR pword = "123"; 
    BTI_CHAR_PTR svrName = "myserver"; 
    BTI_LONG_PTR phConn = 0xFFFFFFFF; 
    BTI_LONG status = 0; 
    // after execution, phConn contains connection 
    // handle to pass to other functions 
    status = PvConnectServer(svrName, uName, pword, 
    &phConn); 
    // if status != 0, handle errors now 
    

Connection handles are required by many DTI functions. You can have multiple connections open at a time. For each function, however, you should call the PvDisconnect() function to release the handle.

BTI_LONG status = 0; 
status = PvDisconnect(phConn); 

Obtaining a Setting ID using DTI

Many of the configuration functions take a setting ID as a parameter. This procedure describes the prerequisite functions for obtaining a setting ID.

To obtain the ID for a Specific Setting

  1. Perform the procedure Making a Connection to a Server using DTI in order to obtain a connection handle.
  2. Using the connection handle returned by PvConnectServer(), obtain a list of categories by calling PvGetCategoryList()
  3. For each category, get the list of settings using PvGetSettingList() and the settings count using PvGetSettingListCount().
  4. Scan for the setting that you want.
  5. Retrieve information about the setting using PvGetSettingInfo().
  6. When done, disconnect from the server by calling PvDisconnect().
  7. End the DTI session by calling PvStop().

Passing a DTI Structure as a Parameter

Many functions require that you pass a DTI structure when making the functional call. The following code segment shows an example of a function call including a structure. See Structures in DTI for more information about DTI structures.

WORD rValue = P_OK; 
TABLEMAP* tableList; 
WORD tableCount; 
rValue = PvGetTableNames(m_DictHandle, &tableList, 
&tableCount); 


Chapter contents
Publication contents

Prev topic: Sample Programs For the Distributed Tuning Interface
Next topic: Distributed Tuning Interface Reference