« hide
spacer

DEMO_MCS
a simple demostration suite for the MCS library


Here we assume to have two optical cameras feeding an MCS client with FITS (gzipped) images. The Camera main program is invoked by a PHP script (the Image producer) which simply passes to it existing images taken with the various filters. The Camera extracts some header keywords from the file and builds an ``Info'' structure. After the connection with the client is established, the file is sent, followed by the Info structure. Finally the client is notified that the file is ready to be processed further and closes the connection.
The Producer main program is the client. In this demo it does not perfom many operations. It checks some info on the Database server as a response to the Mainsrv request (from the table Producer_log), sets the name of the Camera currently connected, updates the log when a new file is received and informs the Mainsrv that it is ready to be retrieved.
The Mainsrv main program automatically gets the files from the Producer when ready and accepts requests from other clients (user application written in any language). In the present example we use an infinite loop but a trigger logic could be used. When a new file is ready Mainsrv asks the Producer to send the ``Info'' structure and performs (for example) the check on the exposure time. If it is greater than 5 seconds then consider the image useful. Consequently it updates the Mainsrv_log database table and asks the Producer to send the file. When the file is received, the local file ID counter is updated and the loop continues. This communication with the Producer is managed by the ``Local Thread''. The ``User Thread'' instead listen at the Users requests distinguishing between the external commands defined in the mcs.conf file and internal ones (i.e. compiled/linked together with Mainsrv). An external program is for example sexcat which is a user contributed program aimed at identifying the objects present on the image and to list them in a table. sexcat is a shell script which 1. uncompress the fits file into a temporary one, 2. invokes rossex (a C written program) with the requested parameters and 3. removes the temporary file. The sexcat output file can then be retrieved with the get MCS internal command (see any demo_mcs program). The internally implemented OBSLOG command (see demo_mcs.hh) makes use of a user contributed library to extract some relevant info from the header of the FITS file and update an observation log table in a user defined database (here the database is RossImgs and the table Obslog_demo. The database connection is performed on a new thread which is destroyed when the operation is completed. The user contributed library itself uses the MCS library to perform the query preparation and insertion into the database. A PHP written web interface allows the browsing of the Obslog_demo table. Similarly another PHP interface allows to browse, to perform (some) on-the-fly analysis and to retrieve the images selected by the user. Use the ImagesDB section on the left navigation bar, go to the ROSS specific page and use demo_mcs both for user and password (after selecting ``demo mode``).
...


Start the Multi-camera emulator
Start the Process monitor
(Deamons of the Producer and Mainsrv must be active to work!)
   View the code: mcs.conf
mainsrv.cc
producer.cc
Camera.cc
rosspipe.cpp
rosspipe.hh
demo_mcs.hh
sex_catentry.c
sexcat_stru.h
demomonitor.php (PHP)

Standalone Demos:
demo_mcs.c (C)
demo_mcs.f (Fortran)
demo_mcs.pro (IDL)
demo_mcs.php (PHP)
demo_mcs.py (Python)


Last updated: 11 May 2006, nicastro at iasfbo.inaf.it
spacer