/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : DepthEnvelope.h                                               */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/07/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _ACOUSTICABORT_H
#define _ACOUSTICABORT_H

#include "Behavior.h"
#include "MissionClock.h"

#define AcousticAbortBehaviorName "acousticAbort"

/*
CLASS 
DepthEnvelope

DESCRIPTION
This behavior prevents the vehicle from decending below the "maxDepth"
or ascending above the "minDepth".  If "minAltitude" != NoMinimumAltitude, 
then it also prevents the vehicle from approaching closer to the bottom than
"minAltitude".  If "abortDepth" != NoAbortDepth, then the
mission is aborted if the "abortDepth" is reached.

Attribute       Type               Meaning
---------       ----               -------
minDepth        Float              Minimum depth
maxDepth        Float              Maximum depth
minAltitude     Float              Minimum altitude
abortDepth      Float              Abort when below this depth
abortAltitude   Float              Abort when below this altitude

AUTHOR
Tom O'Reilly
*/
class AcousticAbort : public Behavior {

public:

  ///////////////////////////////////////////////////////////////////
  // Constructor
  AcousticAbort();

  virtual ~AcousticAbort();

  virtual void execute();
  virtual Boolean validInput();

protected:
  int _dev;
  long _dummy;

};

#define PAR_ERR    (0x08)
#define PAR_BSY    (0x80)

#define EDGE_BITS  (PAR_ERR | PAR_BSY)

#define EDGE_00    ( PAR_BSY )          /* +ERR -ONL -PE -BSY */
#define EDGE_10    ( PAR_ERR | PAR_BSY) /* +ERR -ONL -PE +BSY */
#define EDGE_01    ( 0 )                /* -ERR -ONL -PE -BSY */
#define EDGE_11    ( PAR_ERR )          /* -ERR -ONL -PE +BSY */

#define EDGE_CLEAR EDGE_00
#define EDGE_ABORT EDGE_10

#define PAR_CONTROL_STATIC (0xc00) /* always read this */


#endif
