Using the Cascade DataHub

Cascade DataHub: Version 4.0
Prev |  | Next

# Chapter 2. Using the Cascade DataHub

# 2.1. Running the Cascade DataHub

This section describes the steps necessary to start the Cascade DataHub.

1. Ensure /usr/cogent/bin is in your PATH (check this using the set command).

2. Start the Cascade QueueServer and Cascade NameServer (no ampersand '&' is required) using the qserve and nserve commands:

           [sh]$  qserve
           [sh]$  nserve

   | The qserve program must always be started before nserve. In QNX, qserve and nserve should both be started before TCP/IP to avoid a connection race condition.

3. Start the Cascade DataHub using the datahub command with the appropriate arguments, (no ampersand '&' is required). For example:

           [sh]$  datahub

           The example above would start the datahub in the
       default domain (called "default"). Another example
       is:

           [sh]$  datahub -d test

           This second example starts the datahub in an application
       domain called "test".

Since these commands are generally given together you may wish to group them in a batch file and call that batch file from the `/etc/config/sysinit.`<node>`` file.

Once these command are run you can check which tasks are running by using the nsnames command. For example:

        [sh]$  nsnames
        Task         Queue       Domain    Node      TaskID
        sc/nserve    sc/nserve             1         72
        /db/default  datahub_3c58  default   1 15367

Note that the datahub Queue and the Task ID's shown in the example will be different for every user.

## 2.1.1. Configuration

The Cascade DataHub does not require you to configure the names or types of data points you will be using in your system. If a program writes a data value to the datahub and the point does not exist, the datahub will create the point. If a program registers for exceptions for named points that currently do not exist in the datahub then the datahub will create those points and register the client program at the same time. If a program tries to read the value of a point that doesn't exist in the datahub, then the datahub will create the point and return a default zero value with a zero confidence to the client program.

Typically, the Cascade DataHub is started before other application modules. Then, other tasks are started that communicate with the datahub (to request exceptions, send data, or both). Memory (RAM) is allocated for the points as they are created by the datahub.

## 2.1.2. Testing the Cascade DataHub installation

Cogent has provided three programs that you can use to test your Cascade DataHub installation.

### 2.1.2.1. Writing data to the datahub

Cogent provides you with the writept utility so that you can write new data values into the datahub. Its syntax is described in writept, and its source code is listed in the Writing data to the Cascade DataHub appendix of the Cogent API manual.

### 2.1.2.2. Reading data from the datahub

The readpt utility allows you to read data values from the datahub. See readpt for details about the syntax for readpt, and see the source code for this program in Reading from the Cascade DataHub appendix of the Cogent API manual.

### 2.1.2.3. Registering for exceptions with the datahub

The waiter utility registers for exceptions with a datahub and displays any new point values that it receives. The source code for this example will help you develop applications that effectively utilize the datahub. See waiter for details about the syntax for waiter, and see its source code in Registering for exceptions from the Cascade DataHub appendix of the Cogent API manual.

| If you are using Cascade Connect with the Cascade DataHub then you should start the Cascade DataHub before you initiate the Cascade Connect connection from the MS-Windows computer. This allows Cascade Connect to identify the Cascade DataHub as a client on start up, and to register for exceptions with the datahub.

### 2.1.2.4. Testing the Cascade DataHub

1. Run the appropriate commands (qserve, nserve, and datahub), as described above.

2. In a shell, type the command:

           [sh]$  writept test1 25

   This will create the point 'test1' in the datahub and assign it the value 25. writept does not return any value.

3. At the shell, type the command:

           [sh]$  readpt test1
           Point: test1
           Value: 25
           Conf: 100
           Lock: 0
           Secur: 0

   These tests establish that you can read and write data points to the Cascade DataHub.

Prev | Home | Next
Where can I get help? | Up | Using the Cascade DataHub Viewer

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.