1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmresourcemgmt/mmresctrl/inc/mmrcserversession.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,301 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef MMRCSERVERSESSION_H__
1.20 +#define MMRCSERVERSESSION_H__
1.21 +
1.22 +#include <e32std.h>
1.23 +#include <e32base.h>
1.24 +#include <a3f/a3fbase.h>
1.25 +#include <e32msgqueue.h>
1.26 +#include "mmrcclientserver.h"
1.27 +
1.28 +/**
1.29 +* @file
1.30 +* @internalTechnology
1.31 +*/
1.32 +
1.33 +class MMultimediaResourceControlObserver;
1.34 +class MLogicalChain;
1.35 +class CFourCCConvertor;
1.36 +class MAudioContext;
1.37 +class CMMRCServerController;
1.38 +class CMMRCServerSession;
1.39 +class CMMRCClientSideServerRequestToAdaptationAO;
1.40 +class CMMRCServerSideAdaptationResponseAO;
1.41 +class CAudioContext;
1.42 +
1.43 +enum TMMRCServerSessionRequestType
1.44 + {
1.45 + ENormalRequest,
1.46 + EPreemptionRequest,
1.47 + };
1.48 +
1.49 +/**
1.50 +Panic category and codes that MMRCServerSession raises on the client
1.51 +*/
1.52 +_LIT(KMMRCServerSessionPanicCategory, "MMRCServerSession");
1.53 +
1.54 +enum TMMRCServerSessionPanicCodes
1.55 + {
1.56 + ECloneLeftWhenSendingResponseToClient =1,
1.57 + EMsgQueueFailedToSendMsg
1.58 + };
1.59 +
1.60 +/**
1.61 +@internalComponent
1.62 +This class implements the MMRC Server Session.
1.63 +*/
1.64 +NONSHARABLE_CLASS(CMMRCServerSession) : public CSession2
1.65 + {
1.66 + //friend class CTimeoutClientAcknowledment;
1.67 +public:
1.68 + /**
1.69 + * Constructs, and returns a pointer to, a new CMMRCServerSession object.
1.70 + * Leaves on failure.
1.71 + * @param CMMRCServerController& A reference on the MMRC Server controller
1.72 + * @param CFourCCConvertor& A reference to the Fourcc to format converter
1.73 + * @return CMMRCServerSession* A pointer to newly created utlitly object.
1.74 + */
1.75 + static CMMRCServerSession* NewL(CMMRCServerController& aMMRCServerController,
1.76 + const CFourCCConvertor& aFourCCConvertor);
1.77 +
1.78 + /**
1.79 + * Constructs, leaves object on the cleanup stack, and returns a pointer
1.80 + * to, a new CMMRCServerSession object.
1.81 + * Leaves on failure.
1.82 + * @param CMMRCServerController& A reference on the MMRC Server controller
1.83 + * @param CFourCCConvertor& A reference to the Fourcc to format converter
1.84 + * @return CMMRCServerSession* A pointer to newly created utlitly object.
1.85 + */
1.86 + static CMMRCServerSession* NewLC(CMMRCServerController& aMMRCServerController,
1.87 + const CFourCCConvertor& aFourCCConvertor);
1.88 +
1.89 + /**
1.90 + * Destructor.
1.91 + */
1.92 + ~CMMRCServerSession();
1.93 +
1.94 +
1.95 + /**
1.96 + * from CSession2
1.97 + * @param aMessage - Function and data for the session
1.98 + */
1.99 + void ServiceL(const RMessage2& aMessage);
1.100 +
1.101 + /*
1.102 + *
1.103 + */
1.104 + void StartProcessL();
1.105 +
1.106 + /*
1.107 + *
1.108 + */
1.109 + void StartPreemptionL();
1.110 +
1.111 + /**
1.112 + * Callback on a resource request
1.113 + * @param TMMRCServerToClientMessageResults aResult the result on the request
1.114 + * @leave
1.115 + */
1.116 + void AdaptationRequestAcknowledgment(TMMRCAdaptationToServerRequestResults aResult, TInt aError);
1.117 +
1.118 + /**
1.119 + * Notify all the paused client that a resource has been unallocated
1.120 + */
1.121 + void NotifyClientResourceUnallocated();
1.122 +
1.123 + /**
1.124 + * return the current committed chain (const)
1.125 + * @return the current committed chain
1.126 + */
1.127 + const MLogicalChain* LogicalChainRequested() const;
1.128 +
1.129 + /**
1.130 + * return the current committed chain (const)
1.131 + * @return the current committed chain
1.132 + */
1.133 + const MLogicalChain* LogicalChainRequestedStack() const;
1.134 +
1.135 + /**
1.136 + * return the last committed chain (const)
1.137 + * @return the last committed chain
1.138 + */
1.139 + const MLogicalChain* LogicalChainLastCommited() const;
1.140 +
1.141 + /*
1.142 + *
1.143 + */
1.144 + const MAudioContext* AudioContext() const;
1.145 +
1.146 + /**
1.147 + * return the current committed chain
1.148 + * @return the current committed chain
1.149 + */
1.150 + MLogicalChain* LogicalChainRequested();
1.151 +
1.152 + /**
1.153 + * return the current committed chain
1.154 + * @return the current committed chain
1.155 + */
1.156 + MLogicalChain* LogicalChainRequestedStack();
1.157 +
1.158 + /**
1.159 + * return the last committed chain
1.160 + * @return the last committed chain
1.161 + */
1.162 + MLogicalChain* LogicalChainLastCommited();
1.163 +
1.164 + /**
1.165 + *
1.166 + */
1.167 + CMMRCClientSideServerRequestToAdaptationAO* AdaptationProxy();
1.168 +
1.169 +
1.170 + CMMRCServerSideAdaptationResponseAO* ServerProxy();
1.171 + /**
1.172 + *
1.173 + */
1.174 + TUint64 ContextId();
1.175 +
1.176 + /**
1.177 + *
1.178 + */
1.179 + TBool HasMultimediaCapability() const;
1.180 +
1.181 + /**
1.182 + *
1.183 + */
1.184 + void Clean();
1.185 +
1.186 + /**
1.187 + *
1.188 + */
1.189 + TBool IsServerShuttingDown();
1.190 +
1.191 + TInt RequestsSent();
1.192 +
1.193 + TInt SendRequestToAdaptation(TMMRCServerSessionRequestType aRequestType);
1.194 +
1.195 + TInt GetPriority() const;
1.196 +
1.197 + /**
1.198 + *
1.199 + */
1.200 + TBool HasUserEnvironmentCapability();
1.201 +
1.202 + /*
1.203 + *
1.204 + */
1.205 + TInt NotifyClientOfError(TInt aError);
1.206 +
1.207 +protected:
1.208 +
1.209 + void IncrementRequestsSent();
1.210 +
1.211 + /*
1.212 + *
1.213 + */
1.214 + void Disconnect(const RMessage2& aMessage);
1.215 +
1.216 +private:
1.217 +
1.218 + //Constructor
1.219 + /**
1.220 + * By default Symbian 2nd phase constructor is private.
1.221 + * @param CMMRCServerController& A reference on the MMRC Server controller
1.222 + * @param CFourCCConvertor& A reference to the Fourcc to format converter
1.223 + */
1.224 + CMMRCServerSession(CMMRCServerController& aMMRCServerController,
1.225 + const CFourCCConvertor& aFourCCConvertor);
1.226 +
1.227 + /**
1.228 + * By default Symbian 2nd phase constructor is private.
1.229 + */
1.230 + void ConstructL();
1.231 +
1.232 + /**
1.233 + * Dispatch the message received from ServeL
1.234 + * EMMRCClientToServerSetMsgQueueHandle - Initialise the queue handler
1.235 + * EMMRCClientToServerMessage - Process a message from the client
1.236 + * EMMRCClientToServerMessageUpdate - Process a message update from the client
1.237 + * EMMRCClientToServerMessageAcknowledgement - Process the acknowldgement from the client
1.238 + * @param aMessage - Function and data for the session
1.239 + * @return error code
1.240 + * @leave in case of writeL leave or request leave
1.241 + */
1.242 + TInt DispatchMessageL(const RMessage2& aMessage);
1.243 +
1.244 + /*
1.245 + *
1.246 + */
1.247 + TInt EnqueueRequestL(const RMessage2& aMessage);
1.248 +
1.249 + /*
1.250 + *
1.251 + */
1.252 + void PreProcessRequestL(const RMessage2& aMessage);
1.253 +
1.254 +
1.255 + /*
1.256 + *
1.257 + */
1.258 + void ProcessResourceDataRequestL(const RMessage2& aMessage);
1.259 +
1.260 + /*
1.261 + *
1.262 + */
1.263 + void SendRequestResponseToClient(TMMRCQueueItem& messageItem);
1.264 +
1.265 + /*
1.266 + *
1.267 + */
1.268 + void SendPreemptionNotificationToClient(TMMRCQueueItem& messageItem);
1.269 +
1.270 +
1.271 + /*
1.272 + *
1.273 + */
1.274 + void Panic(TMMRCServerSessionPanicCodes aCode);
1.275 +
1.276 +private:
1.277 + RMsgQueue<TMMRCQueueItem> iMsgQueue; //
1.278 + CMMRCServerController& iMMRCServerController; // a reference on the MMRC Server controller
1.279 + //RThread iClientThread;
1.280 + RThread iServerThread;
1.281 + RThread iClientThread;
1.282 + TBool iShutdown;
1.283 + //owned
1.284 + CMMRCServerSideAdaptationResponseAO* iMMRCServerSideAdaptationResponseAO;
1.285 + MLogicalChain* iLogicalChainRequestedStack; // the new committed chain
1.286 + MLogicalChain* iLogicalChainLastCommitedStack; // the last committed
1.287 + MLogicalChain* iLogicalChainRequested; // the new committed chain
1.288 + MLogicalChain* iLogicalChainLastCommited; // the last committed
1.289 + MLogicalChain* iLogicalChainRequestResponse; // A copy of the chain for client response
1.290 + MLogicalChain* iLogicalChainPreemptionNotification; // A copy of the chain for preemption notification to the client
1.291 +
1.292 + //not owned (can be null pointers)
1.293 + CAudioContext* iAudioContext;
1.294 + const CFourCCConvertor* iFourCCConvertor;
1.295 + CMMRCClientSideServerRequestToAdaptationAO* iMMRCClientSideServerRequestToAdaptationAO;
1.296 +
1.297 + //not own
1.298 + TInt32 iContextId;
1.299 + TInt32 iRequestsSent;
1.300 + TBool iClientHasMMCapability;
1.301 + TBool iClientHasUECapability;
1.302 + };
1.303 +
1.304 +#endif //__MMRCSERVERSESSION_H__