//  Copyright (c) 2001, Reson, Inc. All Rights Reserved.
//
//  Filename:   CSubsystemConfig.h
//
//  Project:    6046
//
//  Author(s):  W. Arcus
//
//  Purpose:    
//
//  Notes:      
//

#if !defined(AFX_SUBSYSTEMCONFIG_H__3B9A9CD1_BCFD_40E4_963F_9DFF0A5CBFED__INCLUDED_)
#define AFX_SUBSYSTEMCONFIG_H__3B9A9CD1_BCFD_40E4_963F_9DFF0A5CBFED__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "EdgeTechHeaders.h"

#pragma pack( push, SUBSYSTEMCONFIG_H_PACK, 1 )

typedef enum tagETRIGGERMODE
{
    triggerInternal,
    triggerExternal,
    triggerCoupled,
    triggerGated
}
ETRIGGERMODE;

typedef struct tagSUBSYSTEMCONFIG
{
    bool                                    m_bAGCEnable;
    bool                                    m_bPingEnable;
    bool                                    m_bUseExternalTrigger;
    int                                     m_iFrameDecimationFactor;
    int                                     m_iSampleDecimationFactor;
    float                                   m_fRange;                           // Range in m.
    float                                   m_fPingPeriod;                      // Ping period in ms.
    int                                     m_iRxGain;
    ETRIGGERMODE                            m_eTriggerMode;
    long                                    m_lCoupledMasterId;
    char                                    m_szPulseFileName   [ ulMaxPulseFileNameLength_c ];
    int                                     m_aiChannelTxGain   [ ulMaxChannels_c ];

                    tagSUBSYSTEMCONFIG  (   void );
                   ~tagSUBSYSTEMCONFIG  (   void );

    void            Reset               (   void );
    void            SetDefault          (   void );

    static size_t   Size                (   void );

}
SUBSYSTEMCONFIG;

#pragma pack( pop, SUBSYSTEMCONFIG_H_PACK )

class CSubsystemConfig : public SUBSYSTEMCONFIG
{
public:

    typedef enum tagEACCESS
    {
        accessWrite     = 0,
        accessRead
    }
    EACCESS;

                        CSubsystemConfig            (   void );
    virtual            ~CSubsystemConfig            (   void );

    // Disk i/o support members.

    bool                Open                        (   const int               &riSubsystemId,
                                                        const EACCESS           &reAccess );

    bool                Close                       (   void );

    bool                IsOpen                      (   void )  const;

    bool                Write                       (   void );
    bool                Read                        (   void );

                        operator SUBSYSTEMCONFIG *  (   void );

private:

    ///////////////
    // Attrubtues.

    FILE               *m_fpFile;

    ///////////////
    // Services.

                        CSubsystemConfig            (   const CSubsystemConfig &rRhs );
    CSubsystemConfig &  operator =                  (   const CSubsystemConfig &rRhs );

    static CString      GetAppPath                  (   void );

};

#endif // !defined(AFX_SUBSYSTEMCONFIG_H__3B9A9CD1_BCFD_40E4_963F_9DFF0A5CBFED__INCLUDED_)
