CUpnpSymbianServerBase Class Reference

class CUpnpSymbianServerBase : public CServer2
Base class for all symbian server classes used in upnp stack project This implementation provides:
  • proper server starting,

  • 2 seconds stoping timeout,

  • stopping server if ( no connected clients && CanBeStopped() ) CanBeStopped() SuggestShutdown()

  • session connection version checking,

  • basic panics utility functions,

  • basic errors handling Note that it should be used with client part implementation that use RUpnpSessionBase class.

upnpipserversutils

Inherits from

Public Member Functions
~CUpnpSymbianServerBase()
IMPORT_C voidPanicClient(const RMessage2 &, TInt)
IMPORT_C TIntStartServer(const TDesC &, TServerFactoryMethodLC)
Protected Member Functions
CUpnpSymbianServerBase()
IMPORT_C voidBaseConstructL()
IMPORT_C CSession2 *NewSessionL(const TVersion &, const RMessage2 &)
IMPORT_C voidPanicServer(TInt)
IMPORT_C TIntRunError(TInt)
IMPORT_C voidRunL()
IMPORT_C voidSuggestShutdown()
IMPORT_C voidTimerEventL(CUpnpNotifyTimer *)
Private Member Functions
IMPORT_C TBoolCanBeStopped()
voidDecrementSessionCount()
voidIncrementSessionCount()
CSession2 *NewSessionL(const RMessage2 &)
const TDesC &ServerName()
voidStartServerL(const TDesC &, TServerFactoryMethodLC)
TVersion SupportedVersion()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CServer2::CServer2(TInt,TServerType)
CServer2::DoCancel()
CServer2::DoConnect(const RMessage2 &)
CServer2::Extension_(TUint,TAny *&,TAny *)
CServer2::Message()const
CServer2::ReStart()
CServer2::Server()const
CServer2::SetMaster(const CServer2 *)
CServer2::SetPinClientDescriptors(TBool)
CServer2::Start(const TDesC &)
CServer2::StartL(const TDesC &)
CServer2::~CServer2()
Public Member Enumerations
enumTUpnpSymbianServerPanics { ECreateTrapCleanup, EBadRequest, EBadDescriptor, EFirstUnusedPanicNumber }
Inherited Enumerations
CActive:TPriority
CServer2:TPanic
CServer2:TServerType
Private Attributes
TInt iSessionCount
CUpnpNotifyTimer *iShutdownTimer
Inherited Attributes
CActive::iStatus
CServer2::iSessionIter

Constructor & Destructor Documentation

CUpnpSymbianServerBase()

IMPORT_CCUpnpSymbianServerBase()[protected]

Constructor.

~CUpnpSymbianServerBase()

IMPORT_C~CUpnpSymbianServerBase()

Destructor

Member Functions Documentation

BaseConstructL()

IMPORT_C voidBaseConstructL()[protected]

Second phase base constructor. It must be called by derived class.

CanBeStopped()

IMPORT_C TBoolCanBeStopped()const [private, virtual]

Derived classes can implement in the method additional condidions of stopping server process that will be checked in SuggestShutdown method and befor actual server stopping. Default implementation provides no additional condidions.

DecrementSessionCount()

voidDecrementSessionCount()[private]

Decrement the count of the active sessions for this server.

IncrementSessionCount()

voidIncrementSessionCount()[private]

Increment the count of the active sessions for this server.

NewSessionL(const RMessage2 &)

CSession2 *NewSessionL(const RMessage2 &aMessage)const [private, pure virtual]

Returns new CSession2 object. This method don't have to bother about version checking as this is done by implementation of CUpnpSymbianServerBase::NewSessionL (const TVersion& aVersion, const RMessage2& aMessage) that is wrapping this method.

Parameters

const RMessage2 & aMessage

NewSessionL(const TVersion &, const RMessage2 &)

IMPORT_C CSession2 *NewSessionL(const TVersion &aVersion,
const RMessage2 &aMessage
)const [protected, virtual]

This method wraps pure virtual NewSessionL(const RMessage2&) and leaves with KErrNotSupported if aVersion is different from version provided by pure virtual SupportedVersion.

Parameters

const TVersion & aVersion
const RMessage2 & aMessage

PanicClient(const RMessage2 &, TInt)

IMPORT_C voidPanicClient(const RMessage2 &aMessage,
TIntaReason
)const

Panic the client.

Parameters

const RMessage2 & aMessagethe message channel to the client.
TInt aReasonthe reason code for the panic.

PanicServer(TInt)

IMPORT_C voidPanicServer(TIntaPanic)const [protected]

Panic the server.

Parameters

TInt aPanicthe panic code.

RunError(TInt)

IMPORT_C TIntRunError(TIntaError)[protected, virtual]

Process any errors.

Parameters

TInt aErrorthe leave code reported.

RunL()

IMPORT_C voidRunL()[protected, virtual]

Invoked by active object framework to handle ending events

ServerName()

const TDesC &ServerName()const [private, pure virtual]

Return name of a server.

StartServer(const TDesC &, TServerFactoryMethodLC)

IMPORT_C TIntStartServer(const TDesC &aThreadName,
TServerFactoryMethodLCaServerFactoryMethodLC
)[static]

Fully initialise thread, and start the server. Method is intended to be called from E32Main method without any earlier initialisation.

Parameters

const TDesC & aThreadNamename to which thread will be renamed.
TServerFactoryMethodLC aServerFactoryMethodLCtwo phase constructor of server object that leaves it on cleanup stack.

StartServerL(const TDesC &, TServerFactoryMethodLC)

voidStartServerL(const TDesC &aThreadName,
TServerFactoryMethodLCaServerFactoryMethodLC
)[private, static]

Internal method that initialises thread, and starts the server. Precondition is that cleanup stack is correctly initialised and method is called from within a TRAP.

Parameters

const TDesC & aThreadNamename to which thread will be renamed.
TServerFactoryMethodLC aServerFactoryMethodLCtwo phase constructor of server object that leaves it on cleanup stack.

SuggestShutdown()

IMPORT_C voidSuggestShutdown()[protected]

Method should be called when derived class wants to suggest closing of the media server. This method checks every stop condidion and starts closing server timeout if all of them are fulfilled.

SupportedVersion()

TVersion SupportedVersion()const [private, pure virtual]

Returns version that is supported by this server.

TimerEventL(CUpnpNotifyTimer *)

IMPORT_C voidTimerEventL(CUpnpNotifyTimer *aTimer)[protected, virtual]

Invoked by shutdown timer when event TimerEventL occured.

Parameters

CUpnpNotifyTimer * aTimer

Member Enumerations Documentation

Enum TUpnpSymbianServerPanics

Enumerators

ECreateTrapCleanup
EBadRequest
EBadDescriptor
EFirstUnusedPanicNumber

Member Data Documentation

TInt iSessionCount

TInt iSessionCount[private]

CUpnpNotifyTimer * iShutdownTimer

CUpnpNotifyTimer *iShutdownTimer[private]

shutdown timer