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

#ifndef _BUOYLAUNCHERINPUT_H
#define _BUOYLAUNCHERINPUT_H

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

#define BuoyLauncherInputName "BuoyLauncherInput_ShmemName"

/*
CLASS 
BuoyLauncherInput

DESCRIPTION
Ouput of BuoyLauncher driver

AUTHOR
Rich Henthorn
*/

// Single character commands for the BuoyLauncherDriver
// are put into the _command data member

#define CLEAR_CMD         '#' // Set by Driver when previous command processed
#define WAKEUP            'W' // Ask LC if he's awake
#define SET_TIME          'T' // Set the time of LC and Buoy
#define LAUNCH_REAL_HOT   'L' // Initiate full launch process for a real buoy
#define LAUNCH_REAL_COLD  'M' // Initiate launch for a real buoy, do not fire
#define LAUNCH_FAKE       'Y' // Initiate full launch process for a fake buoy
#define ROTATE_BUOY       'R' // Rotate until a real buoy is in the data pos
#define ROTATE_LAUNCH_POS 'P' // Rotate next buoy slot to the launch pos
#define ROTATE_DATA_POS   'Z' // Rotate next buoy slot to data xfer position
#define PUSH_OUT_RETRACT  'O' // Push buoy out and retract arms
#define ROTATE_CARO       'B' // Rotate one position regardless of buoy
#define XFER_ARGOS        'X' // Initiate ARGOS data transfer
#define XFER_ARCHIVE      'D' // Initiate archival data transfer
#define UPLOAD_LC_LOG     'U' // Upload the launcher log to the MVC
#define CURRENT_BUOY      'N' // Set the current buoy number
#define REINITIALIZE      'I' // Re-Initialize the Launcher (after a fault)
#define RETRACT_LARMS     'A' // Retract the arms, e.g., after they get stuck
#define LC_STATUS         'G' // Get status of the Launcher Computer
#define LCBC_STATUS       'S' // Get status of the LC and buoy in the data pos
#define STATUS_ON         'C' // Turn on heartbeat status calls inside driver
#define STATUS_OFF        'c' // Turn off heartbeat status calls inside driver

class BuoyLauncherInput : public SharedData {

public:

  struct BuoyLauncherData {
    // Number of minutes to upload from the end of the Launcher log.
    short   _numMinutesToUpload;

    // Buoy Positioning
    int     _currentBuoy;  // Used to choose the "current" buoy

    // Time data
    time_t  _newTime;      // UTC time value for launcher to use

    // Data to download
    BuoyLauncherIF::Filename _dataFilename;

    // Command - temporary command structure to be replaced by events
    char _command;
  };

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

  ~BuoyLauncherInput();


  ////////////////////////////////////////////////////////////////////
  // 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
