Nokia N97 SDK
Example Applications Guide

CStandardApplication Class Reference

#include <standardapplication.h>

Inheritance diagram for CStandardApplication:

List of all members.

Detailed Description

CStandardApplication example of class using connection.

Definition at line 30 of file standardapplication.h.


Public Member Functions

  ~CStandardApplication ()
void  RunL ()
void  DoCancel ()
void  StartL ()

Static Public Member Functions

static CStandardApplication *  NewL (MDataMobilityPrinter &aObserver)

Private Member Functions

  CStandardApplication (MDataMobilityPrinter &aObserver)
void  ConstructL ()
void  PrintL (TInt aResourceId)
void  PrintL (TInt aResourceId, TInt aInt)

Private Attributes

MDataMobilityPrinter &  iObserver
RConnection  iConnection
RSocketServ  iSocketServer


Constructor & Destructor Documentation

CStandardApplication::~CStandardApplication (   ) 
 

Destructor of StandardApplication.

Definition at line 62 of file standardapplication.cpp.

References iConnection, and iSocketServer.

00063     {
00064     Cancel();
00065 
00066     iConnection.Close();
00067 
00068     iSocketServer.Close();
00069     }

CStandardApplication::CStandardApplication (  MDataMobilityPrinter &  aObserver  )  [private]
 

C++ default constructor.

Definition at line 51 of file standardapplication.cpp.

Referenced by NewL().

00052     : CActive( CActive::EPriorityStandard ),
00053       iObserver( aObserver )
00054     {
00055     CActiveScheduler::Add( this );
00056     }


Member Function Documentation

CStandardApplication * CStandardApplication::NewL (  MDataMobilityPrinter &  aObserver  )  [static]
 

NewL is first phase of two-phased constructor.

Definition at line 28 of file standardapplication.cpp.

References CStandardApplication().

Referenced by CDataMobilityAppOutputContainer::ConstructL().

00029     {
00030     CStandardApplication* self =
00031         new ( ELeave ) CStandardApplication( aObserver );
00032     CleanupStack::PushL( self );
00033     self->ConstructL();
00034     CleanupStack::Pop( self );
00035     return self;
00036     }

void CStandardApplication::StartL (   ) 
 

Start the connection.

Definition at line 75 of file standardapplication.cpp.

References iConnection, iSocketServer, and PrintL().

00076     {
00077     User::LeaveIfError( iConnection.Open( iSocketServer ) );
00078 
00079     // Let's open a valid access point
00080     TCommDbConnPref prefs;
00081     prefs.SetIapId( 1 ); // assume 1 is a valid IAP configured in CommsDat
00082     prefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
00083 
00084     PrintL( R_OUTPUT_START_CONNECTION_WITH_PREFERENCES );
00085 
00086     PrintL( R_OUTPUT_IAP_ID, prefs.IapId() );
00087 
00088     iConnection.Start( prefs, iStatus );
00089 
00090     SetActive();
00091     }

void CStandardApplication::ConstructL (   )  [private]
 

By default Symbian OS constructor is private.

Definition at line 42 of file standardapplication.cpp.

References iSocketServer.

00043     {
00044     User::LeaveIfError( iSocketServer.Connect() );
00045     }

void CStandardApplication::PrintL (  TInt  aResourceId  )  [private]
 

Helper method to send message to print to the observer.

Parameters:
aResourceId  Resource identifier of the string to print.

Definition at line 124 of file standardapplication.cpp.

References iObserver, and MDataMobilityPrinter::Print().

Referenced by RunL(), and StartL().

00125     {
00126     // Load a string from the resource file.
00127     HBufC* message = StringLoader::LoadL( aResourceId );
00128 
00129     iObserver.Print( *message );
00130 
00131     delete message;
00132     }

void CStandardApplication::PrintL (  TInt  aResourceId,
TInt  aInt
)  [private]
 

Helper method to send message to print to the observer.

Parameters:
aResourceId  Resource identifier of the string to print.
aInt  Integer value replacing N in the string.

Definition at line 138 of file standardapplication.cpp.

References iObserver, and MDataMobilityPrinter::Print().

00139     {
00140     // Load a string from the resource file.
00141     HBufC* message = StringLoader::LoadL( aResourceId, aInt );
00142 
00143     iObserver.Print( *message );
00144 
00145     delete message;
00146     }


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top