/*******************************************************************************
* E.S.O. - VLT project
#
# "@(#) $Id: evhTestSTD_COMMANDS.C,v 1.87 1999/01/13 14:32:09 vltsccm Exp $" 
*
* who       when      what
* --------  --------  ----------------------------------------------
* gchiozzi  15/04/99  created
*/

/************************************************************************
*   NAME
*   waSetValueEvh - Sample EVH application 
* 
*   SYNOPSIS
*   waSetValueEvh destenv destproc
*
*   DESCRIPTION
*   This EVH example receives the SETVAL, GETVAL and TEST application
*   commands as well as all other standard commands.
*   SETVAL and GETVAL are transfered to an application running
*   on and environment and with a process name given
*   at startup on the command line.
*   It is a fully compliant VLT Workstation application and provides
*   standard status information in the real time database.
*   Full parallelism in command handling is implemented using
*   the mechanisms provided by the EVH application framework.
*   This example shows a typical case of a workstation coordination
*   application redirecting ("transferring") commands to an LCU
*   for execution.
*   The CDT waSetValueEvh must be loaded in the environment.
*
*   CAUTION
*   The example is as complete and coherent as possible, 
*   but in order to keep the size limited some error handling
*   had to be skipped or simplified. 
*
*   SEE ALSO
*   waSetValue for a basic example based just on ECCS
*   waAPPLICATION
*
*------------------------------------------------------------------------
*/

#define _POSIX_SOURCE 1
#include "vltPort.h"

#include "waAPPLICATION.h"

/**
 * Only a main() function is provided here.
 * The core of the application is implemented in the
 * waAPPLICATION class.
 * The main() just has to take care of initialyzing
 * and closing CCS, of instantiating the waAPPLICATION
 * object and of starting the EVH event loop handler.
 */
int main(int argc, char *argv[])
{
  ccsCOMPL_STAT stat = SUCCESS;

  /*
   * Initialize CCS and connect to database
   */
  stat = ccsInit(argv[0]);
  eccsErrExit(stat,"Error in Init \n");

  /*
   * The instance of application has to be
   * within a scope section, so that the object is deleted
   * when it goes out of scope before ccsExit();
   */
  {
  /*
   * Creates the instance of application
   */
  waAPPLICATION app(argc, argv,":Appl_data:setValue"); USE(app);
  if(app.ErrStatus() == FAILURE)
    eccsErrExit(FAILURE,"Error creating application\n");
    
  /*
   * enter the main loop 
   */
  eccsLogComment("Entering the main loop and waiting for commands!");
  evhHandler->MainLoop();

  } // End of waAPPLICATION scope

  stat = ccsExit();
  eccsErrExit(stat,"Error in Exit \n");

  return stat;
}

/*___oOo___*/
