/*++
*******************************************************************************
* 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				*
*																										*
*******************************************************************************

Module Name:

   IsdnTraceStats.cpp

Abstract:

   ISDN stats pane used during trace capture.

Author:

   Michael Zarns

--*/

#include "stdafx.h"
#include "diagnostic.h"
#include "DataSource.h"
#include "Tracer.h"
#include "IsdnTrace.h"
#include "IsdnTraceStats.h"
#include "resource.h"

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


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// CIsdnTraceIl3View dialog
//

IMPLEMENT_DYNCREATE(CIsdnTraceIl3View, CTracePage)

CIsdnTraceIl3View::CIsdnTraceIl3View() : CTracePage(CIsdnTraceIl3View::IDD)
{
	//{{AFX_DATA_INIT(CIsdnTraceIl3View)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CIsdnTraceIl3View::DoDataExchange(CDataExchange* pDX)
{
	CTracePage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CIsdnTraceIl3View)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CIsdnTraceIl3View, CTracePage)
	//{{AFX_MSG_MAP(CIsdnTraceIl3View)
	ON_WM_ERASEBKGND()
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CIsdnTraceIl3View message handlers

void CIsdnTraceIl3View::OnUpdate(WPARAM lHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (lHint == uavTraceFasterPeriod) 
	{
		const CIsdnTraceData *td = (const CIsdnTraceData *)GetTraceData();
		CDataExchange dx(this, FALSE);
		
		DDX_Text(&dx, IDC_IL3_ALERTING_TX, (DWORD&)td->nAlerting[0]);
		DDX_Text(&dx, IDC_IL3_ALERTING_RX, (DWORD&)td->nAlerting[1]);
		DDX_Text(&dx, IDC_IL3_CALL_PROCEEDING_TX, (DWORD&)td->nCallProceeding[0]);
		DDX_Text(&dx, IDC_IL3_CALL_PROCEEDING_RX, (DWORD&)td->nCallProceeding[1]);
		DDX_Text(&dx, IDC_IL3_CONNECT_TX, (DWORD&)td->nConnect[0]);
		DDX_Text(&dx, IDC_IL3_CONNECT_RX, (DWORD&)td->nConnect[1]);
		DDX_Text(&dx, IDC_IL3_CONNECT_ACK_TX, (DWORD&)td->nConnectAck[0]);
		DDX_Text(&dx, IDC_IL3_CONNECT_ACK_RX, (DWORD&)td->nConnectAck[1]);
		DDX_Text(&dx, IDC_IL3_SETUP_TX, (DWORD&)td->nSetup[0]);
		DDX_Text(&dx, IDC_IL3_SETUP_RX, (DWORD&)td->nSetup[1]);
		DDX_Text(&dx, IDC_IL3_DISCONNECT_TX, (DWORD&)td->nDisconnect[0]);
		DDX_Text(&dx, IDC_IL3_DISCONNECT_RX, (DWORD&)td->nDisconnect[1]);
		DDX_Text(&dx, IDC_IL3_RELEASE_TX, (DWORD&)td->nRelease[0]);
		DDX_Text(&dx, IDC_IL3_RELEASE_RX, (DWORD&)td->nRelease[1]);
		DDX_Text(&dx, IDC_IL3_RELEASE_COMPLETE_TX, (DWORD&)td->nReleaseComplete[0]);
		DDX_Text(&dx, IDC_IL3_RELEASE_COMPLETE_RX, (DWORD&)td->nReleaseComplete[1]);
		DDX_Text(&dx, IDC_IL3_RESTART_TX, (DWORD&)td->nRestart[0]);
		DDX_Text(&dx, IDC_IL3_RESTART_RX, (DWORD&)td->nRestart[1]);
		DDX_Text(&dx, IDC_IL3_RESTART_ACK_TX, (DWORD&)td->nRestartAck[0]);
		DDX_Text(&dx, IDC_IL3_RESTART_ACK_RX, (DWORD&)td->nRestartAck[1]);

		DWORD OtherTx = td->nProgress[0] + td->nSetupAck[0] + td->nResume[0] + td->nResumeAck[0] + td->nResumeReject[0] +
							 td->nSuspend[0] + td->nSuspendAck[0] + td->nSuspendReject[0] + 
							 td->nUserInfo[0] + td->nCongestionControl[0] + td->nFacility[0] + 
							 td->nInformation[0] + td->nNotify[0] + 
							 td->nStatus[0] + td->nStatusEnquiry[0];

		DWORD OtherRx = td->nProgress[1] + td->nSetupAck[0] + td->nResume[1] + td->nResumeAck[1] + td->nResumeReject[1] +
							 td->nSuspend[1] + td->nSuspendAck[1] + td->nSuspendReject[1] + 
							 td->nUserInfo[0] + td->nCongestionControl[1] + td->nFacility[1] + 
							 td->nInformation[1] + td->nNotify[1] + 
							 td->nStatus[1] + td->nStatusEnquiry[1];

		DDX_Text(&dx, IDC_IL3_OTHER_TX, (DWORD&)OtherTx);
		DDX_Text(&dx, IDC_IL3_OTHER_RX, (DWORD&)OtherRx);
	}
}

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// CIsdnTraceLapdView dialog
//

