/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : LayeredControlIF.idl                                          */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/07/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
/*
CLASS 
LayeredControlIF

DESCRIPTION
TaskInterface to LayeredControl

AUTHOR
Tom O'Reilly

*/

interface LayeredControlIF {

  typedef sequence<char,32> Name;

  /////////////////////////////////////////////////////////
  // Events generated by LayeredControl
  enum Event {
    MissionStarted,
    MissionStatusChange,
    BadMissionPlan,	
    OutputGenerated
  };

  /////////////////////////////////////////////////////////
  // State of the mission
  ///////////////////////////////////////////////////////////////////
  // Mission state enumerations. 
  enum MissionState {
    Initial,	
    Normal,
    Aborting,
    ShuttingDown,
    Done

  };

  ///////////////////////////////////////////////////////
  // Elapsed mission time (seconds)
  double elapsedMissionTime();

  ///////////////////////////////////////////////////////
  // Abort mission
  void abortMission();

  ///////////////////////////////////////////////////////
  // Mission has been aborted
  boolean abortingMission();

  ///////////////////////////////////////////////////////
  // Mission state, name and stack index of current behavior
  void state(out double elapsedTime,
             out MissionState state, 
             out Name behaviorName, 
             out short behaviorIndex, 
             out long  behaviorId);

  enum Status {
    Ok,
    OperationFailed,
    FileNotFound,
    BadBehaviorFormat,
    BehaviorNotFound
  };

  typedef sequence<char,144> BehaviorFilename;

  /* Append behaviors to existing mission script */
  Status appendBehaviors(in BehaviorFilename file);
  
  /* Insert behaviors to existing mission script after the given behavior id */
  Status insertBehaviors(in BehaviorFilename file, in long behavior_id);
  
  /* Delete the behavior with the given id from the stack, may involve */
  /* stopping a behavior that is currently running */
  Status deleteBehavior(in long behavior_id);

  /* Set the amount of time that LayeredControl will wait around for   */
  /* a new sequential behavior to be added to the stack before jumping */
  /* to the abort sequence (effects DynoLayeredControl only) */ 
  void setNewBehaviorTimeoutLimit(in long limit_in_seconds);
};
