2.3. Configuration

The Cascade DataHub can be configured with a configuration file at startup, or dynamically during runtime. The commands used for configuration are listed in the Command Set reference, but are not yet documented in detail. The most commonly-used commands are:

alive tells the Cascade DataHub that the client is running.
bandwidth_reduce reduces the connection bandwidth.
domain identifies the client domain name.
enable_dde_client enables or disables DDE client capabilities.
enable_dde_server enables or disables DDE server capabilities.
enable_mirror_master enables or disables mirror master capabilities.
enable_mirror_slave enables or disables mirror slave capabilities.
enable_opc_client enables or disables OPC client capabilities.
enable_opc_server enables or disables OPC server capabilities.
enable_tcp_server enables or disables TCP server capabilities.
heartbeat establishes a heartbeat message.
ignore ignore a given point.
register_datahub registers the Cascade DataHub on a given domain.
request requests the value of a point.
request_initial_data gets current data when client connection is made.
timeout suspends data flow.

2.3.1. Using a Configuration File at Startup

The Cascade DataHub can read a configuration file at startup, using the -f option. The commands in the configuration file are written using Lisp syntax. This consists of the name of the command, followed by a space-separated list of arguments, all enclosed in parentheses, like this:

(command arg1 arg2 arg3 ...)

The commands are commonly written one per line. Comments are denoted by a semicolon (;) at the beginning of each comment line. For example:

; This line is a comment.
(tcp_service 4601)
(enable_tcp_server 1)
(enable_mirror_master 1)

2.3.2. Dynamic Run-Time Configuration

There are several ways that the Cascade DataHub can be configured or reconfigured dynamically during run time:

  • Using the lsend or gsend command-line tools. These two commands are similar, except one uses Lisp syntax, as explained above, while the other uses Gamma syntax. Please refer to the lsend documentation in the Cogent C API manual for more information.
    Here is an example using lsend:
    1. Start the DataHub and declare the example domain.
      [sh]$  datahub -d example
    2. Start lsend using the name of the DataHub. This consists of the string /dh/ followed by the domain name. If no domain is declared, the DataHub takes its name from its PID. Please refer to Section 2.4.3, “Domains and Names” for more information.
      [sh]$  lsend "/dh/example"
      /dh/example>
      When lsend starts it gives you a prompt with the name of the receiving program in it.
    3. At the prompt generated by lsend, send commands using the Lisp syntax explained above:
      /dh/example> (alive)
      (success "alive")
      /dh/example> (heartbeat 200)
      (success "heartbeat" "200")
      /dh/example>
      For each command, lsend displays the return value from the DataHub in Lisp syntax.
    Here is the same example using gsend:
    [sh]$  datahub -d example
    [sh]$  gsend "/dh/example"
    /dh/example> alive;
    (success "alive")
    /dh/example> heartbeat (200);
    (success "heartbeat" "200")
    /dh/example>
    The return values for gsend from the DataHub are in also in Lisp syntax.
  • Sending a command from a C program. The Cogent C API has functions that allow you to send configuration information to the Cascade DataHub. These are explained in the Communicating with the Cascade DataHub section of the Cogent C API manual.
  • Using the Gamma send and send_async functions. Cogent's Gamma programming language uses these two functions to send commands to the Cascade DataHub and other Cogent products. Please refer to send and send_async in the Gamma manual reference for more details.