📄 iapconnectdemodatanotification.cpp
字号:
/*
* ============================================================================
* Name : CIAPConnectDemoDataNotification from
* IAPConnectDemoDataNotification.cpp
* Part of : Internet Access Points Example v2.0
* Created : 01.09.2006 by Forum Nokia
* Version : 2.0
* Copyright: Forum Nokia
* ============================================================================
*/
// INCLUDE FILES
#include "IAPConnectDemoDataNotification.h"
#include "IAPConnectDemoSocketsObserver.h"
// Constants
_LIT8(KSentLimitReached, "*Sent data limit reached");
_LIT8(KReceivedLimitReached, "*Received data limit reached");
// ========================= MEMBER FUNCTIONS ================================
// Constructor
CIAPConnectDemoDataNotification::CIAPConnectDemoDataNotification(
MIAPConnectDemoSocketsObserver& aDemoSocketsObserver,
RConnection& aConnection )
: CActive( EPriorityStandard ), iConnection( aConnection ),
iDemoSocketsObserver( aDemoSocketsObserver ), iDataPckg ( iData )
{
// No implementation required
}
// Destructor
CIAPConnectDemoDataNotification::~CIAPConnectDemoDataNotification()
{
Cancel();
}
// ---------------------------------------------------------------------------
// CIAPConnectDemoDataNotification::NewL()
// Two-phased constructor.
// ---------------------------------------------------------------------------
//
CIAPConnectDemoDataNotification* CIAPConnectDemoDataNotification::NewL(
MIAPConnectDemoSocketsObserver& aDemoSocketsObserver,
RConnection& aConnection )
{
CIAPConnectDemoDataNotification* self =
CIAPConnectDemoDataNotification::NewLC(aDemoSocketsObserver,
aConnection );
CleanupStack::Pop( self );
return self;
}
// ---------------------------------------------------------------------------
// CIAPConnectDemoDataNotification::NewLC()
// Two-phased constructor.
// ---------------------------------------------------------------------------
//
CIAPConnectDemoDataNotification* CIAPConnectDemoDataNotification::NewLC(
MIAPConnectDemoSocketsObserver& aDemoSocketsObserver,
RConnection& aConnection )
{
CIAPConnectDemoDataNotification* self =
new ( ELeave ) CIAPConnectDemoDataNotification(aDemoSocketsObserver,
aConnection );
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
// ---------------------------------------------------------------------------
// CIAPConnectDemoDataNotification::ConstructL()
// Symbian 2nd phase constructor can leave.
// ---------------------------------------------------------------------------
//
void CIAPConnectDemoDataNotification::ConstructL()
{
CActiveScheduler::Add( this );
}
// ---------------------------------------------------------------------------
// CIAPConnectDemoDataNotification::DoCancel()
// Cancels any outstanding operation.
// ---------------------------------------------------------------------------
//
void CIAPConnectDemoDataNotification::DoCancel()
{
if ( iType == ESentDataNotification )
{
iConnection.DataSentNotificationCancel();
}
else
{
iConnection.DataReceivedNotificationCancel();
}
}
// ---------------------------------------------------------------------------
// CIAPConnectDemoDataNotification::RunL()
// Called when operation completes.
// ---------------------------------------------------------------------------
//
void CIAPConnectDemoDataNotification::RunL()
{
if ( iType == ESentDataNotification )
{
iConnection.DataSentNotificationCancel();
iDemoSocketsObserver.ResponseReceivedL(KSentLimitReached);
}
else
{
iConnection.DataReceivedNotificationCancel();
iDemoSocketsObserver.ResponseReceivedL(KReceivedLimitReached);
}
}
// -----------------------------------------------------------------------------
// CIAPConnectDemoDataNotification::Start()
// Starts observing the amount of data received/sent.
// -----------------------------------------------------------------------------
//
void CIAPConnectDemoDataNotification::Start(const TNotificationType& aType,
const TUint& aDataAmount )
{
iType = aType;
if (aType == EReceivedDataNotification)
{
iConnection.DataReceivedNotificationRequest( aDataAmount , iDataPckg ,
iStatus );
}
else
{
iConnection.DataSentNotificationRequest( aDataAmount , iDataPckg ,
iStatus );
}
SetActive();
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -