os/mm/devsoundextensions/telephonyaudiorouting/Server/inc/TelephonyAudioRoutingServerSession.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsoundextensions/telephonyaudiorouting/Server/inc/TelephonyAudioRoutingServerSession.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,227 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:   Server-side session implementation
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +#ifndef TELEPHONYAUDIOROUTINGSERVERSESSION_H
    1.24 +#define TELEPHONYAUDIOROUTINGSERVERSESSION_H
    1.25 +
    1.26 +#include "TelephonyAudioRoutingServer.h"
    1.27 +#include "TelephonyAudioRoutingClientServer.h"
    1.28 +#include "TelephonyAudioRouting.h"
    1.29 +
    1.30 +class CTelephonyAudioRoutingServer;
    1.31 +
    1.32 +/**
    1.33 +*  Server-side session implementation
    1.34 +*  
    1.35 +*
    1.36 +*  @lib TelephonyAudioRoutingServer.lib
    1.37 +*  @since Series 60 3.1
    1.38 +*/
    1.39 +class CTelephonyAudioRoutingServerSession : public CSession2
    1.40 +	{
    1.41 +		
    1.42 +	public:
    1.43 +	
    1.44 +		/**
    1.45 +        * C++ default constructor.
    1.46 +        */
    1.47 +		CTelephonyAudioRoutingServerSession(TInt aSessionId);
    1.48 +		
    1.49 +		/**
    1.50 +        * Returns the session ID.
    1.51 +        * @since Series 60 3.1
    1.52 +        * @return sessionId
    1.53 +        */
    1.54 +		TInt SessionId();
    1.55 +		
    1.56 +		/**
    1.57 +        * Notifies the client-side session that the SetOutput request is complete.
    1.58 +        * @since Series 60 3.1
    1.59 +        * @param aOutput: client obj, aError: Error code of operation, aShowNote: for show note display
    1.60 +        * @return void
    1.61 +        */
    1.62 +		void SetOutputComplete(CTelephonyAudioRouting::TAudioOutput aOutput, TInt aError, TBool aShowNote);
    1.63 +		
    1.64 +		/**
    1.65 +        * Notifies the client-side session that available audio outputs have changed.
    1.66 +        * @since Series 60 3.1
    1.67 +        * @param aOutputs: array of available outputs
    1.68 +        * @return void
    1.69 +        */
    1.70 +		void AvailableOutputsChanged( const TArray<CTelephonyAudioRouting::TAudioOutput>& aOutputs);
    1.71 +		
    1.72 +		/**
    1.73 +        * Notifies the client-side session that the current audio output has changed.
    1.74 +        * @since Series 60 3.1
    1.75 +        * @param aMessage: server side message containing output info
    1.76 +        * @return void
    1.77 +        */
    1.78 +		void OutputChangedL(const RMessage2& aMessage);
    1.79 +		
    1.80 +		/**
    1.81 +        * After output has been changed, this method notifies all other clients
    1.82 +        * @since Series 60 3.1
    1.83 +        * @params aOutput: client obj, TBool aShowNote
    1.84 +        * @return void
    1.85 +        */
    1.86 +		void OutputChanged(CTelephonyAudioRouting::TAudioOutput aOutput, TBool aShowNote);		
    1.87 +		
    1.88 +		/**
    1.89 +        * Notification that user has requested to change the audio output.
    1.90 +        * @since Series 60 3.1
    1.91 +        * @param aOutput: client obj
    1.92 +        * @return void
    1.93 +        */
    1.94 +		void OutputChangeRequested(CTelephonyAudioRouting::TAudioOutput aOutput);
    1.95 +
    1.96 + 	private:
    1.97 +
    1.98 +		~CTelephonyAudioRoutingServerSession();
    1.99 +		
   1.100 +		/**
   1.101 +        * Provides ref to server
   1.102 +        * @since Series 60 3.1
   1.103 +        * @param void
   1.104 +        * @return ref to CTelephonyAudioRoutingServer
   1.105 +        */
   1.106 +		inline CTelephonyAudioRoutingServer& Server();
   1.107 +		
   1.108 +		/**
   1.109 +        * From CSession2
   1.110 +        * Handles the servicing of a client request that has been passed to the server.
   1.111 +        */
   1.112 +		void ServiceL(const RMessage2& aMessage);
   1.113 +		
   1.114 +		/**
   1.115 +        * Handles an error from ServiceL()
   1.116 +        * @since Series 60 3.1
   1.117 +        * @param aMessage: server side message, aError: error code
   1.118 +        * @return void
   1.119 +        */
   1.120 +		void ServiceError(const RMessage2& aMessage,TInt aError);
   1.121 +		
   1.122 +		/**
   1.123 +        * Send a request to audio policy to set audio output.
   1.124 +        * @since Series 60 3.1
   1.125 +        * @param aMessage: server side message for policy
   1.126 +        * @return void
   1.127 +        */
   1.128 +		void DoSetOutputL (const RMessage2& aMessage);
   1.129 +		
   1.130 +		/**
   1.131 +        * Returns the number of available outputs to client-side session.
   1.132 +        * @since Series 60 3.1
   1.133 +        * @param aMessage: server side message
   1.134 +        * @return void
   1.135 +        */
   1.136 +		void GetNoOfAvailableOutputs (const RMessage2& aMessage);
   1.137 +		
   1.138 +		/**
   1.139 +        * Returns the available audio outputs to client-side session.
   1.140 +        * @since Series 60 3.1
   1.141 +        * @param aMessage: server side message
   1.142 +        * @return void
   1.143 +        */
   1.144 +		void GetAvailableOutputsL (const RMessage2& aMessage);
   1.145 +		
   1.146 +		/**
   1.147 +        * Add a message to message queue. Complete the message when output changes.
   1.148 +        * @since Series 60 3.1
   1.149 +        * @param aMessage: server side message
   1.150 +        * @return void
   1.151 +        */
   1.152 +		void NotifyIfOutputChangedL (const RMessage2& aMessage);
   1.153 +		
   1.154 +		/**
   1.155 +        * Add a message to message queue. Complete the message when available audio 
   1.156 +		* outputs change.
   1.157 +        * @since Series 60 3.1
   1.158 +        * @param aMessage: server side message
   1.159 +        * @return void
   1.160 +        */
   1.161 +		void NotifyIfAvailOutputsChangedL (const RMessage2& aMessage);
   1.162 +		
   1.163 +		/**
   1.164 +        * Used by policy session to listen to any SetOutput request from other sessions.
   1.165 +        * @since Series 60 3.1
   1.166 +        * @param aMessage: server side message
   1.167 +        * @return void
   1.168 +        */
   1.169 +		void MonitorOutputChangeL (const RMessage2& aMessage);
   1.170 +		
   1.171 +		/**
   1.172 +        * Set the policy session Id.
   1.173 +        * @since Series 60 3.1
   1.174 +        * @param aMessage: server side message
   1.175 +        * @return void
   1.176 +        */
   1.177 +		void SetPolicySessionId(const RMessage2& aMessage);
   1.178 +		
   1.179 +		/**
   1.180 +        * Used by policy session to indicate that the SetOutput request is complete.
   1.181 +        * @since Series 60 3.1
   1.182 +        * @param aMessage: server side message
   1.183 +        * @return void
   1.184 +        */
   1.185 +		void OutputChangeCompleteL(const RMessage2& aMessage);
   1.186 +		
   1.187 +		/**
   1.188 +        * Notify the client-side session that available outputs have changed.
   1.189 +        * @since Series 60 3.1
   1.190 +        * @param aMessage: server side message
   1.191 +        * @return void
   1.192 +        */
   1.193 +		void DoAvailableOutputsChangedL (const RMessage2& aMessage);
   1.194 +		
   1.195 +		/**
   1.196 +        * Cancel the outstanding request.
   1.197 +        * @since Series 60 3.1
   1.198 +        * @param aMessage: server side message
   1.199 +        * @return void
   1.200 +        */
   1.201 +		void CancelRequestL(const RMessage2& aMessage);
   1.202 +		
   1.203 +		/**
   1.204 +        * Session initialization.
   1.205 +        * @since Series 60 3.1
   1.206 +        * @param aMessage: server side message
   1.207 +        * @return void
   1.208 +        */
   1.209 +		void InitializeL(const RMessage2& aMessage);
   1.210 +		
   1.211 +		/**
   1.212 +        * Gets default values form server for the client
   1.213 +        * @since Series 60 3.1
   1.214 +        * @param aMessage: server side message
   1.215 +        * @return void
   1.216 +        */
   1.217 +		void GetDefaultValuesL(const RMessage2& aMessage);	
   1.218 +
   1.219 +	private:
   1.220 +	
   1.221 +		const TInt iSessionId;
   1.222 +		RArray<RMessage2> iMessageArray;
   1.223 +   		RArray<CTelephonyAudioRouting::TAudioOutput> iSessionAvailableOutputs;		
   1.224 +  		TBool iPolicyFlag;
   1.225 +  		TBool iConnected;
   1.226 +  		
   1.227 +  	
   1.228 +  	};
   1.229 +	
   1.230 +#endif 		// TELEPHONYAUDIOROUTINGSERVERSESSION_H