/****************************************************************************/
/* Copyright (c) 2012 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : DeltaTIF.idl                                             */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 10/15/2012                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/

/*
CLASS 
DeltaTIF

DESCRIPTION
TaskInterface to DeltaT device driver

AUTHOR
Rich Henthorn

*/

#define MAX_BEAMS 480

#include "TimeIF.idl"
#include "DeviceIF.idl"

interface DeltaTIF {

  enum Constants { MaxBeams=MAX_BEAMS };

  enum Sonar {
    Fwd = 0,
    Side
  };

  typedef sequence<float, MAX_BEAMS> FloatArray;
  typedef sequence<short, MAX_BEAMS> ShortArray;

  struct Data
  {
    TimeIF::TimeSpec update_time;
    boolean enabled;
    float range;               // Altitude calculated by the DeltaT
    short interval;            // Time between pings in milliseconds
    short nbeams;
    FloatArray beam_ranges;
    ShortArray intensities;

  };

  ///////////////////////////////////////////////////////////////////
  // Set the profile point filtering
  //
  DeviceIF::Status set_profile_point_filter(in Sonar sonar, in short ppf);

  ///////////////////////////////////////////////////////////////////
  // Set the trigger delay
  //
  DeviceIF::Status set_trigger_delay(in Sonar sonar, in long delay);

  ///////////////////////////////////////////////////////////////////
  // Set the trigger edge
  //
  DeviceIF::Status set_trigger_edge(in Sonar sonar, in short edge);

  ///////////////////////////////////////////////////////////////////
  // Set the trigger enable
  //
  DeviceIF::Status set_trigger_enable(in Sonar sonar, in short trig);

  ///////////////////////////////////////////////////////////////////
  // Set the profile minimum range
  //
  DeviceIF::Status set_profile_min_range(in Sonar sonar, in short pmr);

  ///////////////////////////////////////////////////////////////////
  // Set the averaging: [0|1]=>Off, and 3, 5, or 7 shots
  //
  DeviceIF::Status set_averaging(in Sonar sonar, in short avg);

  ///////////////////////////////////////////////////////////////////
  // Set the beam width: 0 for Wide, 1->Normal, 2->Narrow, 3->Narrow-Mixed
  //
  DeviceIF::Status set_beam_width(in Sonar sonar, in short width);

  ///////////////////////////////////////////////////////////////////
  // Set the sector size: 0 for 30 degrees, 1->60, 2->90, 3->120
  //
  DeviceIF::Status set_sector_size(in Sonar sonar, in short size);

  ///////////////////////////////////////////////////////////////////
  // Set the number of beams: 120, 240, or 480
  //
  DeviceIF::Status set_nbeams(in Sonar sonar, in short nbeams);

  ///////////////////////////////////////////////////////////////////
  // Set the speed of sound to 1400 to 1600 m/sec
  //
  DeviceIF::Status set_sos(in Sonar sonar, in float sos);

  ///////////////////////////////////////////////////////////////////
  // Auto-updating of the SOS. Tells the driver to regularly update
  // the beamformer SOS. True = automatic updating.
  //
  DeviceIF::Status set_auto_sos(in boolean automatic);

  ///////////////////////////////////////////////////////////////////
  // Instruct the server to update the SOS using the CTD server.
  // This is one-shot deal. Returns the updated sos.
  //
  DeviceIF::Status update_sos(out float sos);

  ///////////////////////////////////////////////////////////////////
  // Set the range 0 to 100m
  //
  DeviceIF::Status set_range(in Sonar sonar, in short range);

  ///////////////////////////////////////////////////////////////////
  // Set the receive gain 1 to 20db
  //
  DeviceIF::Status set_gain(in Sonar sonar, in short gain);

  ///////////////////////////////////////////////////////////////////
  // Turn gain equalization on or off
  //
  DeviceIF::Status set_gain_eq(in Sonar sonar, in boolean on);

  ///////////////////////////////////////////////////////////////////
  // Turn 837 data logging on or off
  //
  DeviceIF::Status set_idt_logging(in Sonar sonar, in boolean on);

  ///////////////////////////////////////////////////////////////////
  // range returns the calculated range from the Multibeam data record
  //
  double range(in Sonar sonar);

  // Return the number of beams in the DeltaT data records
  //
  unsigned short nbeams(in Sonar sonar);

  // Return the ping interval
  //
  unsigned short interval(in Sonar sonar);

  // Return enabled flag
  //
  boolean enabled(in Sonar sonar);

  // Return the latest data timestamp
  //
  void update_time(in Sonar sonar, out TimeIF::TimeSpec timestamp);

  // Return the latest DeltaT data
  //
  void get(in Sonar sonar, out Data data);

  // Return the mounting angles of the sonar (read in by the server
  // from a configuration file)
  //
  void get_mounting_angles(in Sonar sonar, out double phi, out double theta,
			   out double psi);

  // Begin reading and logging DeltaT data
  //
  void start(in Sonar sonar);

  // Stop reading and logging DeltaT data
  //
  void stop(in Sonar sonar);

};
