[ <- Previous Page ] [ ^ Table Of Contents ^ ] [ Next Page -> ]
Setting Up An Acquisition Interface

Chapter 8
Setting Up An Acquisition Interface

This chapter documents the neccessary steps for establishing a data acquisition program.

A sample C++ program zserver1 is included with the zWebit distribution and can be used as a server based data acquisition program or as a model for new program development.

A data source could be any number of places:




Acquisition Interface Setup Steps

  1. Determine the interface name (like FROMLAB or FROMRX)
  2. Identify existing program or create a new acquisition program
  3. Create a script file for starting/stopping/statusing the interface
  4. Create an entry in the ptrkeys table for this interface
  5. Create a configuration file with startup/runtime paramteres





Step 1: Determine Interface Name

Interface names can be any unique name from one to twelve bytes in length. There is one reserved name, NEXT. Try to assign meaningful names to each interface, such as FROMRAD or FROMLAB.






Step 2: Identify existing program or create a new acquisition program

The included server acquisition program utilizes the following files:

ItemDescription
zserver1.proProfile of runtime values
loadprofile.cFile containing logic for processing profile entries.
zserver1.cppAcquisition program source

The zserver1 program requires an entry in the /etc/services file. The service name is used by the program to initialize a socket.

/etc/services Example

testport	15000/tcp	#prod		test webit port



Data Acquisition Program Pseudocode

If you need to create a new program, the following pseudocode describes the steps in the program.

  1. Open profile and pull values
  2. Verify profile values are acceptable
  3. Open a postgres DBMS connection
  4. Perform other needed initialization steps
  5. Enter a process loop
    1. Receive a transaction from data source
    2. Remove framing/encapsulation characters
    3. Get next available seq-no from Ptrkeys table
    4. Append transaction to idata table and update ptrkeys table
    5. Commit transaction to DBMS
    6. Acknowledge sending system of succesful receipt
    7. Notify all appropriate delivery programs of incoming data
  6. Close any open files and connections

New programs need to be set up as belonging to user zwebit, group zwebit with the setuid bit set, chmod 4775 newprogname






Step 3: Create A Script File

Each interface requires a script file in the webit/bin directory.

DescriptionCommand
change directorycd zwebit/bin
copy templatecp template1 myinterfacename.pro
edit profileedit myinterfacename.pro

Update the following variables in the new script file






Step 4: Create An Entry In The Ptrkeys Table

Using the web based interface, for the appropriate test or prod system,

  1. Select Ptrkeys maintenance
  2. Select Add New
  1. Interface = Myinterface name
  2. Sequence Number=0
  3. Interface type = Inbound Connection
  4. ON / OFF Switch = OFF
  5. Description = A description of the interface
  6. Command = The fully qualified name of the script file created in step 3
  7. Add





Step 5: Create A Config File

For a test system interface, create a new configuration file in directory webit/test/config. For a prod system interface, create a new configuration file in webit/prod/config.

This is the same file name that was set in the script file in step 3 field PROFNAME.

If you are using the zserver1 program, you can use file webit/test/config/zserver1.pro as a starting point. If you create a new program, then set the values you need in the new profile.




[ <- Previous Page ] [ ^ Table Of Contents ^ ] [ ^ Top Of Page ^ ] [ Next Page -> ]


Visit the GNU home page.

FSF & GNU inquiries & questions to gnu@gnu.org.

Comments on these web pages to info@zhsac.com.

Copyright (C) 2003 HealthCare Systems and Consulting

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.

Last updated: 07/21/2003