devsoundextensions/telephonyaudiorouting/Server/inc/TelephonyAudioRoutingServerSession.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Server-side session implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef TELEPHONYAUDIOROUTINGSERVERSESSION_H
       
    21 #define TELEPHONYAUDIOROUTINGSERVERSESSION_H
       
    22 
       
    23 #include "TelephonyAudioRoutingServer.h"
       
    24 #include "TelephonyAudioRoutingClientServer.h"
       
    25 #include "TelephonyAudioRouting.h"
       
    26 
       
    27 class CTelephonyAudioRoutingServer;
       
    28 
       
    29 /**
       
    30 *  Server-side session implementation
       
    31 *  
       
    32 *
       
    33 *  @lib TelephonyAudioRoutingServer.lib
       
    34 *  @since Series 60 3.1
       
    35 */
       
    36 class CTelephonyAudioRoutingServerSession : public CSession2
       
    37 	{
       
    38 		
       
    39 	public:
       
    40 	
       
    41 		/**
       
    42         * C++ default constructor.
       
    43         */
       
    44 		CTelephonyAudioRoutingServerSession(TInt aSessionId);
       
    45 		
       
    46 		/**
       
    47         * Returns the session ID.
       
    48         * @since Series 60 3.1
       
    49         * @return sessionId
       
    50         */
       
    51 		TInt SessionId();
       
    52 		
       
    53 		/**
       
    54         * Notifies the client-side session that the SetOutput request is complete.
       
    55         * @since Series 60 3.1
       
    56         * @param aOutput: client obj, aError: Error code of operation, aShowNote: for show note display
       
    57         * @return void
       
    58         */
       
    59 		void SetOutputComplete(CTelephonyAudioRouting::TAudioOutput aOutput, TInt aError, TBool aShowNote);
       
    60 		
       
    61 		/**
       
    62         * Notifies the client-side session that available audio outputs have changed.
       
    63         * @since Series 60 3.1
       
    64         * @param aOutputs: array of available outputs
       
    65         * @return void
       
    66         */
       
    67 		void AvailableOutputsChanged( const TArray<CTelephonyAudioRouting::TAudioOutput>& aOutputs);
       
    68 		
       
    69 		/**
       
    70         * Notifies the client-side session that the current audio output has changed.
       
    71         * @since Series 60 3.1
       
    72         * @param aMessage: server side message containing output info
       
    73         * @return void
       
    74         */
       
    75 		void OutputChangedL(const RMessage2& aMessage);
       
    76 		
       
    77 		/**
       
    78         * After output has been changed, this method notifies all other clients
       
    79         * @since Series 60 3.1
       
    80         * @params aOutput: client obj, TBool aShowNote
       
    81         * @return void
       
    82         */
       
    83 		void OutputChanged(CTelephonyAudioRouting::TAudioOutput aOutput, TBool aShowNote);		
       
    84 		
       
    85 		/**
       
    86         * Notification that user has requested to change the audio output.
       
    87         * @since Series 60 3.1
       
    88         * @param aOutput: client obj
       
    89         * @return void
       
    90         */
       
    91 		void OutputChangeRequested(CTelephonyAudioRouting::TAudioOutput aOutput);
       
    92 
       
    93  	private:
       
    94 
       
    95 		~CTelephonyAudioRoutingServerSession();
       
    96 		
       
    97 		/**
       
    98         * Provides ref to server
       
    99         * @since Series 60 3.1
       
   100         * @param void
       
   101         * @return ref to CTelephonyAudioRoutingServer
       
   102         */
       
   103 		inline CTelephonyAudioRoutingServer& Server();
       
   104 		
       
   105 		/**
       
   106         * From CSession2
       
   107         * Handles the servicing of a client request that has been passed to the server.
       
   108         */
       
   109 		void ServiceL(const RMessage2& aMessage);
       
   110 		
       
   111 		/**
       
   112         * Handles an error from ServiceL()
       
   113         * @since Series 60 3.1
       
   114         * @param aMessage: server side message, aError: error code
       
   115         * @return void
       
   116         */
       
   117 		void ServiceError(const RMessage2& aMessage,TInt aError);
       
   118 		
       
   119 		/**
       
   120         * Send a request to audio policy to set audio output.
       
   121         * @since Series 60 3.1
       
   122         * @param aMessage: server side message for policy
       
   123         * @return void
       
   124         */
       
   125 		void DoSetOutputL (const RMessage2& aMessage);
       
   126 		
       
   127 		/**
       
   128         * Returns the number of available outputs to client-side session.
       
   129         * @since Series 60 3.1
       
   130         * @param aMessage: server side message
       
   131         * @return void
       
   132         */
       
   133 		void GetNoOfAvailableOutputs (const RMessage2& aMessage);
       
   134 		
       
   135 		/**
       
   136         * Returns the available audio outputs to client-side session.
       
   137         * @since Series 60 3.1
       
   138         * @param aMessage: server side message
       
   139         * @return void
       
   140         */
       
   141 		void GetAvailableOutputsL (const RMessage2& aMessage);
       
   142 		
       
   143 		/**
       
   144         * Add a message to message queue. Complete the message when output changes.
       
   145         * @since Series 60 3.1
       
   146         * @param aMessage: server side message
       
   147         * @return void
       
   148         */
       
   149 		void NotifyIfOutputChangedL (const RMessage2& aMessage);
       
   150 		
       
   151 		/**
       
   152         * Add a message to message queue. Complete the message when available audio 
       
   153 		* outputs change.
       
   154         * @since Series 60 3.1
       
   155         * @param aMessage: server side message
       
   156         * @return void
       
   157         */
       
   158 		void NotifyIfAvailOutputsChangedL (const RMessage2& aMessage);
       
   159 		
       
   160 		/**
       
   161         * Used by policy session to listen to any SetOutput request from other sessions.
       
   162         * @since Series 60 3.1
       
   163         * @param aMessage: server side message
       
   164         * @return void
       
   165         */
       
   166 		void MonitorOutputChangeL (const RMessage2& aMessage);
       
   167 		
       
   168 		/**
       
   169         * Set the policy session Id.
       
   170         * @since Series 60 3.1
       
   171         * @param aMessage: server side message
       
   172         * @return void
       
   173         */
       
   174 		void SetPolicySessionId(const RMessage2& aMessage);
       
   175 		
       
   176 		/**
       
   177         * Used by policy session to indicate that the SetOutput request is complete.
       
   178         * @since Series 60 3.1
       
   179         * @param aMessage: server side message
       
   180         * @return void
       
   181         */
       
   182 		void OutputChangeCompleteL(const RMessage2& aMessage);
       
   183 		
       
   184 		/**
       
   185         * Notify the client-side session that available outputs have changed.
       
   186         * @since Series 60 3.1
       
   187         * @param aMessage: server side message
       
   188         * @return void
       
   189         */
       
   190 		void DoAvailableOutputsChangedL (const RMessage2& aMessage);
       
   191 		
       
   192 		/**
       
   193         * Cancel the outstanding request.
       
   194         * @since Series 60 3.1
       
   195         * @param aMessage: server side message
       
   196         * @return void
       
   197         */
       
   198 		void CancelRequestL(const RMessage2& aMessage);
       
   199 		
       
   200 		/**
       
   201         * Session initialization.
       
   202         * @since Series 60 3.1
       
   203         * @param aMessage: server side message
       
   204         * @return void
       
   205         */
       
   206 		void InitializeL(const RMessage2& aMessage);
       
   207 		
       
   208 		/**
       
   209         * Gets default values form server for the client
       
   210         * @since Series 60 3.1
       
   211         * @param aMessage: server side message
       
   212         * @return void
       
   213         */
       
   214 		void GetDefaultValuesL(const RMessage2& aMessage);	
       
   215 
       
   216 	private:
       
   217 	
       
   218 		const TInt iSessionId;
       
   219 		RArray<RMessage2> iMessageArray;
       
   220    		RArray<CTelephonyAudioRouting::TAudioOutput> iSessionAvailableOutputs;		
       
   221   		TBool iPolicyFlag;
       
   222   		TBool iConnected;
       
   223   		
       
   224   	
       
   225   	};
       
   226 	
       
   227 #endif 		// TELEPHONYAUDIOROUTINGSERVERSESSION_H