/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : AcousticUpdate.cc						    */
/* Author   : hjt                                                           */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/06/2008                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#include "MissionTimeAttribute.h"
#include "IntegerAttribute.h"
#include "AcousticUpdate.h"
#include "Syslog.h"

AcousticUpdate::AcousticUpdate()
   : Behavior(AcousticUpdateBehaviorName, Sequential)
{
   Attribute::Input *input;

   attributes.add(new IntegerAttribute("dummy",
				       "dummy",
				       &_dummy));
   if (!_modem) {
   	try { 
          _modem= new AcousticModemIF("LayeredControl", 
                                      "BenthosModemServer", 20);

        } 
        catch(...) {
           Syslog::write("AcousticUpdate :: -- Failed to initialize connection "
		         "to AcousticModemIF");
	   _modem = NULL;
        }
    }
}


AcousticUpdate::~AcousticUpdate()
{
   if (_modem) { delete _modem; _modem = NULL;}
}

Boolean AcousticUpdate::validInput()
{
  return True;
}

Boolean AcousticUpdate::shouldBehaviorStart( )
{
     return verticalSequence();
}

void AcousticUpdate::execute()
{
   _modem->sendStatus();
   Syslog::write("sending status via acoustic modem\n");
   setState(Finished);
   return;
}






