/*****************************************************************************
* Copyright (c) 1990-98 Digi International Inc., All Rights Reserved
* 
* This software contains proprietary and confidential information of Digi
* International Inc.  By accepting transfer of this copy, Recipient agrees
* to retain this software in confidence, to prevent disclosure to others,
* and to make no use of this software other than that for which it was
* delivered.  This is an unpublished copyrighted work of Digi International
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
* prohibited.
* 
* Restricted Rights Legend
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7031 or
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -
* Restricted Rights at 48 CFR 52.227-19, as applicable.
*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
*
*****************************************************************************/


// Adapter.h: interface for the CAdapter class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ADAPTER_H__5A90D8AF_C28E_11D1_BAA4_00805F9E3135__INCLUDED_)
#define AFX_ADAPTER_H__5A90D8AF_C28E_11D1_BAA4_00805F9E3135__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "ConfigObject.h"
#include "HWResources.h"
#include "Dib.h"
#include "WizPageGenericWelcome.h"
#include "WizPageMultipleLines.h"
#include "WizPageGenericDone.h"
#include "IsaResources.h"

class FW_EXPORTED_CLASS CAdapter : public CConfigObject  
{
	DECLARE_DYNAMIC(CAdapter)

public:
	CAdapter(HKEY const hKeyRoot, CString const & strRegPath, CConfigObject const * const pParent);
	virtual ~CAdapter();

   virtual BOOL SetParameters(void);

   virtual BOOL AddChild(void);

	virtual BOOL AddWizardPages(CConfigWizSheet * const pSheet);
	virtual BOOL RemoveWizardPages(CConfigWizSheet * const pSheet);
	virtual BOOL NextWizardPage(int const nState);

	virtual CString GetInformationText(void);
	virtual BOOL DoProperties(void);

   int GetVAdapterNum(void) const { return m_nVAdapterNum; }

   virtual BOOL DetectHWChange(BOOL & fHWChanged, BOOL & fRunWizard) { fHWChanged = FALSE; fRunWizard = FALSE; return TRUE; }

   int GetAdapterMaxPorts() const { return m_cMaxPorts;}
   int GetAdapterMaxLogicalChansPerLine() const { return m_cMaxLogicalChannelsPerLine;}
   int AdapterHasModems() const { return m_nHasModems;}
   BOOL AdapterHasWizard() const { return (0 != m_nHasWizard);}
   CString GetServiceName() const { return m_strServiceName;}
   CString GetDeviceName() const { return m_strDeviceName;}

   BOOL AdapterHasConfigMessage(void) { return !m_ConfigMessage.IsEmpty(); }
   void AddConfigMessage(CString & str) { m_ConfigMessage += str; }
   CString GetConfigMessage(void) { return m_ConfigMessage; }

protected:
   BOOL AddChild(int const nChild);
   void CAdapter::SetUpdateIdenity();

   //
   // Parameters gettable/settable by the config (data resides in adapter instance registry key)
   SHWResources m_hwResources;

   CString m_strOption;
   int m_nVAdapterNum;

   CString m_strBiosImagePath;
   CString m_strFepImagePath;
   CString m_strServiceName;
   CString m_strDeviceName;
   int m_cLines;

   //
   // Method for getting parameters
   BOOL GetParameters(void);

   //
   // Static config data for this specific adapter type (data resides in SOFTWARE\Digi registry key)
   int m_cMaxPorts;
   int m_cMaxLogicalChannelsPerLine;
   int m_nHasModems;
   int m_nHasWizard;

   //
   // Method for getting static config data
   BOOL GetConfigData(void);
   //
   // Wizard stuff
	CConfigWizSheet * m_pwsSheet;

	CDib  m_WizBmp;

	enum
	{

		WP_WELCOME,
		WP_RESOURCES,
		WP_MULTILINES,
		WP_DONE,
		WP_COUNT
	};

	CWizPageGenericWelcome * m_pwpWelcome;
	BOOL HandleWizWelcome(void);

	CWizPageMultipleLines * m_pwpMultiLines;
	BOOL HandleWizMultiLines(void);

	CWizPageGenericDone * m_pwpDone;
	BOOL HandleWizDone(void);

	CISAResources * m_pwpIsaResources;
	BOOL HandleResources(void);
	BOOL m_fAskMultiLines;
	// static data defining choices for Io,Memory and Irq
    CStringArray m_astrIoChoices;
	CStringArray m_astrMemChoices;
	CStringArray m_astrIrqChoices;


private:
   BOOL AddLineWizardPages(int const cLinesToAdd);
   BOOL AddMultiLinePage();
   CString m_ConfigMessage;
};

#endif // !defined(AFX_ADAPTER_H__5A90D8AF_C28E_11D1_BAA4_00805F9E3135__INCLUDED_)
