Initializing Connect

To initialize Connect, you first need to call the AgConInit() function, which has the following prototype:

AgConInit (
char *initFileName

This function reads and processes a configuration file to initialize Connect.

You can specify the configuration file name by setting the initFileName argument to be the name of the file.

Otherwise, default values will be used.

AgConInit() returns AgCNoError if successful and AgCError if an error occurred.

A Connect initialization file corresponding to the Connect module is shipped with each new release of STK. It can be found here: <YourSTKInstallLocation>\Connect\PCData\connect.dat.

Connect Initialization File

Comments in the file are defined using a # as the first character on that line.

The Connect initialization file consists of several areas. The first area is a list of Connect commands that return data. If the command returns multiple data fields, a [Multiple] field is included:

ReturnsData <ConnectCommand> [Multiple]

For instance, the Access Connect command returns access intervals between two objects:

ReturnsData ACCESS

The AllAccess Connect command, on the other hand, returns access intervals between all objects in the form of multiple Access calls:

ReturnsData ALLACCESS Multiple

In most cases, you shouldn't need to modify this area in the file. The values in the configuration file shipped with a given version of Connect indicate the defaults for that version.

The second section of the initialization file allows you to turn several Connect control variables ON or OFF. The format of this section is:

<ConControlName> {On | Off}

The control variables, described in the following table, are set when a connection to STK is established.

Connect control variables

Field Value
Acknowledge If ON, Connect opens the STK connection in Acknowledge mode (i.e., user receives an ACK or NACK in response to an incoming message).
Error If ON, Connect return an error message when a command fails if the Acknowledge option is set to OFF.
Verbose If ON, Connect responds with detailed information, via the STK Message Viewer window, about connections and message traffic.
Async If ON, STK returns data with asynchronous headers and accepts specific asynchronous commands such as Async2DPick.

The next section of the initialization file contains the default timeout value that Connect uses when reading information from STK. The value is in milliseconds; the default value is 30000 ms (or 30 seconds).

If you expect to send complex commands to STK, you may wish to increase the timeout value; if you expect little or no return data from STK, you may wish to decrease the timeout value.

The next section of the initialization file contains two control variables, Version and Revision, which indicate the version and revision of Connect/IPC being used.

If you use the Connect library to talk to an older version of STK, the Version and Revision variables should be uncommented (pound sign removed) and changed to reflect the correct IPC version. If you don't connect to older versions, these variables should be left as they are.

The final section of the initialization file allows you to set the client application Connect Verbose option to ON. Setting CON_VERBOSE to ON causes diagnostic messages to appear when a third-party application using Connect is running-this is different from the earlier Verbose flag that affects the STK application in that CON_VERBOSE affects the client application.

You can set Verbose for the client application by defining an environment variable called CON_VERBOSE.

STK 11.2.1 Programming Interface