//{{AFX_INCLUDES()
#include "cwknob.h"
#include "cwgraph.h"
#include "cwgraph3d.h"
#include "indicator2.h"
//}}AFX_INCLUDES
#if !defined(AFX_MISSIONCONTROLDLG_H__ED7497F9_B2E4_43EC_A653_E826C27CD4A5__INCLUDED_)
#define AFX_MISSIONCONTROLDLG_H__ED7497F9_B2E4_43EC_A653_E826C27CD4A5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MissionControlDlg.h : header file
//

#include "DataRecipient.h"
#include "ClrButton.h"
#include "Label.h"

#define MIS_BEHAVIOR_UPDATE_PERIOD 5

class CDashboardRecipient;
class CDashboardDlg;
class CHeadingControlDlg;
class CWaypointControlDlg;

/////////////////////////////////////////////////////////////////////////////
// CMissionControlDlg dialog

class CMissionControlDlg : public CDialog, public CDataRecipient
{
// Construction
public:
	CMissionControlDlg(CWnd* pParent = NULL);   // standard constructor
	~CMissionControlDlg();

	void setDashboardDlg(CDashboardDlg *dd)
	{ m_dd = dd; };

	void setRecipient(CDashboardRecipient *recipient)
		{ m_recipient = recipient; };
	void resetDialog();

	void requestUpdate();
	void stopRequests();

	void setHeading(double heading);
	void setAttitude(double pitch, double roll);
	void setPosition(double latitude, double longitude);
	void setSpeed(double speed);
	void setAltitude(double altitude);
	void setDepth(double depth);
	void setWaterAlarm(int number, bool value);
	void setBatteryPackStatus(int number, double voltage, double current);
	void setMissionTime(int time);
	void setUnderway(int value);
	void setCurrentBehavior(int curS, int curB, int misRunning);
	void setGroundFaultCurrent(int number, double value);
	void setLogDirName(CString str);
	void setBatteryInfo(int num, double voltage, double amps, double minV, 
		double maxV, double temp, double capacity, char state, char errorState, int comms,
		int errorLevel);

// Dialog Data
	//{{AFX_DATA(CMissionControlDlg)
	enum { IDD = IDD_MISSION_DIALOG };
	double	m_altitude;
	double	m_roll;
	double	m_pitch;
	double	m_heading;
	CCWKnob	m_depth;
	double	m_latitude;
	double	m_longitude;
	double	m_pitchIndicator;
	double	m_rollIndicator;
	BOOL	m_water1;
	BOOL	m_water2;
	BOOL	m_water3;
	BOOL	m_water4;
	double	m_yawIndicator;
	double	m_speedIndicator;
	double	m_depthIndicator;
	double	m_timer;
	BOOL	m_underway;
	double	m_gfcurrent1;
	double	m_gfcurrent2;
	double	m_gfcurrent3;
	double	m_gfcurrent4;
	double	m_batAmp1;
	double	m_batAmp2;
	double	m_batAmp3;
	double	m_batVolt1;
	double	m_batVolt2;
	double	m_batVolt3;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMissionControlDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// My members
	CDashboardDlg *m_dd;
	CDashboardRecipient *m_recipient;
	virtual BOOL OnInitDialog();
	
	CHeadingControlDlg *m_headingCon;
	CWaypointControlDlg *m_waypointCon;

	//Colored buttons
	CClrButton m_emerDropBut;
	CClrButton m_abortMisBut;
	CClrButton m_killMisBut;
	CLabel m_logDirLabel;

	CString m_title;
	void receiveData();

	BOOL OnToolTipNotify(UINT id, NMHDR * pTTTStruct, LRESULT * pResult);

	// Generated message map functions
	//{{AFX_MSG(CMissionControlDlg)
	virtual void OnOK();
	afx_msg void OnAbort();
	afx_msg void OnKill();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnClose();
	afx_msg void OnDropweight();
	afx_msg void OnStartMission();
	afx_msg void OnHeadconInit();
	afx_msg void OnWayconInit();
	afx_msg void OnUpdateSlow();
	afx_msg void OnUpdateFast();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MISSIONCONTROLDLG_H__ED7497F9_B2E4_43EC_A653_E826C27CD4A5__INCLUDED_)
