Nokia N97 SDK
Example Applications Guide

CChatBase Class Reference

#include <ChatBase.h>

Inheritance diagram for CChatBase:

CChatBt CChatInet List of all members.

Detailed Description

CChatBase Connects and sends messages to a remote machine using bluetooth

Definition at line 58 of file ChatBase.h.


Public Member Functions

  CChatBase (MLog &aLog)
virtual  ~CChatBase ()
void  SetServer (TBool aServerMode)
TBool  Server ()
void  SetState (TChatState aState)
TInt  State ()
TBool  IsConnected ()
TBool  IsConnecting ()
TBool  IsSendingMessage ()
TBool  IsReadyToSendMessage ()

Static Public Member Functions

static CChatBase *  NewL (MLog &aLog)
static CChatBase *  NewLC (MLog &aLog)

Protected Member Functions

void  DoCancel ()
void  RunL ()

Private Member Functions

void  ConstructL ()

Private Attributes

TChatState  iState
MLog &  iLog
TBool  iServerMode


Constructor & Destructor Documentation

CChatBase::CChatBase (  MLog &  aLog  ) 
 

CChatBase() Constructs this object

Parameters:
aLog  the log to send output to

Definition at line 66 of file ChatBase.cpp.

Referenced by NewLC().

00067     : CActive( CActive::EPriorityStandard ),
00068     iState( EWaitingToGetDevice ),
00069     iLog( aLog ),
00070     iServerMode( EFalse )
00071     {
00072     CActiveScheduler::Add( this );
00073     }

CChatBase::~CChatBase (   )  [virtual]
 

~CChatBase() Destroy the object and release all memory objects. Close any open sockets.

Definition at line 80 of file ChatBase.cpp.

00081     {
00082   
00083     }


Member Function Documentation

CChatBase * CChatBase::NewL (  MLog &  aLog  )  [static]
 

NewL() Construct a CChatClient

Parameters:
aLog  the log to send output to
Returns:
a pointer to the created instance of CChatClient

Reimplemented in CChatBt, and CChatInet.

Definition at line 31 of file ChatBase.cpp.

References NewLC().

00032     {
00033     CChatBase* self = NewLC( aLog );
00034     CleanupStack::Pop( self );
00035     return self;
00036     }

CChatBase * CChatBase::NewLC (  MLog &  aLog  )  [static]
 

NewLC() Construct a CChatClient

Parameters:
aLog  the log to send output to
Returns:
a pointer to the created instance of CChatClient

Reimplemented in CChatBt, and CChatInet.

Definition at line 43 of file ChatBase.cpp.

References CChatBase().

Referenced by NewL().

00044     {
00045     CChatBase* self = new ( ELeave ) CChatBase( aLog );
00046     CleanupStack::PushL( self );
00047     self->ConstructL ();
00048     return self;
00049     }

void CChatBase::SetServer (  TBool  aServerMode  ) 
 

SetServer() Set servermode

Parameters:
aServerMode  ETrue if servermode is used

Definition at line 120 of file ChatBase.cpp.

References iServerMode.

Referenced by CChatInet::StartL(), and CChatBt::StartL().

00121     {
00122     iServerMode = aServerMode;
00123     }          

TBool CChatBase::Server (   ) 
 

Server() Get Servermode

Returns:
servermode

Definition at line 110 of file ChatBase.cpp.

References iServerMode.

Referenced by CChatAppUi::DynInitMenuPaneL(), and CChatAppUi::HandleCommandL().

00111     {
00112     return iServerMode;
00113     }    

void CChatBase::SetState (  TChatState  aState  ) 
 

SetState() Set state

Parameters:
aState  the state of the engine

Definition at line 130 of file ChatBase.cpp.

References iState.

