#ifndef _MIDWATERMONITOR_H
#define _MIDWATERMONITOR_H

#include "DmMonitor.h"
#include "MidWaterApp.h"
#include "DmMonitorUtils.h"
#include "mwsledDcon.h"

/*
CLASS
MidWaterMonitor

DESCRIPTION
MidWaterMonitor monitors data manager items releated to this application,
and takes appropriate action when they change.

AUTHOR
Douglas Au
*/
class MidWaterMonitor : public DmMonitor
{
  public:

  ///////////////////////////////////////////////////////////////////
  // Constructor
  // [input] name:  Name of application (e.g. "MWSLED")
  // [input] app:   Pointer to MidwaterApp
  MidWaterMonitor(const char *name, MicroApp *app);

  ~MidWaterMonitor();
  ///////////////////////////////////////////////////////////////////
  // Data
  // Pointer Midwater Sled Name string
  const char *mwsledName;

  ///////////////////////////////////////////////////////////////////
  // Switch entry for LPS 0 Vicor Enable
  switchEntry mwsledLps0EnableSwitch;
  ///////////////////////////////////////////////////////////////////
  // Switch entry for LPS 1 Vicor Enable
  switchEntry mwsledLps1EnableSwitch;
  ///////////////////////////////////////////////////////////////////
  // Switch entry for LPS 2 Vicor Enable NOT USED AT THIS TIME
  switchEntry mwsledLps2EnableSwitch;
  ///////////////////////////////////////////////////////////////////
  // Dcon 240 Volt Switch Entry.
  // Don't need a 48v Dcon switch entry because of App Framework
  switchEntry mwsledDcon240VSwitch;

  ///////////////////////////////////////////////////////////////////
  // Low Power Switch 0 Switch Channels
  switchEntry indexSwitchExcite;   // Low Power Switch 0 Channel 0
  switchEntry swingArmPotExcite;   // Low Power Switch 0 Channel 1
  switchEntry currentMeterSwitch;  // Low Power Switch 0 Channel 2
  switchEntry spare12VLPSChannel0; // Low Power Switch 0 Channel 3

  ///////////////////////////////////////////////////////////////////
  // Low Power Switch 1 Switch Channels
  switchEntry ssIndexFwdSwitch;    // Low Power Switch 1 Channel 0
  switchEntry ssIndexRevSwitch;    // Low Power Switch 1 Channel 1
  switchEntry cameraSwitch;        // Low Power Switch 1 Channel 2
  switchEntry spare24VLPSChannel0; // Low Power Switch 1 Channel 3

  ///////////////////////////////////////////////////////////////////
  // Low Power Switch 2 Switch Channels
  switchEntry portSwingArmDeploy;  // Low Power Switch 2 Channel 0
  switchEntry portSwingArmStow;    // Low Power Switch 2 Channel 1
  switchEntry stbdSwingArmDeploy;  // Low Power Switch 2 Channel 2
  switchEntry stbdSwingArmStow;    // Low Power Switch 2 Channel 3

  ///////////////////////////////////////////////////////////////////
  // High Power Switch Entrys
  switchEntry ssPumpPowerSwitch;   // High Power Switch 0
  switchEntry tungstenLampSwitch;  // High Power Switch 1

  ///////////////////////////////////////////////////////////////////
  // Swing Arm Motor Switch Entry
  switchEntry saMotorPowerSwitch;  // Dual Vicor Single Mini Mod

  ///////////////////////////////////////////////////////////////////
  // Set Suction Sampler Motor Speed
  // [input] serialChan: Pointer to sio32Chan Structure
  // [input] boardAddr:  Address of Isolated I/O Board
  // [input] channel:    Analog Output Channel of the Isolated I/O
  // [input] level:      Value from 0 to 255 converts to 0-10V
  STATUS setMotorSpeed( sio32Chan *serialChan, Word boardAddr,
               Nat16 channel, Nat16 level );
  protected:

  ///////////////////////////////////////////////////////////////////
  // Process any changed DM items
  // Overrides method in DmMonitor
  virtual int processDmInput();

  ///////////////////////////////////////////////////////////////////
  // Process micro reset (when sync sem is given by MicroApp)
  // Overrides method in DmMonitor
  virtual int handleMicroReset();

  ///////////////////////////////////////////////////////////////////
  // Add all relevant dmItems to monitored group
  void addItems();

  ///////////////////////////////////////////////////////////////////
  // Suction Sampler Rossette Auto/Manual index
  MBool _autoIndexState;

  ///////////////////////////////////////////////////////////////////
  // Pointer to the main app
  MidWaterApp *_midwaterApp;
};


#endif
