/****************************************************************************/
/* Copyright (c) 2014 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : carlServer.cc                                                 */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 11/17/2014                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/

#include "CARLServer.h"
#include "Syslog.h"
#include "System.h"

int main( int argc, char **argv )
{
  // Set task priority
  if (System::setTaskPriority(CriticalServerPriority) == -1)
    return 1;

  char configFileName[256];
  strcpy(configFileName, System::configurationFile("carl.cfg"));

  try {
    Syslog::write("carlServer - initializing..." );
    CARLServer *carlServer = new CARLServer(configFileName);
    if (DeviceIF::Ok != carlServer->initialize())
      exit(1);
    
    Syslog::write("carlServer - running..." );
    carlServer->run();
  }
  catch( Exception e ) {
    Syslog::write("carlServer -- Caught exception: %s\n", e.msg );
  }
  catch( ... ) {
    Syslog::write("carlServer -- Caught exception!\n");
  }

  return 0;
}
