S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CSIPExSocketReader Class Reference

#include <SIPExSocketReader.h>

List of all members.

Public Member Functions

 ~CSIPExSocketReader ()
void Read ()

Static Public Member Functions

static CSIPExSocketReader * NewL (RSocket &aSocket, MSIPExReaderNotifier &aNotifier)
static CSIPExSocketReader * NewLC (RSocket &aSocket, MSIPExReaderNotifier &aNotifier)

Protected Member Functions

void DoCancel ()
void RunL ()

Private Member Functions

 CSIPExSocketReader (RSocket &aSocket, MSIPExReaderNotifier &aNotifier)
void ConstructL ()

Private Attributes

MSIPExReaderNotifier & iNotifier
RSocket & iSocket
TBuf8< 1 > iBuffer
TBuf8< 256 > iMessage


Detailed Description

CSIPExSocketReader Reads data from the connected socket.

Definition at line 29 of file SIPExSocketReader.h.


Constructor & Destructor Documentation

CSIPExSocketReader::~CSIPExSocketReader (   ) 
 

~CSIPExSocketReader Destructor

Definition at line 70 of file SIPExSocketReader.cpp.

00071     {
00072     Cancel();
00073     }

CSIPExSocketReader::CSIPExSocketReader (  RSocket &  aSocket,
MSIPExReaderNotifier &  aNotifier
)  [private]
 

CSIPExSocketReader Constructor

Parameters:
aSocket The reference to the socket
aNotifier The reference to the reader notifier

Definition at line 55 of file SIPExSocketReader.cpp.

00058     : CActive(CActive::EPriorityStandard), 
00059       iNotifier( aNotifier ), 
00060       iSocket( aSocket )
00061     {
00062     CActiveScheduler::Add(this);
00063     }


Member Function Documentation

CSIPExSocketReader * CSIPExSocketReader::NewL (  RSocket &  aSocket,
MSIPExReaderNotifier &  aNotifier
)  [static]
 

NewL Static constructor

Parameters:
aSocket The reference to the socket
aNotifier The reference to the reader notifier

Definition at line 26 of file SIPExSocketReader.cpp.

References NewLC().

00029     {
00030     CSIPExSocketReader* self = NewLC( aSocket, aNotifier );
00031     CleanupStack::Pop(self);
00032     return self;
00033     }

CSIPExSocketReader * CSIPExSocketReader::NewLC (  RSocket &  aSocket,
MSIPExReaderNotifier &  aNotifier
)  [static]
 

NewLC Static constructor. On return the instance is left to the CleanupStack.

Parameters:
aSocket The reference to the socket
aNotifier The reference to the reader notifier

Definition at line 40 of file SIPExSocketReader.cpp.

References CSIPExSocketReader().

00043     {
00044     CSIPExSocketReader* self = new (ELeave) CSIPExSocketReader( aSocket, aNotifier );
00045     CleanupStack::PushL(self);
00046     self->ConstructL();
00047     return self;
00048     }

void CSIPExSocketReader::Read (   ) 
 

Read Asynchronous function. Starts the asynchronous reading.

Definition at line 127 of file SIPExSocketReader.cpp.

00128     {
00129     if( !IsActive() )
00130         {
00131         iSocket.Read( iBuffer, iStatus );
00132         SetActive();
00133         }
00134     }

void CSIPExSocketReader::DoCancel (   )  [protected]
 

From CActive

Definition at line 89 of file SIPExSocketReader.cpp.

References iSocket.

00090     {
00091     iSocket.CancelRead();
00092     }

void CSIPExSocketReader::RunL (   )  [protected]
 

From CActive

Definition at line 100 of file SIPExSocketReader.cpp.

References iBuffer, iMessage, iNotifier, and MSIPExReaderNotifier::MessageReceived().

00101     {
00102     if( iStatus.Int() == KErrNone )
00103         {
00104         iMessage.Append( iBuffer );
00105         iBuffer.Zero();
00106         if( iMessage.Length() == 4 )
00107             {
00108             iNotifier.MessageReceived( iMessage );
00109             iMessage.Zero();
00110             }
00111         Read();
00112         }
00113     else
00114         {
00115         iMessage.FillZ();
00116         iMessage.Zero();
00117         iNotifier.ErrorInReading( iStatus.Int() );
00118         }
00119     }

void CSIPExSocketReader::ConstructL (   )  [private]
 

ConstructL Symbian 2nd phase constructor that might leave

Definition at line 80 of file SIPExSocketReader.cpp.

00081     {
00082     }


© Nokia 2006

Back to top