IMPLEMENT_DYNCREATE(CIsdnTraceLapdView, CTracePage)

CIsdnTraceLapdView::CIsdnTraceLapdView() : CTracePage(CIsdnTraceLapdView::IDD)
{
	//{{AFX_DATA_INIT(CIsdnTraceLapdView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CIsdnTraceLapdView::DoDataExchange(CDataExchange* pDX)
{
	CTracePage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CIsdnTraceLapdView)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CIsdnTraceLapdView, CTracePage)
	//{{AFX_MSG_MAP(CIsdnTraceLapdView)
	ON_WM_ERASEBKGND()
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CIsdnTraceLapdView message handlers

void CIsdnTraceLapdView::OnUpdate(WPARAM lHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (lHint == uavTraceFasterPeriod) 
	{
		const CIsdnTraceData *td = (const CIsdnTraceData *)GetTraceData();
		CDataExchange dx(this, FALSE);
		
		DDX_Text(&dx, IDC_LAPD_INFO_TX,  (DWORD&)td->nInfo[0]);
		DDX_Text(&dx, IDC_LAPD_INFO_RX,  (DWORD&)td->nInfo[1]);
		DDX_Text(&dx, IDC_LAPD_RR_TX,    (DWORD&)td->nRR[0]);
		DDX_Text(&dx, IDC_LAPD_RR_RX,    (DWORD&)td->nRR[1]);
		DDX_Text(&dx, IDC_LAPD_RNR_TX,   (DWORD&)td->nRNR[0]);
		DDX_Text(&dx, IDC_LAPD_RNR_RX,   (DWORD&)td->nRNR[1]);
		DDX_Text(&dx, IDC_LAPD_REJ_TX,   (DWORD&)td->nREJ[0]);
		DDX_Text(&dx, IDC_LAPD_REJ_RX,   (DWORD&)td->nREJ[1]);
		DDX_Text(&dx, IDC_LAPD_SABME_TX, (DWORD&)td->nSABME[0]);
		DDX_Text(&dx, IDC_LAPD_SABME_RX, (DWORD&)td->nSABME[1]);
		DDX_Text(&dx, IDC_LAPD_DM_TX,    (DWORD&)td->nDM[0]);
		DDX_Text(&dx, IDC_LAPD_DM_RX,    (DWORD&)td->nDM[1]);
		DDX_Text(&dx, IDC_LAPD_DISC_TX,  (DWORD&)td->nDISC[0]);
		DDX_Text(&dx, IDC_LAPD_DISC_RX,  (DWORD&)td->nDISC[1]);
		DDX_Text(&dx, IDC_LAPD_UA_TX,    (DWORD&)td->nUA[0]);
		DDX_Text(&dx, IDC_LAPD_UA_RX,    (DWORD&)td->nUA[1]);
		DDX_Text(&dx, IDC_LAPD_FRMR_TX,  (DWORD&)td->nFRMR[0]);
		DDX_Text(&dx, IDC_LAPD_FRMR_RX,  (DWORD&)td->nFRMR[1]);
		DDX_Text(&dx, IDC_LAPD_UI_TX,    (DWORD&)td->nUI[0]);
		DDX_Text(&dx, IDC_LAPD_UI_RX,    (DWORD&)td->nUI[1]);
	}
}

