Booking Data - The dad message system

The following list of functions may be used to use the dad booking scheme.

How does the booking of information work?

Dad clients may ask the server for regular updates on a given dataflow or table.

As soon as the server gets any new information, the booking tables are checked, if any of the clients have booked this data and if optionally applied conditions of the booking clients are fulfilled.

Then this information is sent to the client.

The client itself has to stay in a so called message loop, where it waits for incoming messages, acts on them or calls regular maintenance functions.

Message passing between processes

With this scheme there exists an easy way to pass messages between processes. If one creates the Adamo DDL:
/* ---------------------------------------------------------------------- */

DEFINE ESET
  scCommand =
   (
       cSender    = CHA8 : 'sender of the command',
       cReceiver  = CHA8 : 'Receiver of the command',
       cCommand   = CH64 : 'Command String itself'
   )
   :'A slow control command'
END ESET

DEFINE DATAFLOW
  scCmds = { scCommand };
END DATAFLOW
the table scCommand may be used to send commands from one process to aonther. The sender has to apply the adress name the command string and the senders name itself to the command table and send this to the server. All possible receivers have now booked the table scCommand with the condition scCommand.cReveicer = 'myname' where myname is to be replaced by the receiver's name.

Opening the connections to the server

For opening a server connections dadOpenDB has to be called with the additional openflag CAC_BOOK:
f77: Call dadOpenDB( Id, Filename, Dataflow, Port, CAC_READ + CAC_BOOK, err )
  or
C:   dadOpenDB( &Id, Filename, Dataflow, Port, CAC_READ | CAC_BOOK, &err )
In this example the client asks for read access to the server with the the booking mechanism enabled. You may mix CAC_BOOK with CAC_UPDATE to get the functionallity of the updating scheme: same ID on all clients, start and end time. Please also look into the externally configurable way to connect to a server.

Booking data

Before going into the message loop the data to book must be specified. This can either be done by calling dadBook which will book the whole dataflow. A call to dadBookIf will specify both, a table and a condition on rows of the table to transfer if new information arrives on this table. Subsequent calls to dadBookIf are ORed to already existing ones. dadBookClr however will clear this conditions and the server will assume that the whole dataflow gets booked. After applying a condition on one or more tables you can either call dadBookDo to activate the booking mechanism on the information which is currently in the server and on new information or dadBookDoNow which will transfer only new information. After booking the information the client should go into the so called Message Loop where it places calls to dadMsg and dadMulMsg to receive incoming information. If there is no information available the client can run intermediate functions within this Message Loop, too.

Writing information to the server

To write information to the server you can use dadWUpdate or dadWriteTab. dadWUpdate can here be used even if the CAC_UPDATE flag was not given as a connection flag as it simply appends rows on existing tables of the server. Please note that servers only check for new entries in the database which could be sent out to booking clients. This implies that dadWrite should be used with CAF_APPEND to append new informations to the database.

Examples

Both the Client example and the Dad Devellopers Kit contain useful examples on the Dad Message system. You may also want to look into the PinK documentation page as PinK is a nice tool to access Dad servers from the tk/tcl language.
This page is maintained by Wolfgang Wander