A General Message Display Program for Linux

March-14-2002 / jn

Introduction

Table is a program to display messages sent from computers in the local net. Computers in the local net can send messages (in a defined format) via UDP broadcast. Table takes these messages from the net and displays these depending on their severity and the selected options.

The program can, but need not be called by specifying parameters on the command line:

table [ -f <logging file name> -d <display name> --h ]

<logging file name> is the name of the file, where all messages are written if File Output is selected. If no filename is specified, a filename effbg_messages.log is assumed.

Calling the program normally will open the window displaying messages and the possible options. In case of known errors it will open an error window specifying the problem. A background process is started, which listens to the net for broadcast messages and decodes known messages and displays them. The last received message is always the first in the table.

An Error message: ERROR in setting up UDP Receive: The address is already in use (Die Adresse wird bereits verwendet)

means, that a program is already listening at the special UDP-port. Normally the reason is that this program (maybe started by another user) is already running on the computer.


The Display Window

After a successful start of the program the table window is shown:



The parts of the window consist of a table view showing the received messages, a menue view, where one can select special features for the display, and some special icons to start some actions.

In the table view the last received message is always in the first row. Coming a new message will shift all others one row down, which means the last message in the table is lost. The table view contains:

Time: The time can be a time which was directly inserted by the message producing program or produced by the message handler of the sending computer or by this program. It is always converted to Julian Date. It can be displayed as only time of day or together with the Julian Day Number selected in the menue. For that reason the incoming messages are not sorted by time. They are only sorted how they arrived to this program.

Icon: The displayed icon refers to the severity of the message. The icon display can be deselected by the menue.

Message: The message is displayed as a character string, how it was produced by the sending program. The form of the text display (color, bold etc.) depends on the severity of the message. Which type of messages shall be displayed can be selected by the menue.

Sender: The sender specifies the sending program or handler or computer. By the menue on can select to display only messages from certain senders.

The icons in the top part have the following functions:


'What's This ? Button: Clicking first on this button and then clicking the graphical elements may display a deeper explanation of the element and the displayed data.


Info Button: Clicking this button delivers last information about the program.


Max Size Button: Clicking these buttons automatically changes the size of the window to maximum screen size.


Running Display: This small display shows whether the display loop of the program is running. If the icon is green, it runs. If it is red, there is a problem.


Stop/Continue Button: Clicking this button changes from 'STOP' (normal color) to 'CONTINUE' (red). It stops updating and freezes the table display. The button changes to red with the label 'CONTINUE'. Clicking again changes to STOP and display will further update.

The menue options are divided into three parts:

Options: Here one can select special options for the display or define whether or not a log-file is written.

Messages from ...: Here are selected the senders, from which the messages are displayed in the table view. Other means all other senders not specified before.

Type of messages: Here one can define, whether all message types are displayed or only certain types of messages.


Program Structure

The program structure mainly consists of three C++ Object classes and two main structures for the messages. One structure defines a single message with all possible parameters (TABLE_MESSAGE), a second one consist of many single messages of the before type and some counters for the messages (MESSAGE_ALL). The MESSAGE_ALL structure is allocated in shared memory, so it can be accessed by other programs.

One object is responsible for the graphical display and user interface:

TabDis1

In that part of the program there are handled the actions of the user with the graphical interface like the buttons and the select boxes. On the other hand it constructs the main window and its child windows.


The main member functions are:

void slot_Info();

void slot_display_stop();

void slot_default_Size();

Functions serving the icons, if pressed

void slot_message_options();

void slot_message_sender();

void slot_message_type();

Functions reading the different options


Another one runs as an own sub-process:

Get_messageData

This object handles the incoming messages from the net and places them as a single TABLE_MESSAGE in the MESSAGE_ALL structure. Counters in that structure define the last message come in and the last message displayed etc.. An UDP read connection on an certain port is established to get all broadcast messages to that port.


The main member functions are:

int UDPinit();

Setup the UDP broadcast connection

int UDPread();

Read data from UDP port

void interprete_data();

Select only message data

void set_message(TABLE_MESSAGE *m,double time,char *sender,int sever, int main_id,int sub_id,char *text, char *subtext=0);

Setup the TABLE_MESSAGE structure

void write_message(TABLE_MESSAGE m);

Fill message in MESSAGE_ALL structure


The last object works with the incoming messages:

TabDispl

This program continuously checks for new messages in the MESSAGE_ALL structure. As first the new message will be examined and parameters of the TABLE_MESSAGE structure will be completed (eg. time or sender). Then it tests whether an identical message already came since a certain time ( ~10 sec.). In that case it will not be displayed. Messages according to the selected options also will not be displayed. If the message should be displayed, the table will be shifted down and then displayed. In parallel the message is written to the log-file.


The main member functions are:

void slot_table_update();

Main loop depending on a timer

void check_newmessage();

Find a new message

bool compare_message(QTable *t,int row1,int row2,double timediff,TABLE_MESSAGE ein);

Compare message with older ones

bool filter_message(TABLE_MESSAGE ein);

Filter out messages not to display

void shift_rows_down(QTable *t,int row1=0,int row2=0);

Shift table down

void write_line(QTable *t,int row, TABLE_MESSAGE ein);

Write new table row


jneidhoefer_at_mpifr-bonn.mpg.de