#if !defined(AFX_BATHYDISPLAY_H__BCEF92D5_2075_4525_8544_7C8058F2D681__INCLUDED_)
#define AFX_BATHYDISPLAY_H__BCEF92D5_2075_4525_8544_7C8058F2D681__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// BathyDisplay.h : header file
//

#include "2DBathyDisplay.h"
#include "SystemConfig.h"


#pragma pack(1)

/*
struct DATA_TIME1
{
	unsigned long Seconds;					    // Seconds since 00:00:00, 1 January 1970.
	unsigned long Millisecs;					// Milliseconds, LSB = 1ms.
};


typedef struct 	tagR_THETA
{
	char		      synch_header[4];        // synch header {0xff, 0xff, 0x00, 0x00
	char      		  packet_type; 		      // identifier for packet type (0x17)
	char     		  packet_subtype; 	      // identifier for packet subtype
	unsigned short 	  latency;                // time from ping to output (milliseconds)
	DATA_TIME1        data_time;     		  // time of ping for data packet (0 if no UTC input)
	unsigned long	  ping_number;	          // sequential ping number from sonar startup/reset
	unsigned long	  sonar_id;			      // least significant four bytes of Ethernet address
	unsigned short	  sonar_model;		      // coded model number of sonar
	unsigned short	  frequency;	    	  // sonar frequency in KHz
	unsigned short 	  velocity;               // programmed sound velocity (LSB = 1 m/sec)
	unsigned short 	  sample_rate;   		  // A/D sample rate (samples per second)
	unsigned short 	  ping_rate;     		  // Ping rate (pings per second * 1000)
	unsigned short 	  range_set;     		  // range setting for SeaBat (meters )
	unsigned short 	  power;         		  // power setting for SeaBat  	
	unsigned short 	  gain;         		  // gain setting for SeaBat
					                          // bits	0-6 -	gain (1 - 45)
					                          // bit 	14	(0 = fixed, 1 = tvg)
					                          // bit	15	(0 = manual, 1 = auto)
	unsigned short    pulse_width;			  // transmit pulse width (microseconds)
	unsigned char	  tvg_spread;	    	  // spreading coefficient for tvg * 4 
						                      // valid values = 0 to 240 (0.0 to 60.0 in 0.25 steps)
	unsigned char	  tvg_absorp;		      // absorption coefficient for tvg
	unsigned char     projector_type;  		  // bits 0-4 = projector type
				                              // bit 7 - pitch steering (1=enabled, 0=disabled)
	unsigned char     projector_beam_width;	  // along track transmit beam width (degrees * 10)
	unsigned short    beam_spacing_num;		  // Receive beam angular spacing numerator
	unsigned short 	  beam_spacing_denom;	  // cross track receive beam angular spacing denominator
						                      // beam width degrees = numerator / denominator
	short		      projector_angle;		  // projector pitch steering angle (degrees * 100)
	unsigned short	  min_range;		      // sonar filter settings
	unsigned short	  max_range;
	unsigned short	  min_depth;
	unsigned short	  max_depth;
	unsigned char	  filters_active;		  // range/depth filters active 
						                      // bit 0 - range filter (0 = off, 1 = active)
						                      // bit 1 - depth filter (0 = off, 1 = active)
	unsigned char 	  flags;		          // bit 0 - Roll stabilization flag. 0 = off, 1 = on.	
	unsigned char	  spare[2];				  // spare field for future growth
	short		      temperature;		      // temperature at sonar head (deg C * 10)
	short          	  beam_count;             // number of sets of beam data in packet
	unsigned short 	  range[240];			  // range for beam where n = beam_count
						                      // range units = sample cells * 4 ("14.2" Format)
	unsigned char  	  quality[120];     	  // packed quality array (two 4 bit values/char)
						                      // cnt = n/2 if beam count even, n/2+1 if odd
											  // cnt then rounded up to next even number
						                      // e.g. if beam count=101, cnt=52 
						                      // unused trailing quality values set to zero
						                      // bit 0 - brightness test (0=failed, 1=passed)
						                      // bit 1 - colinearity test (0=failed, 1=passed)
						                      // bit 2 - amplitude bottom detect used
						                      // bit 3 - phase bottom detect used
						                      // bottom detect can be amplitude, phase or both
	unsigned short 	  checksum;         	  // checksum for data packet

} R_THETA;
*/

#pragma pack()

#define MAX_BATHY_BUFFER	1024/*max beams*/ * 4/*sizeof float*/ * 4 //fluff
#define BATHY_PROCESS		112358

/////////////////////////////////////////////////////////////////////////////
// CBathyDisplay dialog

class CBathyDisplay : public CDialog
{
// Construction
public:
	CBathyDisplay(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(CBathyDisplay)
	enum { IDD = IDD_DLG_BATHY };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA


	//R_THETA             m_theta;


	void				AddBathyData			(	void*			pData );

	BOOL				ProcessBathyData		(	UINT beams );

	void				SetSoundVelocity		(	double SV );

	void				SetBeamSpacing			(	double BW );

	void				SetFlip					(	BOOL bFlip );

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CBathyDisplay)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CBathyDisplay)
	virtual BOOL OnInitDialog();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnDestroy();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnSettingsColor();
	afx_msg void OnSettingsPointsize();
	afx_msg void OnSettingsTemporalspacing();
	afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
	afx_msg void OnPaint();
	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
	afx_msg void OnClose();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

	C2DBathyDisplay		m_bathyDisplay;
	CMenu				m_Menu;

	double				m_dBeamSpacing;
	double				m_dSoundVelocity;
	DWORD               m_dwPos;
    DWORD               m_dwSize;
    HANDLE              m_hFile;
    char				*m_pBuf;
	char				*m_pFlipBuf;

	BOOL				m_bFlip;

	BOOL				m_bFirst;

	CSystemConfig*		m_pConfig;


};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_BATHYDISPLAY_H__BCEF92D5_2075_4525_8544_7C8058F2D681__INCLUDED_)
