sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef MMRCSERVERSESSION_H__ sl@0: #define MMRCSERVERSESSION_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "mmrcclientserver.h" sl@0: sl@0: /** sl@0: * @file sl@0: * @internalTechnology sl@0: */ sl@0: sl@0: class MMultimediaResourceControlObserver; sl@0: class MLogicalChain; sl@0: class CFourCCConvertor; sl@0: class MAudioContext; sl@0: class CMMRCServerController; sl@0: class CMMRCServerSession; sl@0: class CMMRCClientSideServerRequestToAdaptationAO; sl@0: class CMMRCServerSideAdaptationResponseAO; sl@0: class CAudioContext; sl@0: sl@0: enum TMMRCServerSessionRequestType sl@0: { sl@0: ENormalRequest, sl@0: EPreemptionRequest, sl@0: }; sl@0: sl@0: /** sl@0: Panic category and codes that MMRCServerSession raises on the client sl@0: */ sl@0: _LIT(KMMRCServerSessionPanicCategory, "MMRCServerSession"); sl@0: sl@0: enum TMMRCServerSessionPanicCodes sl@0: { sl@0: ECloneLeftWhenSendingResponseToClient =1, sl@0: EMsgQueueFailedToSendMsg sl@0: }; sl@0: sl@0: /** sl@0: @internalComponent sl@0: This class implements the MMRC Server Session. sl@0: */ sl@0: NONSHARABLE_CLASS(CMMRCServerSession) : public CSession2 sl@0: { sl@0: //friend class CTimeoutClientAcknowledment; sl@0: public: sl@0: /** sl@0: * Constructs, and returns a pointer to, a new CMMRCServerSession object. sl@0: * Leaves on failure. sl@0: * @param CMMRCServerController& A reference on the MMRC Server controller sl@0: * @param CFourCCConvertor& A reference to the Fourcc to format converter sl@0: * @return CMMRCServerSession* A pointer to newly created utlitly object. sl@0: */ sl@0: static CMMRCServerSession* NewL(CMMRCServerController& aMMRCServerController, sl@0: const CFourCCConvertor& aFourCCConvertor); sl@0: sl@0: /** sl@0: * Constructs, leaves object on the cleanup stack, and returns a pointer sl@0: * to, a new CMMRCServerSession object. sl@0: * Leaves on failure. sl@0: * @param CMMRCServerController& A reference on the MMRC Server controller sl@0: * @param CFourCCConvertor& A reference to the Fourcc to format converter sl@0: * @return CMMRCServerSession* A pointer to newly created utlitly object. sl@0: */ sl@0: static CMMRCServerSession* NewLC(CMMRCServerController& aMMRCServerController, sl@0: const CFourCCConvertor& aFourCCConvertor); sl@0: sl@0: /** sl@0: * Destructor. sl@0: */ sl@0: ~CMMRCServerSession(); sl@0: sl@0: sl@0: /** sl@0: * from CSession2 sl@0: * @param aMessage - Function and data for the session sl@0: */ sl@0: void ServiceL(const RMessage2& aMessage); sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: void StartProcessL(); sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: void StartPreemptionL(); sl@0: sl@0: /** sl@0: * Callback on a resource request sl@0: * @param TMMRCServerToClientMessageResults aResult the result on the request sl@0: * @leave sl@0: */ sl@0: void AdaptationRequestAcknowledgment(TMMRCAdaptationToServerRequestResults aResult, TInt aError); sl@0: sl@0: /** sl@0: * Notify all the paused client that a resource has been unallocated sl@0: */ sl@0: void NotifyClientResourceUnallocated(); sl@0: sl@0: /** sl@0: * return the current committed chain (const) sl@0: * @return the current committed chain sl@0: */ sl@0: const MLogicalChain* LogicalChainRequested() const; sl@0: sl@0: /** sl@0: * return the current committed chain (const) sl@0: * @return the current committed chain sl@0: */ sl@0: const MLogicalChain* LogicalChainRequestedStack() const; sl@0: sl@0: /** sl@0: * return the last committed chain (const) sl@0: * @return the last committed chain sl@0: */ sl@0: const MLogicalChain* LogicalChainLastCommited() const; sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: const MAudioContext* AudioContext() const; sl@0: sl@0: /** sl@0: * return the current committed chain sl@0: * @return the current committed chain sl@0: */ sl@0: MLogicalChain* LogicalChainRequested(); sl@0: sl@0: /** sl@0: * return the current committed chain sl@0: * @return the current committed chain sl@0: */ sl@0: MLogicalChain* LogicalChainRequestedStack(); sl@0: sl@0: /** sl@0: * return the last committed chain sl@0: * @return the last committed chain sl@0: */ sl@0: MLogicalChain* LogicalChainLastCommited(); sl@0: sl@0: /** sl@0: * sl@0: */ sl@0: CMMRCClientSideServerRequestToAdaptationAO* AdaptationProxy(); sl@0: sl@0: sl@0: CMMRCServerSideAdaptationResponseAO* ServerProxy(); sl@0: /** sl@0: * sl@0: */ sl@0: TUint64 ContextId(); sl@0: sl@0: /** sl@0: * sl@0: */ sl@0: TBool HasMultimediaCapability() const; sl@0: sl@0: /** sl@0: * sl@0: */ sl@0: void Clean(); sl@0: sl@0: /** sl@0: * sl@0: */ sl@0: TBool IsServerShuttingDown(); sl@0: sl@0: TInt RequestsSent(); sl@0: sl@0: TInt SendRequestToAdaptation(TMMRCServerSessionRequestType aRequestType); sl@0: sl@0: TInt GetPriority() const; sl@0: sl@0: /** sl@0: * sl@0: */ sl@0: TBool HasUserEnvironmentCapability(); sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: TInt NotifyClientOfError(TInt aError); sl@0: sl@0: protected: sl@0: sl@0: void IncrementRequestsSent(); sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: void Disconnect(const RMessage2& aMessage); sl@0: sl@0: private: sl@0: sl@0: //Constructor sl@0: /** sl@0: * By default Symbian 2nd phase constructor is private. sl@0: * @param CMMRCServerController& A reference on the MMRC Server controller sl@0: * @param CFourCCConvertor& A reference to the Fourcc to format converter sl@0: */ sl@0: CMMRCServerSession(CMMRCServerController& aMMRCServerController, sl@0: const CFourCCConvertor& aFourCCConvertor); sl@0: sl@0: /** sl@0: * By default Symbian 2nd phase constructor is private. sl@0: */ sl@0: void ConstructL(); sl@0: sl@0: /** sl@0: * Dispatch the message received from ServeL sl@0: * EMMRCClientToServerSetMsgQueueHandle - Initialise the queue handler sl@0: * EMMRCClientToServerMessage - Process a message from the client sl@0: * EMMRCClientToServerMessageUpdate - Process a message update from the client sl@0: * EMMRCClientToServerMessageAcknowledgement - Process the acknowldgement from the client sl@0: * @param aMessage - Function and data for the session sl@0: * @return error code sl@0: * @leave in case of writeL leave or request leave sl@0: */ sl@0: TInt DispatchMessageL(const RMessage2& aMessage); sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: TInt EnqueueRequestL(const RMessage2& aMessage); sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: void PreProcessRequestL(const RMessage2& aMessage); sl@0: sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: void ProcessResourceDataRequestL(const RMessage2& aMessage); sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: void SendRequestResponseToClient(TMMRCQueueItem& messageItem); sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: void SendPreemptionNotificationToClient(TMMRCQueueItem& messageItem); sl@0: sl@0: sl@0: /* sl@0: * sl@0: */ sl@0: void Panic(TMMRCServerSessionPanicCodes aCode); sl@0: sl@0: private: sl@0: RMsgQueue iMsgQueue; // sl@0: CMMRCServerController& iMMRCServerController; // a reference on the MMRC Server controller sl@0: //RThread iClientThread; sl@0: RThread iServerThread; sl@0: RThread iClientThread; sl@0: TBool iShutdown; sl@0: //owned sl@0: CMMRCServerSideAdaptationResponseAO* iMMRCServerSideAdaptationResponseAO; sl@0: MLogicalChain* iLogicalChainRequestedStack; // the new committed chain sl@0: MLogicalChain* iLogicalChainLastCommitedStack; // the last committed sl@0: MLogicalChain* iLogicalChainRequested; // the new committed chain sl@0: MLogicalChain* iLogicalChainLastCommited; // the last committed sl@0: MLogicalChain* iLogicalChainRequestResponse; // A copy of the chain for client response sl@0: MLogicalChain* iLogicalChainPreemptionNotification; // A copy of the chain for preemption notification to the client sl@0: sl@0: //not owned (can be null pointers) sl@0: CAudioContext* iAudioContext; sl@0: const CFourCCConvertor* iFourCCConvertor; sl@0: CMMRCClientSideServerRequestToAdaptationAO* iMMRCClientSideServerRequestToAdaptationAO; sl@0: sl@0: //not own sl@0: TInt32 iContextId; sl@0: TInt32 iRequestsSent; sl@0: TBool iClientHasMMCapability; sl@0: TBool iClientHasUECapability; sl@0: }; sl@0: sl@0: #endif //__MMRCSERVERSESSION_H__