/****************************************************************************/
/* Copyright (c) 2001 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : BuoyLauncherOutput.h                                          */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 06/18/2001                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/

#ifndef _BUOYLAUNCHEROUTPUT_H
#define _BUOYLAUNCHEROUTPUT_H

#include <time.h>
#include "SharedData.h"

#define BuoyLauncherOutputName "BuoyLauncherOutput_ShmemName"

/*
CLASS 
BuoyLauncherOutput

DESCRIPTION
Ouput of BuoyLauncher driver

AUTHOR
Rich Henthorn
*/

class BuoyLauncherOutput : public SharedData {

public:

  struct BuoyLauncherData {

    // Indicates that device is initialized and ready
    Boolean _deviceReady;
    // Indicates that faulty data was received
    Boolean _badComms;


    // BuoyLauncher data
    int     _launcherError;     // Error code
    Boolean _lastLaunchOK;      // Last bouy launch succeed?
    Boolean _lastLaunchDone;    // Buoy was successfully ejected
    Boolean _armsRetracted;     // Were arms retracted
    Boolean _inLaunchPosition;  // Buoy is knocking at the door
    Boolean _buoyResponsive;    // Current buoy talking?
    Boolean _nextBuoyReady;
    int     _currentBuoyNumber; // What buoy is in the comm position?
    int     _totalNumBuoys;  // How many buoys did we start with?
    int     _numBuoysRemain;    // How many buoys remain in the launcher?
    int     _numBuoysLaunched;  // How many buoys have been launched?
    time_t  _timeSec;           // Launcher time
    long    _argosBytesL;       // How many ARGOS bytes are available
    long    _archiveBytesL;     // How many archive bytes are available
    long    _picoBytesL;        // How many ARGOS bytes are available
    long    _dataMemoryL;       // Memory pointer

    // Current buoy data
    int     _buoyNumber;        // buoy number
    int     _mainBattVolts;     // Voltage from the main battery
    int     _auxBattVolts;      // Voltage from the aux battery
    int     _tempDegC;          // Buoy temperature in Celsius
    time_t  _timeSecB;          // Buoy time
    long    _argosBytesB;       // How many ARGOS bytes available
    long    _archiveBytesB;     // How many archive bytes available
    long    _picoBytesB;        // How many pico bytes available
    long    _dataMemoryB;       // Memory pointer

  };

  BuoyLauncherOutput(Access access = NoAccess, Boolean init = False);

  ~BuoyLauncherOutput();


  ////////////////////////////////////////////////////////////////////
  // Read from shared memory to this object's Data::data element
  void read();

  ////////////////////////////////////////////////////////////////////
  // Write from this object's Data::data element to shared memory
  void write();

  BuoyLauncherData data;

};

#endif
