Nokia N97 SDK
Example Applications Guide

CALRApplication Class Reference

#include <alrapplication.h>

Inheritance diagram for CALRApplication:

List of all members.

Detailed Description

CALRApplication example of class using connection and Mobility extension API.

Definition at line 33 of file alrapplication.h.


Public Member Functions

  ~CALRApplication ()
void  RunL ()
void  DoCancel ()
TInt  RunError (TInt aError)
void  PreferredCarrierAvailable (TAccessPointInfo aOldAPInfo, TAccessPointInfo aNewAPInfo, TBool aIsUpgrade, TBool aIsSeamless)
void  NewCarrierActive (TAccessPointInfo aNewAPInfo, TBool aIsSeamless)
void  Error (TInt aError)
void  StartL ()

Static Public Member Functions

static CALRApplication *  NewL (MDataMobilityPrinter &aObserver)

Private Member Functions

  CALRApplication (MDataMobilityPrinter &aObserver)
void  ConstructL ()
void  Print (TInt aResourceId)
void  Print (TInt aResourceId, TInt aInt)

Private Attributes

MDataMobilityPrinter &  iObserver
RConnection  iConnection
RSocketServ  iSocketServer
CActiveCommsMobilityApiExt *  iMobility


Constructor & Destructor Documentation

CALRApplication::~CALRApplication (   ) 
 

Destructor.

Definition at line 63 of file alrapplication.cpp.

References iConnection, iMobility, and iSocketServer.

00064     {
00065     delete iMobility;
00066 
00067     Cancel();
00068 
00069     iConnection.Close();
00070 
00071     iSocketServer.Close();
00072     }

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

C++ default constructor.

Definition at line 51 of file alrapplication.cpp.

Referenced by NewL().

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


Member Function Documentation

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

NewL is first phase of two-phased constructor.

Definition at line 28 of file alrapplication.cpp.

References CALRApplication().

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

void CALRApplication::StartL (   ) 
 

Start the connection.

Definition at line 78 of file alrapplication.cpp.

References iConnection, iSocketServer, and Print().

00079     {
00080     User::LeaveIfError( iConnection.Open( iSocketServer ) );
00081 
00082     TConnSnapPref prefs;
00083     prefs.SetSnap( 1 ); // assume 1 is a valid SNAP configured in CommsDat
00084 
00085     Print( R_OUTPUT_START_CONNECTION_WITH_PREFERENCES );
00086 
00087     Print( R_OUTPUT_SNAP_ID, prefs.Snap() );
00088 
00089     iConnection.Start( prefs, iStatus );
00090 
00091     SetActive();
00092     }

void CALRApplication::ConstructL (   )  [private]
 

By default Symbian OS constructor is private.

Definition at line 42 of file alrapplication.cpp.

References iSocketServer.

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

void CALRApplication::Print (  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 220 of file alrapplication.cpp.

References iObserver, and MDataMobilityPrinter::Print().

Referenced by Error(), NewCarrierActive(), PreferredCarrierAvailable(), RunError(), RunL(), and StartL().

00221     {
00222     // Load a string from the resource file.
00223     HBufC* message = NULL;
00224     TRAPD( err, message = StringLoader::LoadL( aResourceId ) );
00225     if ( err != KErrNone )
00226         {
00227         return;
00228         }
00229 
00230     iObserver.Print( *message );
00231 
00232     delete message;
00233     }

void CALRApplication::Print (  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 239 of file alrapplication.cpp.

References iObserver, and MDataMobilityPrinter::Print().

00240     {
00241     // Load a string from the resource file.
00242     HBufC* message = NULL;
00243     TRAPD( err, message = StringLoader::LoadL( aResourceId, aInt ) );
00244     if ( err != KErrNone )
00245         {
00246         return;
00247         }
00248 
00249     iObserver.Print( *message );
00250 
00251     delete message;
00252     }


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

© Nokia 2009

Back to top