// CAutonomyDlg.h :  Header file
//

#if !defined(__AUTONOMYDLG_H__)
#define __AUTONOMYDLG_H__


#include "VAIBO.h"
#include "resource.h"


#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CAutonomyDlg : public CDialog
{

public:

	// standard constructor
	CAutonomyDlg( CVAIBO *vaibo, CWnd* pParent = NULL );

	// Dialog Data
	//{{AFX_DATA(CAutonomyDlg)
	enum { IDD = IDD_DIALOG_AUTONOMY };
	CComboBox	m_ComboFunction;
	//}}AFX_DATA


	//{{AFX_VIRTUAL(CAutonomyDlg)
	protected:
	virtual void DoDataExchange( CDataExchange* pDX );    // DDX/DDV support
	//}}AFX_VIRTUAL

protected:

	// Generated message map functions
	//{{AFX_MSG(CAutonomyDlg)
	virtual void	OnOK();
	virtual BOOL	OnInitDialog();
	afx_msg void	OnDestroy();
	afx_msg void	OnRadioExternalControl();
	afx_msg void	OnRadioInternalControl();
	afx_msg void	OnRadioAutonomy();
	afx_msg void	OnRadioSafty();
	afx_msg void	OnRadioShutdown();
	afx_msg void	OnRadioAROn();
	afx_msg void	OnRadioAROff();
	afx_msg void	OnRadioMROn();
	afx_msg void	OnRadioMROff();
	afx_msg void	OnRadioHFDOn();
	afx_msg void	OnRadioHFDff();
	afx_msg void	OnRadioHFIOn();
	afx_msg void	OnRadioHFIff();
	afx_msg void	OnRadioVPROn();
	afx_msg void	OnRadioVPRff();
	afx_msg void	OnRadioPINKOn();
	afx_msg void	OnRadioPINKOff();
	afx_msg void	OnRadioCliffOn();
	afx_msg void	OnRadioCliffOff();
	afx_msg void	OnRadioSpeakerOn();
	afx_msg void	OnRadioSpeakerOff();
	afx_msg void	OnButtonFunction();
	afx_msg void	OnButtonFunction2();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()


private:

	// Mode when disconnected
	enum eCutoffMode {
		eCutoffModeAutonomy,			// Autonomous
		eCutoffModeGainOff,				// GainOff
		eCutoffModeSafty,				// A stable posture
		eCutoffModeShutdown,			// Shutdown
		eCutoffModeMax,
		eCutoffModeIllegal = -1
	};

private:

	CButton& radioExternalControl() { return *( CButton* )GetDlgItem( IDC_RADIO_EXTERNAL_CONTROL ); }
	CButton& radioInternalControl() { return *( CButton* )GetDlgItem( IDC_RADIO_INTERNAL_CONTROL ); }
	CButton& radioAutonomy() { return *( CButton* )GetDlgItem( IDC_RADIO_AUTONOMY ); }
	CButton& radioSafty() { return *( CButton* )GetDlgItem( IDC_RADIO_SAFTY ); }
	CButton& radioShutdown() { return *( CButton* )GetDlgItem( IDC_RADIO_SHUTDOWN ); }
	CButton& radioAROn() { return *( CButton* )GetDlgItem( IDC_RADIO_AR_ON ); }
	CButton& radioAROff() { return *( CButton* )GetDlgItem( IDC_RADIO_AR_OFF ); }
	CButton& radioMROn() { return *( CButton* )GetDlgItem( IDC_RADIO_MR_ON ); }
	CButton& radioMROff() { return *( CButton* )GetDlgItem( IDC_RADIO_MR_OFF ); }
	CButton& radioHFDOn() { return *( CButton* )GetDlgItem( IDC_RADIO_HFD_ON ); }
	CButton& radioHFDOff() { return *( CButton* )GetDlgItem( IDC_RADIO_HFD_OFF ); }
	CButton& radioHFIOn() { return *( CButton* )GetDlgItem( IDC_RADIO_HFI_ON ); }
	CButton& radioHFIOff() { return *( CButton* )GetDlgItem( IDC_RADIO_HFI_OFF ); }
	CButton& radioVPROn() { return *( CButton* )GetDlgItem( IDC_RADIO_VPR_ON ); }
	CButton& radioVPROff() { return *( CButton* )GetDlgItem( IDC_RADIO_VPR_OFF ); }
	CButton& radioPINKOn() { return *( CButton* )GetDlgItem( IDC_RADIO_PINK_ON ); }
	CButton& radioPINKOff() { return *( CButton* )GetDlgItem( IDC_RADIO_PINK_OFF ); }
	CButton& radioCliffOn() { return *( CButton* )GetDlgItem( IDC_RADIO_CLIFF_ON ); }
	CButton& radioCliffOff() { return *( CButton* )GetDlgItem( IDC_RADIO_CLIFF_OFF ); }
	CButton& radioSpeakerOn() { return *( CButton* )GetDlgItem( IDC_RADIO_SPEAKER_ON ); }
	CButton& radioSpeakerOff() { return *( CButton* )GetDlgItem( IDC_RADIO_SPEAKER_OFF ); }
	CButton& buttonFunction() { return *( CButton* )GetDlgItem( IDC_BUTTON_FUNCTION ); }
	CButton& buttonFunction2() { return *( CButton* )GetDlgItem( IDC_BUTTON_FUNCTION2 ); }

	// Virtual AIBO
	CVAIBO *m_vaibo;

	bool	m_isControl;
	int		m_nCutoffMode;
	bool	m_isRobotObject[ eRobotObjectMax ];


	void	InitAutonomyService();
	void	ClearAutonomyService();
	void	CheckAutonomyService();

public:
	void	SetControlFlag( bool isControl );


};

//{{AFX_INSERT_LOCATION}}

#endif // __AUTONOMYDLG_H__
