/****************************************************************************/
/* Copyright (c) 2004 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : benthosServer.cc                                              */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 10/07/2004                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
/*-----------------------------------------------------------------------*
  PROGRAM: benthosServer

  DESCRIPTION: Binary wrapper for BenthosModem Server

  AUTHOR: Rich Henthorn

  *-----------------------------------------------------------------------*/

#include "BenthosModemServer.h"
#include "SerialDevice.h"
#include "Syslog.h"
#include "System.h"
#include "SerialParameters.h"

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

  SerialDevice *dev = 0;
  BenthosModemServer *benthosServer = 0;

  try {
    SerialParameters params(&argc, argv);
    benthosServer = new BenthosModemServer(BENTHOSSERVERNAME, &params);
    benthosServer->run();
  }
  catch( SharedObject::Error e ) {
    Syslog::write("benthosServer -- Caught SharedObject exception: %s\n", e.msg );
  }
  catch( Exception e ) {
    Syslog::write("benthosServer -- Caught exception: %s\n", e.msg );
  }
  catch( ... ) {
    Syslog::write("benthosServer -- Caught exception!\n");
  }

  delete benthosServer;
  delete dev;
  
  return 0;
}
