/*
*******************************************************************************
* Copyright (c) 1996-97 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 copyright work  Digi   International *
* Inc.    Except   as   permitted   by  federal  law,  17 USC 117, copying is *
* strictly prohibited.                                                        *
*                                                                             *
* Digi  International  Inc.  CONFIDENTIAL  -   (Digi    International    Inc. *
* Confidential  when   combined   with   the   aggregated  modules  for  this *
* product) OBJECT CODE ONLY SOURCE MATERIALS                                  *
*                                                                             *
* (C) COPYRIGHT Digi International Inc. 1996-97                               *
*                                                                             *
* All Rights Reserved                                                         *
*                                                                             *
* US   Government   Users   Restricted   Rights   -   Use,   duplication   or *
* disclosure  restricted by GSA ADP Schedule Contract with Digi International *
* Inc.                                                                        *
*                                                                             *
*******************************************************************************

// TraceStatView.cpp : implementation file
//

Revision History:

   $History: TraceStatView.cpp $
 * 
 * *****************  Version 21  *****************
 * User: Mikez        Date: 7/11/97    Time: 5:03p
 * Branched in $/Components/Windows/NT/Sync/Build/Diag
 * 
 * *****************  Version 20  *****************
 * User: Rodgerb      Date: 1/27/97    Time: 1:19p
 * Updated in $/Components/Windows/NT/Sync/rev2diag
 * 1) documentation
 * 2) added some new params to Physical layer stats
*/

#include "stdafx.h"
#include "Diagnostic.h"

#include "DataSource.h"
#include "TraceStatView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTraceStatView

IMPLEMENT_DYNCREATE(CTraceStatView, CTracePage)

CTraceStatView::CTraceStatView() : CTracePage(CTraceStatView::IDD)
{
	//{{AFX_DATA_INIT(CTraceStatView)
	//}}AFX_DATA_INIT
}

CTraceStatView::~CTraceStatView()
{
}

void CTraceStatView::DoDataExchange(CDataExchange* pDX)
{
	CTracePage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTraceStatView)
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTraceStatView, CTracePage)
	//{{AFX_MSG_MAP(CTraceStatView)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTraceStatView message handlers

extern LPSTR NumInBytes(char *, DWORD);
void CTraceStatView::OnUpdate(WPARAM lHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (lHint == uavTraceFasterPeriod) {
		const CTraceData *td = GetTraceData();
		TCHAR buf[64];

		CDataExchange dx(this, FALSE);

		int temp = 0;
		DDX_Text(&dx, IDC_BufferFrames, temp = td->m_FrameBuffer.GetNumFrames());
		DDX_Text(&dx, IDC_BufferBytes, CString(NumInBytes(buf, td->m_FrameBuffer.GetNumBytes())));
		
		CString Time = td->m_Elapsed.Format("%H:%M:%S");
		DDX_Text(&dx, IDC_Time, Time);

		DDX_Text(&dx, IDC_FCTx, (DWORD&)td->FC[0]);
		DDX_Text(&dx, IDC_FcRx, (DWORD&)td->FC[1]);

		DDX_Text(&dx, IDC_BcTx, CString(NumInBytes(buf, td->BC[0])));
		DDX_Text(&dx, IDC_BcRx, CString(NumInBytes(buf, td->BC[1])));
		}
}
