Nokia N97 SDK
Example Applications Guide

CApplicationUsingSNAP Class Reference

#include <applicationusingsnap.h>

Inheritance diagram for CApplicationUsingSNAP:

List of all members.

Detailed Description

CApplicationUsingSNAP example of class using connection.

Definition at line 30 of file applicationusingsnap.h.


Public Member Functions

  ~CApplicationUsingSNAP ()
void  RunL ()
void  DoCancel ()
void  StartL ()

Static Public Member Functions

static CApplicationUsingSNAP *  NewL (MDataMobilityPrinter &aObserver)

Private Member Functions

  CApplicationUsingSNAP (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

CApplicationUsingSNAP::~CApplicationUsingSNAP (   ) 
 

Destructor.

Definition at line 63 of file applicationusingsnap.cpp.

References iConnection, and iSocketServer.

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

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

C++ default constructor.

Definition at line 52 of file applicationusingsnap.cpp.

Referenced by NewL().

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


Member Function Documentation

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

NewL is first phase of two-phased constructor.

Definition at line 28 of file applicationusingsnap.cpp.

References CApplicationUsingSNAP().

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

void CApplicationUsingSNAP::StartL (   ) 
 

Start the connection.

Definition at line 76 of file applicationusingsnap.cpp.

References iConnection, iSocketServer, and PrintL().

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

void CApplicationUsingSNAP::ConstructL (   )  [private]
 

By default Symbian OS constructor is private.

Definition at line 43 of file applicationusingsnap.cpp.

References iSocketServer.

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

void CApplicationUsingSNAP::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 127 of file applicationusingsnap.cpp.

References iObserver, and MDataMobilityPrinter::Print().

Referenced by RunL(), and StartL().

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

void CApplicationUsingSNAP::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 141 of file applicationusingsnap.cpp.

References iObserver, and MDataMobilityPrinter::Print().

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


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

© Nokia 2009

Back to top