Referenced by CChatBt::CChatBt(), CChatInet::CChatInet(), CChatInet::ConnectL(), CChatBt::ConnectL(), CChatInet::ConnectToServerL(), CChatInet::DisconnectL(), CChatBt::DisconnectL(), CChatInet::DoCancel(), CChatInet::RunL(), CChatBt::RunL(), CChatInet::SendMessageL(), CChatBt::SendMessageL(), CChatBt::SetSecurityWithChannelL(), CChatInet::StartL(), and CChatInet::Stop().

00131   {
00132   iState = aState;
00133   }

TInt CChatBase::State (   ) 
 

State() Get State

Returns:
state

Definition at line 140 of file ChatBase.cpp.

References iState.

Referenced by CChatInet::ConnectL(), CChatBt::ConnectL(), CChatInet::DisconnectL(), CChatBt::DisconnectL(), CChatInet::DoCancel(), IsConnected(), IsConnecting(), IsReadyToSendMessage(), IsSendingMessage(), CChatInet::RunL(), CChatBt::RunL(), CChatInet::SendMessageL(), CChatBt::SendMessageL(), CChatInet::StartL(), CChatBt::StartL(), CChatInet::Stop(), CChatBt::StopL(), CChatBt::~CChatBt(), and CChatInet::~CChatInet().

00141   {
00142   return iState;
00143   }

TBool CChatBase::IsConnected (   ) 
 

IsConnected()

Returns:
ETrue if the client is fully connected to the server.

Definition at line 160 of file ChatBase.cpp.

References State().

Referenced by CChatAppUi::DynInitMenuPaneL(), and CChatAppUi::HandleCommandL().

00161     {
00162     return ( ( State() == EConnected )||( State() == ESendingMessage ) );
00163     }

TBool CChatBase::IsConnecting (   ) 
 

IsConnecting()

Returns:
ETrue if the client is establishing a connection to the server.

Definition at line 171 of file ChatBase.cpp.

References State().

Referenced by CChatAppUi::DynInitMenuPaneL(), and CChatAppUi::HandleCommandL().

00172     {
00173     return ( ( State() == EGettingDevice )
00174         ||
00175         ( State() == EGettingService )
00176         ||
00177         ( State() == EGettingConnection )
00178         || 
00179         ( State() == EConnecting )  
00180         );
00181     }

TBool CChatBase::IsSendingMessage (   ) 
 

IsConnected()

Returns:
ETrue if the client is connected.

Definition at line 188 of file ChatBase.cpp.

References State().

00189     {
00190     return ( State() == ESendingMessage );
00191     }

TBool CChatBase::IsReadyToSendMessage (   ) 
 

IsReadyToSendMessage()

Returns:
ETrue if the client can send a message.

Definition at line 150 of file ChatBase.cpp.

References State().

Referenced by CChatAppUi::DynInitMenuPaneL().

00151     {
00152     return ( State() == EConnected );
00153     }

void CChatBase::DoCancel (   )  [protected]
 

DoCancel() Cancel any outstanding requests

Reimplemented in CChatBt, and CChatInet.

Definition at line 90 of file ChatBase.cpp.

00091     {
00092     // no implementation required
00093     }

void CChatBase::RunL (   )  [protected]
 

RunL() Respond to an event

Reimplemented in CChatBt, and CChatInet.

Definition at line 100 of file ChatBase.cpp.

00101     {
00102     // no implementation required
00103     }

void CChatBase::ConstructL (   )  [private]
 

ConstructL() Performs second phase construction of this object

Reimplemented in CChatBt, and CChatInet.

Definition at line 56 of file ChatBase.cpp.

00057     {
00058     // no implementation required
00059     }


Member Data Documentation

TChatState CChatBase::iState [private]
 

iState the current state of the client

Definition at line 178 of file ChatBase.h.

Referenced by SetState(), and State().

MLog& CChatBase::iLog [private]
 

iLog the log to send output to

Reimplemented in CChatBt, and CChatInet.

Definition at line 183 of file ChatBase.h.

TBool CChatBase::iServerMode [private]
 

iServerMode indicates server mode

Definition at line 188 of file ChatBase.h.

Referenced by Server(), and SetServer().


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

© Nokia 2009

Back to top